diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8a39721acd..9d059044e4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1896,14 +1896,21 @@ int virDomainDevicePCIAddressIsValid(virDomainDevicePCIAddressPtr addr) } -static int +static bool virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info, unsigned int flags) { if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) - return 1; + return true; if (info->alias && !(flags & VIR_DOMAIN_XML_INACTIVE)) - return 1; - return 0; + return true; + if (info->mastertype != VIR_DOMAIN_CONTROLLER_MASTER_NONE) + return true; + if ((info->rombar != VIR_DOMAIN_PCI_ROMBAR_DEFAULT) || + info->romfile) + return true; + if (info->bootIndex) + return true; + return false; } void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0eed60e02a..1b8741e211 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -253,6 +253,10 @@ struct _virDomainDeviceUSBMaster { typedef struct _virDomainDeviceInfo virDomainDeviceInfo; typedef virDomainDeviceInfo *virDomainDeviceInfoPtr; struct _virDomainDeviceInfo { + /* If adding to this struct, ensure that + * virDomainDeviceInfoIsSet() is updated + * to consider the new fields + */ char *alias; int type; union {