Note that the wrong "VIR_TRISTATE_*_ABSENT" was used in qemuDomainChangeNet.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/device_conf.h | 4 ++--
src/conf/domain_conf.c | 26 ++++++++++++++++----------
src/qemu/qemu_command.c | 3 ++-
src/qemu/qemu_hotplug.c | 2 +-
4 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index a51bdf10ee..289af1153a 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -153,8 +153,8 @@ struct _virDomainDeviceInfo {
} master;
/* rombar and romfile are only used for pci hostdev and network
* devices. */
- int romenabled; /* enum virTristateBool */
- int rombar; /* enum virTristateSwitch */
+ virTristateBool romenabled;
+ virTristateSwitch rombar;
char *romfile;
/* bootIndex is only used for disk, network interface, hostdev
* and redirdev devices */
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dfdca1891a..67954bb42b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6687,17 +6687,23 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt,
if ((flags & VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) &&
(rom = virXPathNode("./rom", ctxt))) {
- if ((romenabled = virXPathString("string(./rom/@enabled)", ctxt))
&&
- ((info->romenabled = virTristateBoolTypeFromString(romenabled)) <= 0))
{
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown rom enabled value '%s'"),
romenabled);
- goto cleanup;
+ if ((romenabled = virXPathString("string(./rom/@enabled)", ctxt))) {
+ int value;
+ if ((value = virTristateBoolTypeFromString(romenabled)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown rom enabled value '%s'"),
romenabled);
+ goto cleanup;
+ }
+ info->romenabled = value;
}
- if ((rombar = virXPathString("string(./rom/@bar)", ctxt)) &&
- ((info->rombar = virTristateSwitchTypeFromString(rombar)) <= 0)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown rom bar value '%s'"), rombar);
- goto cleanup;
+ if ((rombar = virXPathString("string(./rom/@bar)", ctxt))) {
+ int value;
+ if ((value = virTristateSwitchTypeFromString(rombar)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown rom bar value '%s'"),
rombar);
+ goto cleanup;
+ }
+ info->rombar = value;
}
info->romfile = virXMLPropString(rom, "file");
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7cb07306f3..92ab7eb34a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -685,7 +685,8 @@ qemuBuildRomStr(virBufferPtr buf,
case VIR_TRISTATE_SWITCH_ON:
virBufferAddLit(buf, ",rombar=1");
break;
- default:
+ case VIR_TRISTATE_SWITCH_ABSENT:
+ case VIR_TRISTATE_SWITCH_LAST:
break;
}
if (info->romfile) {
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 58d2abb862..142a4b18e1 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3653,7 +3653,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
/* device alias is checked already in virDomainDefCompatibleDevice */
- if (newdev->info.rombar == VIR_TRISTATE_BOOL_ABSENT)
+ if (newdev->info.rombar == VIR_TRISTATE_SWITCH_ABSENT)
newdev->info.rombar = olddev->info.rombar;
if (olddev->info.rombar != newdev->info.rombar) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
--
2.26.2