diff -Nru lxd-3.0.1/debian/changelog lxd-3.0.1/debian/changelog --- lxd-3.0.1/debian/changelog 2018-07-03 17:21:12.000000000 +0000 +++ lxd-3.0.1/debian/changelog 2018-07-06 13:33:04.000000000 +0000 @@ -1,3 +1,10 @@ +lxd (3.0.1-0ubuntu1~16.04.3) xenial-backports; urgency=medium + + * Cherry-pick upstream upgrade fix: + - 0002-lxd-patches-Force-a-one-time-config-re-gen.patch + + -- Stéphane Graber Fri, 06 Jul 2018 09:33:04 -0400 + lxd (3.0.1-0ubuntu1~16.04.2) xenial-backports; urgency=medium * Cherry-pick upstream upgrade fix: diff -Nru lxd-3.0.1/debian/patches/0002-lxd-patches-Force-a-one-time-config-re-gen.patch lxd-3.0.1/debian/patches/0002-lxd-patches-Force-a-one-time-config-re-gen.patch --- lxd-3.0.1/debian/patches/0002-lxd-patches-Force-a-one-time-config-re-gen.patch 1970-01-01 00:00:00.000000000 +0000 +++ lxd-3.0.1/debian/patches/0002-lxd-patches-Force-a-one-time-config-re-gen.patch 2018-07-06 13:32:41.000000000 +0000 @@ -0,0 +1,77 @@ +From 622a9e908572ca61db5696bcc9290ed1c7023c7e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?St=C3=A9phane=20Graber?= +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 +--- + lxd/patches.go | 40 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + +diff --git a/lxd/patches.go b/lxd/patches.go +index 91a4acb0..b098e0d4 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 { +-- +2.17.1 +