[lxc-devel] [lxd/master] Instance: Write out updated backup.yaml after rename

tomponline on Github lxc-bot at linuxcontainers.org
Tue Oct 27 17:24:55 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 376 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201027/4c03524f/attachment-0001.bin>
-------------- next part --------------
From 74c1e881df63a4d211e674e790459925a321ac5e Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 27 Oct 2020 17:24:08 +0000
Subject: [PATCH] lxd/instance/drivers: Write out updated backup.yaml after
 rename

Fixes #8071

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/instance/drivers/driver_lxc.go  | 5 +++++
 lxd/instance/drivers/driver_qemu.go | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/lxd/instance/drivers/driver_lxc.go b/lxd/instance/drivers/driver_lxc.go
index 0efab52699..a89a68e866 100644
--- a/lxd/instance/drivers/driver_lxc.go
+++ b/lxd/instance/drivers/driver_lxc.go
@@ -3747,6 +3747,11 @@ func (c *lxc) Rename(newName string) error {
 	// Update lease files.
 	network.UpdateDNSMasqStatic(c.state, "")
 
+	err = c.UpdateBackupFile()
+	if err != nil {
+		return err
+	}
+
 	logger.Info("Renamed container", ctxMap)
 
 	if c.IsSnapshot() {
diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go
index ba1381043a..d5e81b5200 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -2751,6 +2751,11 @@ func (vm *qemu) Rename(newName string) error {
 	// Update lease files.
 	network.UpdateDNSMasqStatic(vm.state, "")
 
+	err = vm.UpdateBackupFile()
+	if err != nil {
+		return err
+	}
+
 	logger.Info("Renamed instance", ctxMap)
 
 	if vm.IsSnapshot() {


More information about the lxc-devel mailing list