Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 16 +++++++++-------
src/conf/domain_conf.h | 2 +-
src/qemu/qemu_domain_address.c | 2 +-
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4ed7c0ef83..33e79b20e6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9722,13 +9722,15 @@ virDomainControllerDefParseXML(virDomainXMLOption *xmlopt,
/* Other controller models don't require extra checks */
break;
}
- if (modelName &&
- (def->opts.pciopts.modelName
- = virDomainControllerPCIModelNameTypeFromString(modelName)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unknown PCI controller model name
'%s'"),
- modelName);
- return NULL;
+ if (modelName) {
+ int value;
+ if ((value = virDomainControllerPCIModelNameTypeFromString(modelName)) <=
0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unknown PCI controller model name
'%s'"),
+ modelName);
+ return NULL;
+ }
+ def->opts.pciopts.modelName = value;
}
if (chassisNr) {
if (virStrToLong_i(chassisNr, NULL, 0,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index d4344a7158..336b76aa5c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -724,7 +724,7 @@ struct _virDomainPCIControllerOpts {
* <model name='ioh3420''/>
* ...
*/
- int modelName; /* the exact name of the device in hypervisor */
+ virDomainControllerPCIModelName modelName;
/* the following items are attributes of the "target" subelement
* of controller type='pci'. They are bits of configuration that
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 1ee75b8f2e..a73f30ddcb 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -2456,7 +2456,7 @@ qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDef
*cont,
virDomainDef *def,
virQEMUCaps *qemuCaps)
{
- int *modelName = &cont->opts.pciopts.modelName;
+ virDomainControllerPCIModelName *modelName = &cont->opts.pciopts.modelName;
/* make sure it's not already set */
if (*modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE)
--
2.26.3