[lxc-devel] [lxd/master] lxd/storage/backend/lxd/patches: Ignores snapshots rename renaming

tomponline on Github lxc-bot at linuxcontainers.org
Thu Mar 26 17:49:19 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 529 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200326/d566140b/attachment.bin>
-------------- next part --------------
From b863b4dbb5042fae7e907f6852be31c5b63ffc81 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Thu, 26 Mar 2020 17:47:56 +0000
Subject: [PATCH] lxd/storage/backend/lxd/patches: Ignores snapshots when
 retrieving list of custom volumes to be renamed

Snapshots of custom volumes will be renamed as part of parent volume rename.

Fixes #7076

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage/backend_lxd_patches.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lxd/storage/backend_lxd_patches.go b/lxd/storage/backend_lxd_patches.go
index 86746eab0d..99b45d9a00 100644
--- a/lxd/storage/backend_lxd_patches.go
+++ b/lxd/storage/backend_lxd_patches.go
@@ -43,6 +43,10 @@ func lxdPatchStorageRenameCustomVolumeAddProject(b *lxdBackend) error {
 	defer revert.Fail()
 
 	for _, v := range volumes {
+		if shared.IsSnapshot(v.Name) {
+			continue // Snapshots will be renamed as part of the parent volume rename.
+		}
+
 		// Run inside temporary function to ensure revert has correct volume scope.
 		err = func(curVol *api.StorageVolume) error {
 			// There's no need to pass the config as it's not needed when renaming a volume.


More information about the lxc-devel mailing list