cloud-hypervisor-client 0.4.0+api-spec-0.3.0-2026-05-04

Unofficial Rust crate for accessing the cloud-hypervisor REST API.
Documentation
/*
 * Cloud Hypervisor API
 *
 * Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
 *
 * The version of the OpenAPI document: 0.3.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CpusConfig {
    #[serde(rename = "boot_vcpus")]
    pub boot_vcpus: i32,
    #[serde(rename = "max_vcpus")]
    pub max_vcpus: i32,
    #[serde(rename = "topology", skip_serializing_if = "Option::is_none")]
    pub topology: Option<models::CpuTopology>,
    #[serde(rename = "kvm_hyperv", skip_serializing_if = "Option::is_none")]
    pub kvm_hyperv: Option<bool>,
    #[serde(rename = "max_phys_bits", skip_serializing_if = "Option::is_none")]
    pub max_phys_bits: Option<i32>,
    #[serde(rename = "nested", skip_serializing_if = "Option::is_none")]
    pub nested: Option<bool>,
    #[serde(rename = "affinity", skip_serializing_if = "Option::is_none")]
    pub affinity: Option<Vec<models::CpuAffinity>>,
    #[serde(rename = "features", skip_serializing_if = "Option::is_none")]
    pub features: Option<models::CpuFeatures>,
    #[serde(rename = "core_scheduling", skip_serializing_if = "Option::is_none")]
    pub core_scheduling: Option<models::CoreSchedulingMode>,
}

impl CpusConfig {
    pub fn new(boot_vcpus: i32, max_vcpus: i32) -> CpusConfig {
        CpusConfig {
            boot_vcpus,
            max_vcpus,
            topology: None,
            kvm_hyperv: None,
            max_phys_bits: None,
            nested: None,
            affinity: None,
            features: None,
            core_scheduling: None,
        }
    }
}