[lxc-devel] [lxd/master] save slurp file after a snapshot is created
tych0 on Github
lxc-bot at linuxcontainers.org
Tue Nov 29 16:35:15 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 467 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161129/ba710d83/attachment.bin>
-------------- next part --------------
From 62d91d84732a94ff48e24c73172ea4e31cb751c0 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 29 Nov 2016 16:32:58 +0000
Subject: [PATCH] save slurp file after a snapshot is created
Otherwise, we won't have this snapshot in the list of snapshots in the
slurp file, and we'll miss it.
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
lxd/container.go | 6 ++++++
test/suites/migration.sh | 1 +
2 files changed, 7 insertions(+)
diff --git a/lxd/container.go b/lxd/container.go
index 8c8170f..373b1bd 100644
--- a/lxd/container.go
+++ b/lxd/container.go
@@ -566,6 +566,12 @@ func containerCreateAsSnapshot(d *Daemon, args containerArgs, sourceContainer co
return nil, err
}
+ err = writeSlurpFile(sourceContainer)
+ if err != nil {
+ c.Delete()
+ return nil, err
+ }
+
// Once we're done, remove the state directory
if args.Stateful {
os.RemoveAll(sourceContainer.StatePath())
diff --git a/test/suites/migration.sh b/test/suites/migration.sh
index a3bf48f..fcbf75d 100644
--- a/test/suites/migration.sh
+++ b/test/suites/migration.sh
@@ -26,6 +26,7 @@ test_migration() {
lxc_remote init testimage backup
lxc_remote snapshot backup
sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM containers WHERE name='backup'"
+ sqlite3 "${LXD_DIR}/lxd.db" "DELETE FROM containers WHERE name='backup/snap0'"
lxd import backup
lxc_remote info backup | grep snap0
fi
More information about the lxc-devel
mailing list