Struct rustcracker::components::machine::Machine
source · pub struct Machine { /* private fields */ }Expand description
Machine is process handler of rust side
Implementations§
source§impl Machine
impl Machine
pub async fn start_vmm_test(&mut self) -> Result<(), MachineError>
source§impl Machine
impl Machine
functional methods
sourcepub fn new(
cfg: Config
) -> Result<(Machine, Sender<MachineMessage>), MachineError>
pub fn new( cfg: Config ) -> Result<(Machine, Sender<MachineMessage>), MachineError>
new initializes a new Machine instance and performs validation of the provided Config.
sourcepub fn rebuild(
core: MachineCore
) -> Result<(Machine, Sender<MachineMessage>), MachineError>
pub fn rebuild( core: MachineCore ) -> Result<(Machine, Sender<MachineMessage>), MachineError>
Rebuild Machine from raw metadata (MachineCore)
pub fn dump_into_core(&self) -> Result<MachineCore, MachineError>
sourcepub async fn start(&mut self) -> Result<(), MachineError>
pub async fn start(&mut self) -> Result<(), MachineError>
Start actually start a Firecracker microVM.
sourcepub async fn wait(&mut self) -> Result<(), MachineError>
pub async fn wait(&mut self) -> Result<(), MachineError>
wait will wait until the firecracker process has finished, or has been forced to terminate.
sourcepub async fn shutdown(&self) -> Result<(), MachineError>
pub async fn shutdown(&self) -> Result<(), MachineError>
shutdown requests a clean shutdown of the VM by sending CtrlAltDelete on the virtual keyboard
sourcepub async fn pause(&self) -> Result<(), MachineError>
pub async fn pause(&self) -> Result<(), MachineError>
pause pauses the microVM
sourcepub async fn resume(&self) -> Result<(), MachineError>
pub async fn resume(&self) -> Result<(), MachineError>
resume resumes the microVM from pausing
sourcepub async fn stop_vmm(&mut self) -> Result<(), MachineError>
pub async fn stop_vmm(&mut self) -> Result<(), MachineError>
stop_vmm stops the current VMM by sending a SIGTERM
sourcepub async fn stop_vmm_force(&mut self) -> Result<(), MachineError>
pub async fn stop_vmm_force(&mut self) -> Result<(), MachineError>
stop_vmm_force stops the current VMM by sending a SIGKILL
source§impl Machine
impl Machine
util methods
pub fn get_log_file(&self) -> Option<PathBuf>
pub fn set_command(&mut self, cmd: Command)
sourcepub fn pid(&self) -> Result<u32, MachineError>
pub fn pid(&self) -> Result<u32, MachineError>
PID returns the machine’s running process PID or an error if not running
source§impl Machine
impl Machine
useful methods that could be exposed to users
sourcepub async fn update_metadata(
&self,
metadata: &String
) -> Result<(), MachineError>
pub async fn update_metadata( &self, metadata: &String ) -> Result<(), MachineError>
update_metadata patches the machine’s metadata for MDDS
sourcepub async fn get_metadata(&self) -> Result<String, MachineError>
pub async fn get_metadata(&self) -> Result<String, MachineError>
get_metadata gets the machine’s metadata from MDDS and unmarshals it into v
sourcepub async fn update_guest_drive(
&self,
drive_id: String,
path_on_host: PathBuf
) -> Result<(), MachineError>
pub async fn update_guest_drive( &self, drive_id: String, path_on_host: PathBuf ) -> Result<(), MachineError>
update_guest_drive will modify the current guest drive of ID index with the new parameters of the partialDrive
sourcepub async fn describe_instance_info(&self) -> Result<InstanceInfo, MachineError>
pub async fn describe_instance_info(&self) -> Result<InstanceInfo, MachineError>
describe_instance_info gets the information of the microVM.
sourcepub async fn create_snapshot(
&self,
mem_file_path: PathBuf,
snapshot_path: PathBuf
) -> Result<(), MachineError>
pub async fn create_snapshot( &self, mem_file_path: PathBuf, snapshot_path: PathBuf ) -> Result<(), MachineError>
create_snapshot creates a snapshot of the VM.
sourcepub async fn get_balloon_config(&self) -> Result<Balloon, MachineError>
pub async fn get_balloon_config(&self) -> Result<Balloon, MachineError>
get_balloon_config gets the current balloon device configuration.
sourcepub async fn update_balloon(&self, amount_mib: i64) -> Result<(), MachineError>
pub async fn update_balloon(&self, amount_mib: i64) -> Result<(), MachineError>
update_balloon will update an existing balloon device, before or after machine startup.
sourcepub async fn get_balloon_stats(&self) -> Result<BalloonStatistics, MachineError>
pub async fn get_balloon_stats(&self) -> Result<BalloonStatistics, MachineError>
get_balloon_stats gets the latest balloon device statistics, only if enabled pre-boot.
sourcepub async fn update_balloon_stats(
&self,
stats_polling_interval_s: i64
) -> Result<(), MachineError>
pub async fn update_balloon_stats( &self, stats_polling_interval_s: i64 ) -> Result<(), MachineError>
update_balloon_stats will update a balloon device statistics polling interval.
sourcepub async fn update_guest_network_interface_rate_limit(
&self,
iface_id: String,
rate_limiters: RateLimiterSet
) -> Result<(), MachineError>
pub async fn update_guest_network_interface_rate_limit( &self, iface_id: String, rate_limiters: RateLimiterSet ) -> Result<(), MachineError>
update_guest_network_interface_rate_limit modifies the specified network interface’s rate limits
sourcepub async fn refresh_machine_configuration(
&mut self
) -> Result<(), MachineError>
pub async fn refresh_machine_configuration( &mut self ) -> Result<(), MachineError>
refresh_machine_configuration synchronizes our cached representation of the machine configuration with that reported by the Firecracker API