mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
conf: Use virTristateXXX in virDomainDeviceInfo
Note that the wrong "VIR_TRISTATE_*_ABSENT" was used in qemuDomainChangeNet. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
e949edeec8
commit
5cbc83774a
@ -143,8 +143,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 */
|
||||
|
@ -6691,17 +6691,23 @@ virDomainDeviceInfoParseXML(virDomainXMLOption *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");
|
||||
|
||||
|
@ -713,7 +713,8 @@ qemuBuildRomStr(virBuffer *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) {
|
||||
|
@ -3653,7 +3653,7 @@ qemuDomainChangeNet(virQEMUDriver *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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user