A counterpart to virDomainDeviceInfoIterate that will iterate over all devices, not just those with an info.
Use it in places where we intend to process all devices with callbacks that do not depend on DeviceInfo being present: * virDomainDefPostParse * virDomainDefValidate Signed-off-by: Ján Tomko <jto...@redhat.com> --- src/conf/domain_conf.c | 28 +++++++++++++++++++--------- src/conf/domain_conf.h | 3 +++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a3a514136b..fb1256f640 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4297,6 +4297,19 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def, } +int +virDomainDeviceIterate(virDomainDefPtr def, + virDomainDeviceInfoCallback cb, + void *opaque) +{ + return virDomainDeviceInfoIterateInternal(def, + cb, + DOMAIN_DEVICE_ITERATE_ALL_CONSOLES | + DOMAIN_DEVICE_ITERATE_GRAPHICS, + opaque); +} + + int virDomainDeviceInfoIterate(virDomainDefPtr def, virDomainDeviceInfoCallback cb, @@ -5793,10 +5806,9 @@ virDomainDefPostParse(virDomainDefPtr def, } /* iterate the devices */ - ret = virDomainDeviceInfoIterateInternal(def, - virDomainDefPostParseDeviceIterator, - DOMAIN_DEVICE_ITERATE_ALL_CONSOLES, - &data); + ret = virDomainDeviceIterate(def, + virDomainDefPostParseDeviceIterator, + &data); if (virDomainDefPostParseCheckFailure(def, parseFlags, ret) < 0) goto cleanup; @@ -6923,11 +6935,9 @@ virDomainDefValidate(virDomainDefPtr def, return -1; /* iterate the devices */ - if (virDomainDeviceInfoIterateInternal(def, - virDomainDefValidateDeviceIterator, - (DOMAIN_DEVICE_ITERATE_ALL_CONSOLES | - DOMAIN_DEVICE_ITERATE_GRAPHICS), - &data) < 0) + if (virDomainDeviceIterate(def, + virDomainDefValidateDeviceIterator, + &data) < 0) return -1; if (virDomainDefValidateInternal(def, xmlopt) < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index fa0756b634..15ecdac6f7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2869,6 +2869,9 @@ typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def, virDomainDeviceInfoPtr info, void *opaque); +int virDomainDeviceIterate(virDomainDefPtr def, + virDomainDeviceInfoCallback cb, + void *opaque); int virDomainDeviceInfoIterate(virDomainDefPtr def, virDomainDeviceInfoCallback cb, void *opaque); -- 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list