pub struct Machine { /* private fields */ }
Expand description

Machine is process handler of rust side

Implementations§

source§

impl Machine

source

pub async fn start_vmm_test(&mut self) -> Result<(), MachineError>

source§

impl Machine

functional methods

source

pub fn new( cfg: Config ) -> Result<(Machine, Sender<MachineMessage>), MachineError>

new initializes a new Machine instance and performs validation of the provided Config.

source

pub fn rebuild( core: MachineCore ) -> Result<(Machine, Sender<MachineMessage>), MachineError>

Rebuild Machine from raw metadata (MachineCore)

source

pub fn dump_into_core(&self) -> Result<MachineCore, MachineError>

source

pub async fn start(&mut self) -> Result<(), MachineError>

Start actually start a Firecracker microVM.

source

pub async fn wait(&mut self) -> Result<(), MachineError>

wait will wait until the firecracker process has finished, or has been forced to terminate.

source

pub async fn shutdown(&self) -> Result<(), MachineError>

shutdown requests a clean shutdown of the VM by sending CtrlAltDelete on the virtual keyboard

source

pub async fn pause(&self) -> Result<(), MachineError>

pause pauses the microVM

source

pub async fn resume(&self) -> Result<(), MachineError>

resume resumes the microVM from pausing

source

pub async fn stop_vmm(&mut self) -> Result<(), MachineError>

stop_vmm stops the current VMM by sending a SIGTERM

source

pub async fn stop_vmm_force(&mut self) -> Result<(), MachineError>

stop_vmm_force stops the current VMM by sending a SIGKILL

source§

impl Machine

util methods

source

pub fn get_log_file(&self) -> Option<PathBuf>

source

pub fn set_command(&mut self, cmd: Command)

source

pub fn pid(&self) -> Result<u32, MachineError>

PID returns the machine’s running process PID or an error if not running

source§

impl Machine

useful methods that could be exposed to users

source

pub async fn update_metadata( &self, metadata: &String ) -> Result<(), MachineError>

update_metadata patches the machine’s metadata for MDDS

source

pub async fn get_metadata(&self) -> Result<String, MachineError>

get_metadata gets the machine’s metadata from MDDS and unmarshals it into v

source

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

source

pub async fn describe_instance_info(&self) -> Result<InstanceInfo, MachineError>

describe_instance_info gets the information of the microVM.

source

pub async fn create_snapshot( &self, mem_file_path: PathBuf, snapshot_path: PathBuf ) -> Result<(), MachineError>

create_snapshot creates a snapshot of the VM.

source

pub async fn get_balloon_config(&self) -> Result<Balloon, MachineError>

get_balloon_config gets the current balloon device configuration.

source

pub async fn update_balloon(&self, amount_mib: i64) -> Result<(), MachineError>

update_balloon will update an existing balloon device, before or after machine startup.

source

pub async fn get_balloon_stats(&self) -> Result<BalloonStatistics, MachineError>

get_balloon_stats gets the latest balloon device statistics, only if enabled pre-boot.

source

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.

source

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

source

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

source

pub async fn get_export_vm_config( &mut self ) -> Result<FullVmConfiguration, MachineError>

source

pub async fn get_firecracker_version( &mut self ) -> Result<FirecrackerVersion, MachineError>

source

pub async fn update_machine_configuration( &mut self, machine_config: &MachineConfiguration ) -> Result<(), MachineError>

source

pub async fn load_from_snapshot( &mut self, snapshot_load_params: &SnapshotLoadParams ) -> Result<(), MachineError>

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more