From c525e53aa59edaa8838dcd9b6fe853f4f595a57f Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Fri, 20 Oct 2023 11:46:37 +0200 Subject: [PATCH] lxd/patches: Add cluster check for patches fixing volumes Signed-off-by: Thomas Hipp --- lxd/patches.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lxd/patches.go b/lxd/patches.go index 761ec578e83f..bebd4e27c4d1 100644 --- a/lxd/patches.go +++ b/lxd/patches.go @@ -832,6 +832,11 @@ func patchStorageRenameCustomISOBlockVolumes(name string, d *Daemon) error { } for _, vol := range volumes { + // In a non-clusted environment ServerName will be empty. + if s.ServerName != "" && vol.Location != s.ServerName { + continue + } + // Exclude non-ISO custom volumes. if vol.ContentType != db.StoragePoolVolumeContentTypeNameISO { continue @@ -907,6 +912,11 @@ func patchZfsSetContentTypeUserProperty(name string, d *Daemon) error { } for _, vol := range volumes { + // In a non-clusted environment ServerName will be empty. + if s.ServerName != "" && vol.Location != s.ServerName { + continue + } + zfsPoolName := p.Driver().Config()["zfs.pool_name"] if zfsPoolName != "" { poolName = zfsPoolName @@ -986,7 +996,8 @@ func patchStorageZfsUnsetInvalidBlockSettings(_ string, d *Daemon) error { for pool, volumes := range poolVolumes { for _, vol := range volumes { - if vol.Location != s.ServerName { + // In a non-clusted environment ServerName will be empty. + if s.ServerName != "" && vol.Location != s.ServerName { continue }