Skip to content

Commit 4d4e5af

Browse files
authored
Remove MigrateStart instance state request (#332)
This request sets a flag in the VM controller that lets a VM act as a migration source if its state otherwise permits it. There's no way to clear the flag, which makes it tough to write an undo action for this in the Nexus live migration saga that (presumably) would issue this call. Since the request has no other side effects, the VM controller already rejects other invalid requests to migrate out, and sled agent doesn't presently use this request type, just remove it entirely. Tested with an ad hoc migration & PHD tests.
1 parent 88630c0 commit 4d4e5af

File tree

6 files changed

+2
-58
lines changed

6 files changed

+2
-58
lines changed

bin/propolis-cli/src/main.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,6 @@ async fn migrate_instance(
441441
cloud_init_bytes: None,
442442
};
443443

444-
// Get the source instance ready
445-
src_client
446-
.instance_state_put(InstanceStateRequested::MigrateStart)
447-
.await
448-
.with_context(|| {
449-
anyhow!("failed to place src instance in migrate start state")
450-
})?;
451-
452444
// Initiate the migration via the destination instance
453445
let migration_id = dst_client
454446
.instance_ensure(&request)

bin/propolis-server/src/lib/mock_server.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ impl InstanceContext {
133133
self.state = api::InstanceState::Stopped;
134134
Ok(())
135135
}
136-
api::InstanceStateRequested::MigrateStart => {
137-
unimplemented!("migration not yet implemented")
138-
}
139136
},
140137
}
141138
}

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

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ pub enum VmControllerError {
6969
#[error("The instance has a pending request to halt")]
7070
InstanceHaltPending,
7171

72-
#[error("Instance is not marked as a possible migration source")]
73-
NotMarkedMigrationSource,
74-
7572
#[error("Instance is already a migration source")]
7673
AlreadyMigrationSource,
7774

@@ -114,7 +111,6 @@ impl From<VmControllerError> for dropshot::HttpError {
114111
use dropshot::HttpError;
115112
match vm_error {
116113
VmControllerError::AlreadyMigrationSource
117-
| VmControllerError::NotMarkedMigrationSource
118114
| VmControllerError::InvalidRequestForMigrationSource(_)
119115
| VmControllerError::MigrationTargetInProgress
120116
| VmControllerError::MigrationTargetFailed
@@ -322,12 +318,6 @@ struct SharedVmStateInner {
322318
/// that's already running is forbidden.
323319
lifecycle_stage: LifecycleStage,
324320

325-
/// True if the instance previously received an API call denoting that it
326-
/// should expect a request to act as a live migration source. If false,
327-
/// incoming requests to migrate from a prospective destination should be
328-
/// rejected.
329-
marked_migration_source: bool,
330-
331321
/// True if the instance's request queue has a pending request to migrate to
332322
/// another instance. If true, external API requests that may need to be
333323
/// serviced by the target should be blocked until this is cleared. (Clients
@@ -357,7 +347,6 @@ impl SharedVmStateInner {
357347
fn new() -> Self {
358348
Self {
359349
lifecycle_stage: LifecycleStage::NotStarted(StartupStage::ColdBoot),
360-
marked_migration_source: false,
361350
migrate_from_pending: false,
362351
halt_pending: false,
363352
external_request_queue: VecDeque::new(),
@@ -678,13 +667,10 @@ impl VmController {
678667
let mut inner = self.worker_state.inner.lock().unwrap();
679668
match inner.lifecycle_stage {
680669
LifecycleStage::NotStarted(_) => {
681-
assert!(!inner.marked_migration_source);
682670
Err(VmControllerError::InstanceNotActive)
683671
}
684672
LifecycleStage::Active => {
685-
if !inner.marked_migration_source {
686-
Err(VmControllerError::NotMarkedMigrationSource)
687-
} else if inner.migrate_from_pending {
673+
if inner.migrate_from_pending {
688674
Err(VmControllerError::AlreadyMigrationSource)
689675
} else if inner.halt_pending {
690676
Err(VmControllerError::InstanceHaltPending)
@@ -957,26 +943,6 @@ impl VmController {
957943
}
958944
}
959945
}
960-
961-
// Requests to mark the VM as a migration source require the VM to
962-
// be active.
963-
ApiInstanceStateRequested::MigrateStart => {
964-
match inner.lifecycle_stage {
965-
LifecycleStage::NotStarted(_) => {
966-
Err(VmControllerError::InvalidStageForRequest(
967-
requested,
968-
inner.lifecycle_stage,
969-
))
970-
}
971-
LifecycleStage::Active => {
972-
inner.marked_migration_source = true;
973-
Ok(())
974-
}
975-
LifecycleStage::NoLongerActive => {
976-
Err(VmControllerError::InstanceNotActive)
977-
}
978-
}
979-
}
980946
}
981947
}
982948

lib/propolis-client/src/handmade/api.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ pub enum InstanceStateRequested {
138138
Run,
139139
Stop,
140140
Reboot,
141-
MigrateStart,
142141
}
143142

144143
/// Current state of an Instance.

openapi/propolis-server.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,8 +986,7 @@
986986
"enum": [
987987
"Run",
988988
"Stop",
989-
"Reboot",
990-
"MigrateStart"
989+
"Reboot"
991990
]
992991
},
993992
"MigrationState": {

phd-tests/framework/src/test_vm/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,6 @@ impl TestVm {
242242
})
243243
}
244244

245-
/// Moves this VM into the migrate-start state.
246-
fn start_migrate(&self) -> StdResult<(), PropolisClientError> {
247-
self.rt.block_on(async {
248-
self.put_instance_state_async(InstanceStateRequested::MigrateStart)
249-
.await
250-
})
251-
}
252-
253245
async fn put_instance_state_async(
254246
&self,
255247
state: InstanceStateRequested,
@@ -303,7 +295,6 @@ impl TestVm {
303295
source.server.server_addr()
304296
);
305297

306-
source.start_migrate()?;
307298
let console = self.rt.block_on(async {
308299
self.instance_ensure_async(Some(
309300
InstanceMigrateInitiateRequest {

0 commit comments

Comments
 (0)