pub struct PartitionUnit { /* private fields */ }Expand description
The control point for managing a partition unit.
Implementations§
Source§impl PartitionUnit
impl PartitionUnit
Sourcepub fn new(
spawner: impl Spawn,
builder: UnitBuilder<'_>,
partition: impl VmPartition,
params: PartitionUnitParams<'_>,
) -> Result<(Self, Vec<VpRunner>), Error>
pub fn new( spawner: impl Spawn, builder: UnitBuilder<'_>, partition: impl VmPartition, params: PartitionUnitParams<'_>, ) -> Result<(Self, Vec<VpRunner>), Error>
Creates a new VM partition state unit.
The caller is responsible for launching a thread for each VP and running
the VP using the returned VpRunners.
Sourcepub fn unit_handle(&self) -> &UnitHandle
pub fn unit_handle(&self) -> &UnitHandle
Gets the handle for the partition unit.
Sourcepub async fn teardown(self) -> Sender<HaltReason>
pub async fn teardown(self) -> Sender<HaltReason>
Tears down the state unit, returning the client_notify_send sender
passed to Self::new().
Sourcepub async fn clear_halt(&mut self) -> bool
pub async fn clear_halt(&mut self) -> bool
Clears the current halt reason from the partition, resuming the VPs if they are stopped.
Sourcepub async fn temporarily_stop_vps(&mut self) -> StopGuard
pub async fn temporarily_stop_vps(&mut self) -> StopGuard
Temporarily stops the VPs, returning a guard that will resume them when dropped.
Sourcepub async fn set_initial_regs(
&mut self,
vtl: Vtl,
state: Arc<InitialRegs>,
) -> Result<(), InitialRegError>
pub async fn set_initial_regs( &mut self, vtl: Vtl, state: Arc<InitialRegs>, ) -> Result<(), InitialRegError>
Sets the register state for the VPs for initial boot.
If the VM has been run before and has not been reset since it last ran, the target VTL will be scrubbed first so that the partition state is clean.
pub async fn accept_initial_pages( &mut self, initial_pages: Vec<InitialPageImport>, ) -> Result<(), AcceptInitialPagesError>
Sourcepub async fn build_dump_partition_state(&mut self) -> Result<Vec<u8>>
pub async fn build_dump_partition_state(&mut self) -> Result<Vec<u8>>
Builds the partition state blob for a .vmrs dump file.
Stops VPs internally for a consistent snapshot and resumes them afterward. Returns the serialized partition state (VP registers as hypervisor save/restore chunks).