From bfadbaa0eb94afe209b4b49728eae095bbfe40c8 Mon Sep 17 00:00:00 2001 From: Din Music Date: Thu, 19 Dec 2024 15:54:17 +0000 Subject: [PATCH] lxd/storage/drivers/powerflex: Prevent changing powerflex.mode Signed-off-by: Din Music --- lxd/storage/drivers/driver_powerflex.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lxd/storage/drivers/driver_powerflex.go b/lxd/storage/drivers/driver_powerflex.go index b523302e41ad..4bcb82575ac8 100644 --- a/lxd/storage/drivers/driver_powerflex.go +++ b/lxd/storage/drivers/driver_powerflex.go @@ -280,6 +280,15 @@ func (d *powerflex) Validate(config map[string]string) error { return err } + newMode := config["powerflex.mode"] + oldMode := d.config["powerflex.mode"] + + // Ensure powerflex.mode cannot be changed to avoid leaving volume mappings + // and to prevent disturbing running instances. + if oldMode != "" && oldMode != newMode { + return fmt.Errorf("PowerFlex mode cannot be changed") + } + // Check if the selected PowerFlex mode is supported on this node. // Also when forming the storage pool on a LXD cluster, the mode // that got discovered on the creating machine needs to be validated