mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-20 07:58:55 +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")
|
Arg::new("platform")
|
||||||
.long("platform")
|
.long("platform")
|
||||||
.help(
|
.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)
|
.takes_value(true)
|
||||||
.group("vm-config"),
|
.group("vm-config"),
|
||||||
|
@ -634,6 +634,8 @@ pub struct PlatformConfig {
|
|||||||
pub iommu_segments: Option<Vec<u16>>,
|
pub iommu_segments: Option<Vec<u16>>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub serial_number: Option<String>,
|
pub serial_number: Option<String>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub uuid: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PlatformConfig {
|
impl PlatformConfig {
|
||||||
@ -642,6 +644,7 @@ impl PlatformConfig {
|
|||||||
parser.add("num_pci_segments");
|
parser.add("num_pci_segments");
|
||||||
parser.add("iommu_segments");
|
parser.add("iommu_segments");
|
||||||
parser.add("serial_number");
|
parser.add("serial_number");
|
||||||
|
parser.add("uuid");
|
||||||
parser.parse(platform).map_err(Error::ParsePlatform)?;
|
parser.parse(platform).map_err(Error::ParsePlatform)?;
|
||||||
|
|
||||||
let num_pci_segments: u16 = parser
|
let num_pci_segments: u16 = parser
|
||||||
@ -655,10 +658,12 @@ impl PlatformConfig {
|
|||||||
let serial_number = parser
|
let serial_number = parser
|
||||||
.convert("serial_number")
|
.convert("serial_number")
|
||||||
.map_err(Error::ParsePlatform)?;
|
.map_err(Error::ParsePlatform)?;
|
||||||
|
let uuid = parser.convert("uuid").map_err(Error::ParsePlatform)?;
|
||||||
Ok(PlatformConfig {
|
Ok(PlatformConfig {
|
||||||
num_pci_segments,
|
num_pci_segments,
|
||||||
iommu_segments,
|
iommu_segments,
|
||||||
serial_number,
|
serial_number,
|
||||||
|
uuid,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,6 +692,7 @@ impl Default for PlatformConfig {
|
|||||||
num_pci_segments: DEFAULT_NUM_PCI_SEGMENTS,
|
num_pci_segments: DEFAULT_NUM_PCI_SEGMENTS,
|
||||||
iommu_segments: None,
|
iommu_segments: None,
|
||||||
serial_number: None,
|
serial_number: None,
|
||||||
|
uuid: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user