We would happily accept a usb address with a missing port attribute,
then format it back as port='(null)', so the persistent domain
would not be able to start (due to the XML sightseeing tour in
virDomainObjSetDefTransient) or survive daemon restart.
---
src/conf/domain_conf.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 79d15c8..d0684eb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5132,7 +5132,11 @@ virDomainDeviceUSBAddressParseXML(xmlNodePtr node,
memset(addr, 0, sizeof(*addr));
- port = virXMLPropString(node, "port");
+ if (!(port = virXMLPropString(node, "port"))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("USB address must have a port"));
+ goto cleanup;
+ }
bus = virXMLPropString(node, "bus");
if (port && virDomainDeviceUSBAddressParsePort(port) < 0)
--
2.7.3