diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go index 4c7e1c686dfb..66f5abc0dc0d 100644 --- a/lxd/instance/drivers/driver_qemu.go +++ b/lxd/instance/drivers/driver_qemu.go @@ -6495,11 +6495,6 @@ func (d *qemu) MigrateSend(args instance.MigrateSendArgs) error { d.logger.Info("Migration send starting") defer d.logger.Info("Migration send stopped") - // Check for stateful support. - if args.Live && shared.IsFalseOrEmpty(d.expandedConfig["migration.stateful"]) { - return fmt.Errorf("Stateful migration requires migration.stateful to be set to true") - } - // Wait for essential migration connections before negotiation. connectionsCtx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() @@ -6509,6 +6504,11 @@ func (d *qemu) MigrateSend(args instance.MigrateSendArgs) error { return err } + // Check for stateful support. + if args.Live && shared.IsFalseOrEmpty(d.expandedConfig["migration.stateful"]) { + return fmt.Errorf("Stateful migration requires migration.stateful to be set to true") + } + pool, err := storagePools.LoadByInstance(d.state, d) if err != nil { return fmt.Errorf("Failed loading instance: %w", err)