[lxc-devel] [lxd/master] Import bugfixes
stgraber on Github
lxc-bot at linuxcontainers.org
Mon Mar 27 21:00:26 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170327/cc1666a5/attachment.bin>
-------------- next part --------------
From f05d022dfa8390c01566b14e8728c2ad39078a71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 27 Mar 2017 16:49:50 -0400
Subject: [PATCH 1/2] tests: Make sure we also delete dependent records
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
test/suites/backup.sh | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/test/suites/backup.sh b/test/suites/backup.sh
index ed1fe13..7021bbe 100644
--- a/test/suites/backup.sh
+++ b/test/suites/backup.sh
@@ -19,7 +19,7 @@ test_container_import() {
lxc snapshot ctImport
lxc start ctImport
shutdown_lxd "${LXD_IMPORT_DIR}"
- sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM containers WHERE name='ctImport'"
+ sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport'"
respawn_lxd "${LXD_IMPORT_DIR}"
! lxd import ctImport
lxd import ctImport --force
@@ -30,7 +30,7 @@ test_container_import() {
lxc snapshot ctImport
lxc start ctImport
shutdown_lxd "${LXD_IMPORT_DIR}"
- sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM containers WHERE name='ctImport/snap0'"
+ sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport/snap0'"
respawn_lxd "${LXD_IMPORT_DIR}"
! lxd import ctImport
lxd import ctImport --force
@@ -41,9 +41,9 @@ test_container_import() {
lxc snapshot ctImport
lxc start ctImport
shutdown_lxd "${LXD_IMPORT_DIR}"
- sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM containers WHERE name='ctImport'"
- sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM containers WHERE name='ctImport/snap0'"
- sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM storage_volumes WHERE name='ctImport'"
+ sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport'"
+ sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport/snap0'"
+ sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM storage_volumes WHERE name='ctImport'"
respawn_lxd "${LXD_IMPORT_DIR}"
! lxd import ctImport
lxd import ctImport --force
@@ -54,10 +54,10 @@ test_container_import() {
lxc snapshot ctImport
lxc start ctImport
shutdown_lxd "${LXD_IMPORT_DIR}"
- sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM containers WHERE name='ctImport'"
- sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM containers WHERE name='ctImport/snap0'"
- sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM storage_volumes WHERE name='ctImport'"
- sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM storage_volumes WHERE name='ctImport/snap0'"
+ sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport'"
+ sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport/snap0'"
+ sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM storage_volumes WHERE name='ctImport'"
+ sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM storage_volumes WHERE name='ctImport/snap0'"
respawn_lxd "${LXD_IMPORT_DIR}"
lxd import ctImport
lxd import ctImport --force
@@ -71,7 +71,7 @@ test_container_import() {
lxc init testimage ctImport
lxc snapshot ctImport
shutdown_lxd "${LXD_IMPORT_DIR}"
- sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM storage_volumes WHERE name='ctImport/snap0'"
+ sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM storage_volumes WHERE name='ctImport/snap0'"
respawn_lxd "${LXD_IMPORT_DIR}"
! lxd import ctImport
lxd import ctImport --force
From f3d354ff8b8a89e35952a380d1ff727338ef270f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 27 Mar 2017 16:58:49 -0400
Subject: [PATCH 2/2] tests: Stop containers before modifying the db
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
test/suites/backup.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/test/suites/backup.sh b/test/suites/backup.sh
index 7021bbe..16d5c5d 100644
--- a/test/suites/backup.sh
+++ b/test/suites/backup.sh
@@ -10,14 +10,17 @@ test_container_import() {
lxc init testimage ctImport
lxc snapshot ctImport
lxc start ctImport
+ lxc stop ctImport --force
! lxd import ctImport
lxd import ctImport --force
lxc info ctImport | grep snap0
+ lxc start ctImport
lxc delete --force ctImport
lxc init testimage ctImport
lxc snapshot ctImport
lxc start ctImport
+ lxc stop ctImport --force
shutdown_lxd "${LXD_IMPORT_DIR}"
sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport'"
respawn_lxd "${LXD_IMPORT_DIR}"
@@ -29,6 +32,7 @@ test_container_import() {
lxc init testimage ctImport
lxc snapshot ctImport
lxc start ctImport
+ lxc stop ctImport --force
shutdown_lxd "${LXD_IMPORT_DIR}"
sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport/snap0'"
respawn_lxd "${LXD_IMPORT_DIR}"
@@ -40,6 +44,7 @@ test_container_import() {
lxc init testimage ctImport
lxc snapshot ctImport
lxc start ctImport
+ lxc stop ctImport --force
shutdown_lxd "${LXD_IMPORT_DIR}"
sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport'"
sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport/snap0'"
@@ -53,6 +58,7 @@ test_container_import() {
lxc init testimage ctImport
lxc snapshot ctImport
lxc start ctImport
+ lxc stop ctImport --force
shutdown_lxd "${LXD_IMPORT_DIR}"
sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport'"
sqlite3 "${LXD_DIR}/lxd.db" "PRAGMA foreign_keys=ON; DELETE FROM containers WHERE name='ctImport/snap0'"
More information about the lxc-devel
mailing list