pub fn check_vmconfig(&self, is_daemonize: bool) -> Result<()> {
        self.boot_source.check()?;
        self.machine_config.check()?;

        if self.guest_name.len() > MAX_STRING_LENGTH {
            return Err(self::errors::ErrorKind::StringLengthTooLong(
                "name".to_string(),
                MAX_STRING_LENGTH,
            )
            .into());
        }
        if self.boot_source.kernel_file.is_none()
            && self.machine_config.mach_type == MachineType::MicroVm
        {
            bail!("kernel file is required for microvm machine type, which is not provided");
        }

        if self.boot_source.initrd.is_none() && self.drives.is_empty() {
            bail!("Before Vm start, set a initrd or drive_file as rootfs");
        }

        let mut stdio_count = 0;
        if let Some(serial) = self.serial.as_ref() {
            if serial.chardev.backend == ChardevType::Stdio {
                stdio_count += 1;
            }
        }
        for (_, char_dev) in self.chardev.clone() {
            if char_dev.backend == ChardevType::Stdio {
                stdio_count += 1;
            }
        }
        if stdio_count > 0 && is_daemonize {
            bail!("Device redirected to stdio and daemonize can't be set together");
        }
        if stdio_count > 1 {
            bail!("Can't set multiple devices redirected to stdio");
        }

        Ok(())
    }
/// Healthy check for `VmConfig`
Healthy check for `VmConfig`
Healthy check for ` VmConfig `
pub fn check_vmconfig(&self, is_daemonize: bool) -> Result<()> {
        self.boot_source.check()?;
        self.machine_config.check()?;
        if self.guest_name.len() > MAX_STRING_LENGTH {
            return Err(self::errors::ErrorKind::StringLengthTooLong(
                "name".to_string(),
                MAX_STRING_LENGTH,
            )
            .into());
        }
        if self.boot_source.kernel_file.is_none()
            && self.machine_config.mach_type == MachineType::MicroVm
        {
            bail!("kernel file is required for microvm machine type, which is not provided");
        }
        if self.boot_source.initrd.is_none() && self.drives.is_empty() {
            bail!("Before Vm start, set a initrd or drive_file as rootfs");
        }
        let mut stdio_count = 0;
        if let Some(serial) = self.serial.as_ref() {
            if serial.chardev.backend == ChardevType::Stdio {
                stdio_count += 1;
            }
        }
        for (_, char_dev) in self.chardev.clone() {
            if char_dev.backend == ChardevType::Stdio {
                stdio_count += 1;
            }
        }
        if stdio_count > 0 && is_daemonize {
            bail!("Device redirected to stdio and daemonize can't be set together");
        }
        if stdio_count > 1 {
            bail!("Can't set multiple devices redirected to stdio");
        }
        Ok(())
    }
pub fn check_vmconfig ( & self , is_daemonize : bool ) -> Result < ( ) > { self . boot_source . check ( ) ? ; self . machine_config . check ( ) ? ; if self . guest_name . len ( ) > MAX_STRING_LENGTH { return Err ( self :: errors :: ErrorKind :: StringLengthTooLong ( " " . to_string ( ) , MAX_STRING_LENGTH , ) . into ( ) ) ; } if self . boot_source . kernel_file . is_none ( ) && self . machine_config . mach_type == MachineType :: MicroVm { bail ! ( " " ) ; } if self . boot_source . initrd . is_none ( ) && self . drives . is_empty ( ) { bail ! ( " " ) ; } let mut stdio_count = 0 ; if let Some ( serial ) = self . serial . as_ref ( ) { if serial . chardev . backend == ChardevType :: Stdio { stdio_count += 1 ; } } for ( _ , char_dev ) in self . chardev . clone ( ) { if char_dev . backend == ChardevType :: Stdio { stdio_count += 1 ; } } if stdio_count > 0 && is_daemonize { bail ! ( " " ) ; } if stdio_count > 1 { bail ! ( " " ) ; } Ok ( ( ) ) }
Healthy check for `VmConfig`
Healthy check for ` VmConfig `
&self
is_daemonize
bool
&self
is_daemonize
bool