The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5742
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) === Signed-off-by: Stéphane Graber <[email protected]>
From 1be2f80afeed0ccee761f795d3c70c98d7f828a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]> Date: Wed, 8 May 2019 16:38:22 -0400 Subject: [PATCH] lxd/container: Early check for running container refresh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <[email protected]> --- lxd/containers_post.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lxd/containers_post.go b/lxd/containers_post.go index 0151b59eee..fdfa2b972a 100644 --- a/lxd/containers_post.go +++ b/lxd/containers_post.go @@ -267,6 +267,7 @@ func createFromMigration(d *Daemon, project string, req *api.ContainersPost) Res args.Devices[localRootDiskDeviceKey]["pool"] = storagePool } + // Early check for refresh if req.Source.Refresh { // Check if the container exists c, err = containerLoadByProjectAndName(d.State(), project, req.Name) @@ -545,6 +546,17 @@ func createFromCopy(d *Daemon, project string, req *api.ContainersPost) Response } } + // Early check for refresh + if req.Source.Refresh { + // Check if the container exists + c, err := containerLoadByProjectAndName(d.State(), targetProject, req.Name) + if err != nil { + req.Source.Refresh = false + } else if c.IsRunning() { + return BadRequest(fmt.Errorf("Cannot refresh a running container")) + } + } + args := db.ContainerArgs{ Project: targetProject, Architecture: source.Architecture(),
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
