From: Kirill Shchetiniuk <kshch...@redhat.com> Refactored the virDomainHostdevSubsysMediatedDevDefParseXML function to use virXMLPropUUID fuction instead of getting a string and parsing it later.
Due to parsing function change the missing uuid error reporter and message were changed and changed error message was also reflected in tests' outputs. Signed-off-by: Kirill Shchetiniuk <kshch...@redhat.com> --- src/conf/domain_conf.c | 13 +------------ ...stdev-mdev-src-address-invalid.x86_64-latest.err | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1e24e41a48..bfc62b6270 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6348,7 +6348,6 @@ virDomainHostdevSubsysMediatedDevDefParseXML(virDomainHostdevDef *def, unsigned char uuid[VIR_UUID_BUFLEN] = {0}; xmlNodePtr node = NULL; virDomainHostdevSubsysMediatedDev *mdevsrc = &def->source.subsys.u.mdev; - g_autofree char *uuidxml = NULL; if (!(node = virXPathNode("./source/address", ctxt))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -6356,18 +6355,8 @@ virDomainHostdevSubsysMediatedDevDefParseXML(virDomainHostdevDef *def, return -1; } - if (!(uuidxml = virXMLPropString(node, "uuid"))) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Missing 'uuid' attribute for element <address>")); - return -1; - } - - if (virUUIDParse(uuidxml, uuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", - _("Cannot parse uuid attribute of element <address>")); + if (virXMLPropUUID(node, "uuid", VIR_XML_PROP_REQUIRED, uuid) < 0) return -1; - } virUUIDFormat(uuid, mdevsrc->uuidstr); return 0; diff --git a/tests/qemuxmlconfdata/hostdev-mdev-src-address-invalid.x86_64-latest.err b/tests/qemuxmlconfdata/hostdev-mdev-src-address-invalid.x86_64-latest.err index 20a91e7fa6..29dfbfb1ce 100644 --- a/tests/qemuxmlconfdata/hostdev-mdev-src-address-invalid.x86_64-latest.err +++ b/tests/qemuxmlconfdata/hostdev-mdev-src-address-invalid.x86_64-latest.err @@ -1 +1 @@ -unsupported configuration: Missing 'uuid' attribute for element <address> +XML error: Missing required attribute 'uuid' in element 'address' -- 2.49.0