Skip to content

Commit 152287d

Browse files
committed
server: allow stop requests with a pending migration out
This was the request queue's previous behavior. It ensures that a request to stop drives the current Propolis to a halted state, but does not guarantee that the "logical" VM isn't running somewhere else (i.e. in a migration target).
1 parent 0178609 commit 152287d

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

bin/propolis-server/src/lib/vm/request_queue.rs

+12-20
Original file line numberDiff line numberDiff line change
@@ -466,15 +466,16 @@ impl ExternalRequestQueue {
466466
}
467467
}
468468

469-
// As with reboots, deny requests to stop a VM that might
470-
// migrate out first, since the request may need to be directed
471-
// to the migration target.
469+
// Always queue requests to stop a VM unless one is already
470+
// present.
471+
//
472+
// Note that if the VM migrates out before this request is
473+
// processed, then the "logical" VM is still running (in another
474+
// Propolis). The client is responsible for tracking any
475+
// outstanding migrations and directing its stop requests
476+
// accordingly.
472477
ExternalRequest::State(StateChangeRequest::Stop) => {
473-
if self.awaiting_migration_out {
474-
return Err(
475-
RequestDeniedReason::InvalidForMigrationSource,
476-
);
477-
} else if self.awaiting_stop {
478+
if self.awaiting_stop {
478479
return Ok(false);
479480
}
480481
}
@@ -898,12 +899,8 @@ mod test {
898899
}
899900

900901
RequestKind::Stop => {
901-
if !migrating_out {
902-
assert!(result.is_ok());
903-
stop_requested = true;
904-
} else {
905-
assert!(result.is_err());
906-
}
902+
assert!(result.is_ok());
903+
stop_requested = true;
907904
}
908905

909906
RequestKind::Reboot => {
@@ -1155,13 +1152,8 @@ mod test {
11551152
}
11561153
}
11571154
RequestKind::Stop => {
1155+
assert!(result.is_ok());
11581156
if self.halted || self.stop_requested {
1159-
assert!(result.is_ok());
1160-
return;
1161-
}
1162-
1163-
if self.migrate_out_requested {
1164-
assert!(result.is_err());
11651157
return;
11661158
}
11671159

0 commit comments

Comments
 (0)