[][src]Trait ttstack::model::VmEngine

pub trait VmEngine: Firewall + Storage {
    pub fn check_feat(&self, feat_wanted: &[VmEngineFeat]) -> Result<bool>;
pub fn start_vm(&self, vm: &mut Vm) -> Result<()>;
pub fn stop_vm(&self, vm: &mut Vm) -> Result<()>;
pub fn update_vm(&mut self, vm: Vm) -> Result<()>;
pub fn cache_meta(&self, vm: &Vm) -> Result<PathBuf>;
pub fn gen_vm_from_meta(&self, path: &Path) -> Result<Vm>; pub fn create_vm(&self, vm: &mut Vm) -> Result<()> { ... }
pub fn destroy_vm(&self, vm: &mut Vm) -> Result<()> { ... }
pub fn rm_meta(&self, vm: &mut Vm, path: &Path) -> Result<()> { ... }
pub fn create_snapshot(
        &self,
        vm: &mut Vm,
        name: &str,
        life_time: Option<u64>
    ) -> Result<()> { ... }
pub fn destroy_snapshot(&self, vm: &mut Vm, name: &str) -> Result<()> { ... }
pub fn apply_snapshot(&mut self, vm: &mut Vm, name: &str) -> Result<()> { ... } }

Common methods for each engine, such as 'Firecracker', 'Qemu', 'Docker' ...

Required methods

pub fn check_feat(&self, feat_wanted: &[VmEngineFeat]) -> Result<bool>[src]

Check if all features the client wanted can be supported.

pub fn start_vm(&self, vm: &mut Vm) -> Result<()>[src]

Start a stopped VM.

pub fn stop_vm(&self, vm: &mut Vm) -> Result<()>[src]

Stop(aka pause) a running VM.

pub fn update_vm(&mut self, vm: Vm) -> Result<()>[src]

Use the new Vm instead of the old one, apply all configs in the new Vm.

pub fn cache_meta(&self, vm: &Vm) -> Result<PathBuf>[src]

Cache all infomations of the 'Vm' to disk.

pub fn gen_vm_from_meta(&self, path: &Path) -> Result<Vm>[src]

Restruct a Vm from a cached config.

Loading content...

Provided methods

pub fn create_vm(&self, vm: &mut Vm) -> Result<()>[src]

Create the VM instance, and update necessary data of the Vm.

pub fn destroy_vm(&self, vm: &mut Vm) -> Result<()>[src]

Destroy the VM instance, and update necessary data of the Vm.

pub fn rm_meta(&self, vm: &mut Vm, path: &Path) -> Result<()>[src]

Remove a cached config of Vm.

pub fn create_snapshot(
    &self,
    vm: &mut Vm,
    name: &str,
    life_time: Option<u64>
) -> Result<()>
[src]

Add a snapshot for the runtime image:

  1. stop the runtime instance
  2. cache current meta-config
  3. snapshot storage
  4. restart the runtime instance

pub fn destroy_snapshot(&self, vm: &mut Vm, name: &str) -> Result<()>[src]

Delete a snapshot of the runtime image:

  1. remove the storage of snapshot
  2. remove the cached-meta of snapshot

pub fn apply_snapshot(&mut self, vm: &mut Vm, name: &str) -> Result<()>[src]

Revert to the state of this snapshot:

  1. stop the runtime instance
  2. relink runtime image to the one in snapshot
  3. restore the responding Vm from cached-meta
  4. restart the runtime instance
Loading content...

Implementors

Loading content...