Skip to content

Commit

Permalink
lxd/instance/drivers: Reorder check for migration.stateful
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Bolton <mark.bolton@canonical.com>
  • Loading branch information
boltmark committed Aug 22, 2024
1 parent 14fd875 commit 79bd0f0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lxd/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down

0 comments on commit 79bd0f0

Please sign in to comment.