From 79bd0f01628dec2fdb937d34ad6c8560db51f703 Mon Sep 17 00:00:00 2001 From: Mark Bolton Date: Thu, 22 Aug 2024 01:47:34 -0700 Subject: [PATCH] lxd/instance/drivers: Reorder check for migration.stateful Signed-off-by: Mark Bolton --- lxd/instance/drivers/driver_qemu.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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)