mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-04 19:11:11 +00:00
vmm: config: Add "uuid" option to "--platform"
The uuid indicates the unique ID of a virtual machine. cloud-hypervisor takes the uuid passed by libvirt and uses it to initialize cloud-init. Signed-off-by: lizhaoxin1 <Lxiaoyouling@163.com>
This commit is contained in:
parent
147e89f413
commit
3abc1e1e51
@ -155,7 +155,7 @@ fn create_app<'a>(
|
||||
Arg::new("platform")
|
||||
.long("platform")
|
||||
.help(
|
||||
"num_pci_segments=<num pci segments>,iommu_segments=<list_of_segments>,serial_number=<(DMI) device serial number>",
|
||||
"num_pci_segments=<num_pci_segments>,iommu_segments=<list_of_segments>,serial_number=<dmi_device_serial_number>,uuid=<dmi_device_uuid>",
|
||||
)
|
||||
.takes_value(true)
|
||||
.group("vm-config"),
|
||||
|
@ -634,6 +634,8 @@ pub struct PlatformConfig {
|
||||
pub iommu_segments: Option<Vec<u16>>,
|
||||
#[serde(default)]
|
||||
pub serial_number: Option<String>,
|
||||
#[serde(default)]
|
||||
pub uuid: Option<String>,
|
||||
}
|
||||
|
||||
impl PlatformConfig {
|
||||
@ -642,6 +644,7 @@ impl PlatformConfig {
|
||||
parser.add("num_pci_segments");
|
||||
parser.add("iommu_segments");
|
||||
parser.add("serial_number");
|
||||
parser.add("uuid");
|
||||
parser.parse(platform).map_err(Error::ParsePlatform)?;
|
||||
|
||||
let num_pci_segments: u16 = parser
|
||||
@ -655,10 +658,12 @@ impl PlatformConfig {
|
||||
let serial_number = parser
|
||||
.convert("serial_number")
|
||||
.map_err(Error::ParsePlatform)?;
|
||||
let uuid = parser.convert("uuid").map_err(Error::ParsePlatform)?;
|
||||
Ok(PlatformConfig {
|
||||
num_pci_segments,
|
||||
iommu_segments,
|
||||
serial_number,
|
||||
uuid,
|
||||
})
|
||||
}
|
||||
|
||||
@ -687,6 +692,7 @@ impl Default for PlatformConfig {
|
||||
num_pci_segments: DEFAULT_NUM_PCI_SEGMENTS,
|
||||
iommu_segments: None,
|
||||
serial_number: None,
|
||||
uuid: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user