Skip to content

Commit

Permalink
server: get migration target specs from their sources (#807)
Browse files Browse the repository at this point in the history
Change how migration targets decide what VM configuration to use: instead
of having the client send a configuration as part of its request to start
migration, have the target inherit the configuration the source sends in
the live migration preamble. The benefits are that

- Clients (i.e. the control plane) no longer have to remember how they
  configured their migration sources, and
- Most migration compatibility checks are no longer needed--the target's
  configuration is compatible with the source's because it *is* the
  source's configuration.

Some source components do need to be reconfigured over a migration. These
include Crucible and viona backends: Crucible backends need new generation
numbers for each client, and viona backends may change the names of the
host VNICs to which they bind when a VM moves from host to host. To
accommodate this, make the sync phase substitute the target VM's Crucible
and viona backend configuration into the configuration received in the
preamble. This will be formalized more in subsequent changes.

The eventual goal is to change the request-migration API so that clients
don't send targets any instance spec at all. When this happens, targets
won't have a spec until the migration protocol has already begun to run. To
prepare for this:

- Create the VMM's tokio runtime just before creating VM components instead
  of creating it up front and running the entire VM initialization process
  on it. This is needed because the runtime's thread count depends on the
  number of vCPUs in the VM, and that information comes from the instance
  spec.
- Slightly adjust the `instance_spec_get` API to reflect that a spec might
  not be available if a VM is currently initializing via live migration.

Tests: cargo test, PHD.
  • Loading branch information
gjcolombo authored Dec 17, 2024
1 parent 220a6f3 commit bf85e35
Show file tree
Hide file tree
Showing 14 changed files with 451 additions and 1,236 deletions.
9 changes: 7 additions & 2 deletions bin/propolis-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ use anyhow::{anyhow, Context};
use clap::{Parser, Subcommand};
use futures::{future, SinkExt};
use newtype_uuid::{GenericUuid, TypedUuid, TypedUuidKind, TypedUuidTag};
use propolis_client::types::{InstanceMetadata, VersionedInstanceSpec};
use propolis_client::types::{
InstanceMetadata, InstanceSpecStatus, VersionedInstanceSpec,
};
use slog::{o, Drain, Level, Logger};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio_tungstenite::tungstenite::{
Expand Down Expand Up @@ -504,7 +506,10 @@ async fn migrate_instance(
anyhow!("failed to get src instance properties")
})?;
let src_uuid = src_instance.properties.id;
let VersionedInstanceSpec::V0(spec) = &src_instance.spec;
let InstanceSpecStatus::Present(spec) = &src_instance.spec else {
anyhow::bail!("source instance doesn't have a spec yet");
};
let VersionedInstanceSpec::V0(spec) = &spec;

let request = InstanceEnsureRequest {
properties: InstanceProperties {
Expand Down
Loading

0 comments on commit bf85e35

Please sign in to comment.