Skip to content

Commit

Permalink
lxd/storage/drivers/powerflex: Prevent changing powerflex.mode
Browse files Browse the repository at this point in the history
Signed-off-by: Din Music <[email protected]>
  • Loading branch information
MusicDin committed Dec 19, 2024
1 parent c679ef7 commit 119e49a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lxd/storage/drivers/driver_powerflex.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,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
Expand Down

0 comments on commit 119e49a

Please sign in to comment.