The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4746
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) === This is to catch anyone who's upgraded to 3.0 but still has some 2.0 configs around. Signed-off-by: Stéphane Graber <[email protected]>
From 622a9e908572ca61db5696bcc9290ed1c7023c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]> Date: Fri, 6 Jul 2018 02:21:52 -0400 Subject: [PATCH] lxd/patches: Force a one-time config re-gen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is to catch anyone who's upgraded to 3.0 but still has some 2.0 configs around. Signed-off-by: Stéphane Graber <[email protected]> --- lxd/patches.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lxd/patches.go b/lxd/patches.go index 91a4acb0d..b098e0d40 100644 --- a/lxd/patches.go +++ b/lxd/patches.go @@ -54,6 +54,7 @@ var patches = []patch{ {name: "storage_api_ceph_size_remove", run: patchStorageApiCephSizeRemove}, {name: "devices_new_naming_scheme", run: patchDevicesNewNamingScheme}, {name: "storage_api_permissions", run: patchStorageApiPermissions}, + {name: "container_config_regen", run: patchContainerConfigRegen}, } type patch struct { @@ -1897,6 +1898,45 @@ func patchStorageApiV1(name string, d *Daemon) error { return nil } +func patchContainerConfigRegen(name string, d *Daemon) error { + cts, err := d.cluster.ContainersNodeList(db.CTypeRegular) + if err != nil { + return err + } + + for _, ct := range cts { + // Load the container from the database. + c, err := containerLoadByName(d.State(), ct) + if err != nil { + return err + } + + if !c.IsRunning() { + continue + } + + lxcCt, ok := c.(*containerLXC) + if !ok { + continue + } + + err = lxcCt.initLXC(true) + if err != nil { + return err + } + + // Generate the LXC config + configPath := filepath.Join(lxcCt.LogPath(), "lxc.conf") + err = lxcCt.c.SaveConfigFile(configPath) + if err != nil { + os.Remove(configPath) + return err + } + } + + return nil +} + func patchStorageApiDirCleanup(name string, d *Daemon) error { fingerprints, err := d.cluster.ImagesGet(false) if err != nil {
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
