mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Ensure uniqueness of generated identifiers
The device identifiers generated from the DeviceManager were not guaranteed to be unique since they were not taking the list of identifiers provided through the configuration. By returning the list of unique identifiers from the configuration, and by providing it to the DeviceManager, the generation of new identifiers can rely both on the DeviceTree and the list of IDs from the configuration. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
+4
-2
@@ -2329,7 +2329,9 @@ pub struct VmConfig {
|
||||
|
||||
impl VmConfig {
|
||||
// Also enables virtio-iommu if the config needs it
|
||||
pub fn validate(&mut self) -> ValidationResult<()> {
|
||||
// Returns the list of unique identifiers provided through the
|
||||
// configuration.
|
||||
pub fn validate(&mut self) -> ValidationResult<BTreeSet<String>> {
|
||||
let mut id_list = BTreeSet::new();
|
||||
|
||||
#[cfg(not(feature = "tdx"))]
|
||||
@@ -2578,7 +2580,7 @@ impl VmConfig {
|
||||
.map(|p| p.iommu_segments.is_some())
|
||||
.unwrap_or_default();
|
||||
|
||||
Ok(())
|
||||
Ok(id_list)
|
||||
}
|
||||
|
||||
pub fn parse(vm_params: VmParams) -> Result<Self> {
|
||||
|
||||
Reference in New Issue
Block a user