Skip to main content

PetriVmmBackend

Trait PetriVmmBackend 

Source
pub trait PetriVmmBackend: Debug {
    type VmmConfig: 'static;
    type VmRuntime: PetriVmRuntime;

    const SUPPORTS_VMBUS: bool;
    const SUPPORTS_CPU_EMULATION: bool = false;
    const SUPPORTS_FILE_SHARING: bool = false;

    // Required methods
    fn check_compat(firmware: &Firmware, arch: MachineArch) -> bool;
    fn quirks(firmware: &Firmware) -> (GuestQuirksInner, VmmQuirks);
    fn default_servicing_flags() -> OpenHclServicingFlags;
    fn create_guest_dump_disk(    ) -> Result<Option<(Arc<TempPath>, Box<dyn FnOnce() -> Result<Box<dyn ReadWriteSeek>>>)>>;
    fn build_custom_init_script(pipette_path: &str) -> Option<String>;
    fn new(resolver: &ArtifactResolver<'_>, arch: MachineArch) -> Self;
    fn run<'life0, 'life1, 'async_trait>(
        self,
        config: PetriVmConfig,
        modify_vmm_config: Option<ModifyFn<Self::VmmConfig>>,
        resources: &'life0 PetriVmResources,
        properties: &'life1 PetriVmProperties,
    ) -> Pin<Box<dyn Future<Output = Result<(Self::VmRuntime, PetriVmRuntimeConfig)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn supports_file_sharing(firmware: &Firmware) -> bool { ... }
}
Expand description

Trait for VMM-specific contruction and runtime resources

Required Associated Constants§

Source

const SUPPORTS_VMBUS: bool

Whether the backend supports VMBus.

Provided Associated Constants§

Source

const SUPPORTS_CPU_EMULATION: bool = false

Whether the backend supports full CPU emulation

If this is false, then tests are silently skipped if the host architecture does not match the guest architecture.

Source

const SUPPORTS_FILE_SHARING: bool = false

Whether this backend supports sharing host directories with Linux guests.

Required Associated Types§

Source

type VmmConfig: 'static

VMM-specific configuration

Source

type VmRuntime: PetriVmRuntime

Runtime object

Required Methods§

Source

fn check_compat(firmware: &Firmware, arch: MachineArch) -> bool

Check whether the combination of guest firmware, guest architecture, and internally determined host properties is supported by the backend.

Any combinations that return false will be silently skipped. This should not be used to skip configurations that are never valid (for example, PCAT AARCH64 should always result in an error), and only be used if the configuration is sometimes valid (for example, OpenVMM + OpenHCL is only valid on Windows X64 hosts).

Source

fn quirks(firmware: &Firmware) -> (GuestQuirksInner, VmmQuirks)

Select backend specific quirks guest and vmm quirks.

Source

fn default_servicing_flags() -> OpenHclServicingFlags

Get the default servicing flags (based on what this backend supports)

Source

fn create_guest_dump_disk() -> Result<Option<(Arc<TempPath>, Box<dyn FnOnce() -> Result<Box<dyn ReadWriteSeek>>>)>>

Create a disk for guest crash dumps, and a post-test hook to open the disk to allow for reading the dumps.

Source

fn build_custom_init_script(pipette_path: &str) -> Option<String>

Generate an rdinit script that does the necessary configuration to launch pipette for linux direct

Source

fn new(resolver: &ArtifactResolver<'_>, arch: MachineArch) -> Self

Resolve any artifacts needed to use this backend

The architecture here is that of the guest, which may or may not be the same as the host.

Source

fn run<'life0, 'life1, 'async_trait>( self, config: PetriVmConfig, modify_vmm_config: Option<ModifyFn<Self::VmmConfig>>, resources: &'life0 PetriVmResources, properties: &'life1 PetriVmProperties, ) -> Pin<Box<dyn Future<Output = Result<(Self::VmRuntime, PetriVmRuntimeConfig)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create and start VM from the generic config using the VMM backend

Provided Methods§

Source

fn supports_file_sharing(firmware: &Firmware) -> bool

Whether this guest can use the backend’s Linux 9p shares.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§