The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2553
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === In particular: the migration storage might have been in use after a migration, so it's not safe to stop it like we were before (presumably it was giving EBUSY, but since we didn't cehck the return code it was ok). Instead, let's only start it before we need it, and stop it when we're done. The OnStart hook will start the storage again if it is needed by the actual container, so we don't need to take care of that. Closes #2505 Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
From 38d794806a8ca781a0ed69798c8a6e9ea8ea7a70 Mon Sep 17 00:00:00 2001 From: Tycho Andersen <tycho.ander...@canonical.com> Date: Mon, 24 Oct 2016 15:19:12 -0600 Subject: [PATCH] migration: start migration storage at the right time In particular: the migration storage might have been in use after a migration, so it's not safe to stop it like we were before (presumably it was giving EBUSY, but since we didn't cehck the return code it was ok). Instead, let's only start it before we need it, and stop it when we're done. The OnStart hook will start the storage again if it is needed by the actual container, so we don't need to take care of that. Closes #2505 Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com> --- lxd/containers_post.go | 6 ------ lxd/storage.go | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lxd/containers_post.go b/lxd/containers_post.go index 9b2d523..659de32 100644 --- a/lxd/containers_post.go +++ b/lxd/containers_post.go @@ -293,20 +293,14 @@ func createFromMigration(d *Daemon, req *containerPostReq) Response { } run := func(op *operation) error { - // Start the storage for this container (LVM mount/umount) - c.StorageStart() - // And finaly run the migration. err = sink.Do(op) if err != nil { - c.StorageStop() shared.LogError("Error during migration sink", log.Ctx{"err": err}) c.Delete() return fmt.Errorf("Error transferring container data: %s", err) } - defer c.StorageStop() - err = c.TemplateApply("copy") if err != nil { return err diff --git a/lxd/storage.go b/lxd/storage.go index 7c25bfd..5bb94dc 100644 --- a/lxd/storage.go +++ b/lxd/storage.go @@ -702,6 +702,11 @@ func rsyncMigrationSink(live bool, container container, snapshots []*Snapshot, c return err } } else { + if err := container.StorageStart(); err != nil { + return err + } + defer container.StorageStop() + for _, snap := range snapshots { if err := RsyncRecv(shared.AddSlash(container.Path()), conn); err != nil { return err
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel