mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Introduce DOMAIN_DEVICE_ITERATE_MISSING_INFO
Rename the DOMAIN_DEVICE_ITERATE_GRAPHICS flag. It was introduced by commit dd45c2710f6fd2d4f8a47f97960532d0e0091e7d with the intention to run the Validate callback even on the graphics device. However, enumerating every single device in virDomainDeviceIterateFlags is unsustainable and what really was special about the graphics device was the lack of DeviceInfo. Rename the flag and iterate over more info-less devices. (and leases) Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f3e777a3c4
commit
b00f32c34d
@ -4074,7 +4074,7 @@ virDomainSkipBackcompatConsole(virDomainDefPtr def,
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
DOMAIN_DEVICE_ITERATE_ALL_CONSOLES = 1 << 0,
|
DOMAIN_DEVICE_ITERATE_ALL_CONSOLES = 1 << 0,
|
||||||
DOMAIN_DEVICE_ITERATE_GRAPHICS = 1 << 1
|
DOMAIN_DEVICE_ITERATE_MISSING_INFO = 1 << 1,
|
||||||
} virDomainDeviceIterateFlags;
|
} virDomainDeviceIterateFlags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4240,15 +4240,26 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the flag below is set, make sure @cb can handle @info being NULL, as
|
/* If the flag below is set, make sure @cb can handle @info being NULL */
|
||||||
* graphics don't have any boot info */
|
if (iteratorFlags & DOMAIN_DEVICE_ITERATE_MISSING_INFO) {
|
||||||
if (iteratorFlags & DOMAIN_DEVICE_ITERATE_GRAPHICS) {
|
|
||||||
device.type = VIR_DOMAIN_DEVICE_GRAPHICS;
|
device.type = VIR_DOMAIN_DEVICE_GRAPHICS;
|
||||||
for (i = 0; i < def->ngraphics; i++) {
|
for (i = 0; i < def->ngraphics; i++) {
|
||||||
device.data.graphics = def->graphics[i];
|
device.data.graphics = def->graphics[i];
|
||||||
if ((rc = cb(def, &device, NULL, opaque)) != 0)
|
if ((rc = cb(def, &device, NULL, opaque)) != 0)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
device.type = VIR_DOMAIN_DEVICE_LEASE;
|
||||||
|
for (i = 0; i < def->nleases; i++) {
|
||||||
|
device.data.lease = def->leases[i];
|
||||||
|
if ((rc = cb(def, &device, NULL, opaque)) != 0)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
device.type = VIR_DOMAIN_DEVICE_IOMMU;
|
||||||
|
if (def->iommu) {
|
||||||
|
device.data.iommu = def->iommu;
|
||||||
|
if ((rc = cb(def, &device, NULL, opaque)) != 0)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Coverity is not very happy with this - all dead_error_condition */
|
/* Coverity is not very happy with this - all dead_error_condition */
|
||||||
@ -6923,7 +6934,7 @@ virDomainDefValidate(virDomainDefPtr def,
|
|||||||
if (virDomainDeviceInfoIterateInternal(def,
|
if (virDomainDeviceInfoIterateInternal(def,
|
||||||
virDomainDefValidateDeviceIterator,
|
virDomainDefValidateDeviceIterator,
|
||||||
(DOMAIN_DEVICE_ITERATE_ALL_CONSOLES |
|
(DOMAIN_DEVICE_ITERATE_ALL_CONSOLES |
|
||||||
DOMAIN_DEVICE_ITERATE_GRAPHICS),
|
DOMAIN_DEVICE_ITERATE_MISSING_INFO),
|
||||||
&data) < 0)
|
&data) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user