Skip to content

Commit

Permalink
Merge pull request #13175 from roosterfish/fix_evacuate_stop_dev
Browse files Browse the repository at this point in the history
Migration: Always clone the device config
  • Loading branch information
tomponline authored Mar 18, 2024
2 parents f7cea51 + 81156fe commit e319c51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lxd/instance/drivers/driver_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,9 @@ func (d *common) canMigrate(inst instance.Instance) (migrate bool, live bool) {
volatileGet := func() map[string]string { return map[string]string{} }
volatileSet := func(_ map[string]string) error { return nil }
for deviceName, rawConfig := range d.ExpandedDevices() {
dev, err := device.New(inst, d.state, deviceName, rawConfig, volatileGet, volatileSet)
// Make sure to clone the devices config for new devices.
// Some device drivers might modify the configuration and populate additional settings.
dev, err := device.New(inst, d.state, deviceName, rawConfig.Clone(), volatileGet, volatileSet)
if err != nil {
logger.Warn("Instance will not be migrated due to a device error", logger.Ctx{"project": inst.Project().Name, "instance": inst.Name(), "device": dev.Name(), "err": err})
return false, false
Expand Down

0 comments on commit e319c51

Please sign in to comment.