mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 13:35:17 +00:00
conf: domain: Remove 'error' label in virDomainNetDefParseXML
The 'error' label was an alias to 'return NULL;'. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4721354f44
commit
1ebbeb29ba
@ -8889,21 +8889,21 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
|
|
||||||
if ((rv = virXMLPropEnum(node, "type", virDomainNetTypeFromString,
|
if ((rv = virXMLPropEnum(node, "type", virDomainNetTypeFromString,
|
||||||
VIR_XML_PROP_NONE, &def->type)) < 0)
|
VIR_XML_PROP_NONE, &def->type)) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (rv == 0)
|
if (rv == 0)
|
||||||
def->type = VIR_DOMAIN_NET_TYPE_USER;
|
def->type = VIR_DOMAIN_NET_TYPE_USER;
|
||||||
|
|
||||||
if (virXMLPropTristateBool(node, "trustGuestRxFilters", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateBool(node, "trustGuestRxFilters", VIR_XML_PROP_NONE,
|
||||||
&def->trustGuestRxFilters) < 0)
|
&def->trustGuestRxFilters) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if ((source_node = virXPathNode("./source", ctxt))) {
|
if ((source_node = virXPathNode("./source", ctxt))) {
|
||||||
xmlNodePtr tmpnode = ctxt->node;
|
xmlNodePtr tmpnode = ctxt->node;
|
||||||
|
|
||||||
ctxt->node = source_node;
|
ctxt->node = source_node;
|
||||||
if (virDomainNetIPInfoParseXML(_("interface host IP"), ctxt, &def->hostIP) < 0)
|
if (virDomainNetIPInfoParseXML(_("interface host IP"), ctxt, &def->hostIP) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
ctxt->node = tmpnode;
|
ctxt->node = tmpnode;
|
||||||
|
|
||||||
if (def->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
|
if (def->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
|
||||||
@ -8947,7 +8947,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
"Use <target dev='%s'/> (for host-side) "
|
"Use <target dev='%s'/> (for host-side) "
|
||||||
"or <guest dev='%s'/> (for guest-side) instead."),
|
"or <guest dev='%s'/> (for guest-side) instead."),
|
||||||
dev, dev, dev);
|
dev, dev, dev);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
|
if (def->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
|
||||||
@ -8955,7 +8955,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
vhostuser_path = virXMLPropString(source_node, "path");
|
vhostuser_path = virXMLPropString(source_node, "path");
|
||||||
vhostuser_mode = virXMLPropString(source_node, "mode");
|
vhostuser_mode = virXMLPropString(source_node, "mode");
|
||||||
if (virDomainChrSourceReconnectDefParseXML(&reconnect, source_node, ctxt) < 0)
|
if (virDomainChrSourceReconnectDefParseXML(&reconnect, source_node, ctxt) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->type == VIR_DOMAIN_NET_TYPE_VDPA)
|
if (def->type == VIR_DOMAIN_NET_TYPE_VDPA)
|
||||||
@ -8985,7 +8985,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
if (!(def->virtPortProfile
|
if (!(def->virtPortProfile
|
||||||
= virNetDevVPortProfileParse(virtualport_node,
|
= virNetDevVPortProfileParse(virtualport_node,
|
||||||
VIR_VPORT_XML_GENERATE_MISSING_DEFAULTS))) {
|
VIR_VPORT_XML_GENERATE_MISSING_DEFAULTS))) {
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else if (def->type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
|
} else if (def->type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
|
||||||
def->type == VIR_DOMAIN_NET_TYPE_DIRECT ||
|
def->type == VIR_DOMAIN_NET_TYPE_DIRECT ||
|
||||||
@ -8994,14 +8994,14 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
= virNetDevVPortProfileParse(virtualport_node, VIR_VPORT_XML_GENERATE_MISSING_DEFAULTS|
|
= virNetDevVPortProfileParse(virtualport_node, VIR_VPORT_XML_GENERATE_MISSING_DEFAULTS|
|
||||||
VIR_VPORT_XML_REQUIRE_ALL_ATTRIBUTES|
|
VIR_VPORT_XML_REQUIRE_ALL_ATTRIBUTES|
|
||||||
VIR_VPORT_XML_REQUIRE_TYPE))) {
|
VIR_VPORT_XML_REQUIRE_TYPE))) {
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("<virtualport> element unsupported for"
|
_("<virtualport> element unsupported for"
|
||||||
" <interface type='%s'>"),
|
" <interface type='%s'>"),
|
||||||
virDomainNetTypeToString(def->type));
|
virDomainNetTypeToString(def->type));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9019,7 +9019,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
|
|
||||||
if ((driver_node = virXPathNode("./driver", ctxt)) &&
|
if ((driver_node = virXPathNode("./driver", ctxt)) &&
|
||||||
(virDomainVirtioOptionsParseXML(driver_node, &def->virtio) < 0))
|
(virDomainVirtioOptionsParseXML(driver_node, &def->virtio) < 0))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if ((filterref_node = virXPathNode("./filterref", ctxt))) {
|
if ((filterref_node = virXPathNode("./filterref", ctxt))) {
|
||||||
filter = virXMLPropString(filterref_node, "filter");
|
filter = virXMLPropString(filterref_node, "filter");
|
||||||
@ -9031,16 +9031,16 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
(actual_node = virXPathNode("./actual", ctxt)) &&
|
(actual_node = virXPathNode("./actual", ctxt)) &&
|
||||||
(virDomainActualNetDefParseXML(actual_node, ctxt, def,
|
(virDomainActualNetDefParseXML(actual_node, ctxt, def,
|
||||||
&actual, flags, xmlopt) < 0))
|
&actual, flags, xmlopt) < 0))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if ((bandwidth_node = virXPathNode("./bandwidth", ctxt)) &&
|
if ((bandwidth_node = virXPathNode("./bandwidth", ctxt)) &&
|
||||||
(virNetDevBandwidthParse(&def->bandwidth, NULL, bandwidth_node,
|
(virNetDevBandwidthParse(&def->bandwidth, NULL, bandwidth_node,
|
||||||
def->type == VIR_DOMAIN_NET_TYPE_NETWORK) < 0))
|
def->type == VIR_DOMAIN_NET_TYPE_NETWORK) < 0))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if ((vlan_node = virXPathNode("./vlan", ctxt)) &&
|
if ((vlan_node = virXPathNode("./vlan", ctxt)) &&
|
||||||
(virNetDevVlanParse(vlan_node, ctxt, &def->vlan) < 0))
|
(virNetDevVlanParse(vlan_node, ctxt, &def->vlan) < 0))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if ((tap = virXPathString("string(./backend/@tap)", ctxt)))
|
if ((tap = virXPathString("string(./backend/@tap)", ctxt)))
|
||||||
def->backend.tap = virFileSanitizePath(tap);
|
def->backend.tap = virFileSanitizePath(tap);
|
||||||
@ -9055,13 +9055,13 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unable to parse mac address '%s'"),
|
_("unable to parse mac address '%s'"),
|
||||||
(const char *)macaddr);
|
(const char *)macaddr);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (virMacAddrIsMulticast(&def->mac)) {
|
if (virMacAddrIsMulticast(&def->mac)) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("expected unicast mac address, found multicast '%s'"),
|
_("expected unicast mac address, found multicast '%s'"),
|
||||||
(const char *)macaddr);
|
(const char *)macaddr);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
virDomainNetGenerateMAC(xmlopt, &def->mac);
|
virDomainNetGenerateMAC(xmlopt, &def->mac);
|
||||||
@ -9072,22 +9072,22 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virDomainNetMacTypeTypeFromString,
|
virDomainNetMacTypeTypeFromString,
|
||||||
VIR_XML_PROP_NONZERO,
|
VIR_XML_PROP_NONZERO,
|
||||||
&def->mac_type) < 0)
|
&def->mac_type) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateBool(mac_node, "check",
|
if (virXMLPropTristateBool(mac_node, "check",
|
||||||
VIR_XML_PROP_NONE,
|
VIR_XML_PROP_NONE,
|
||||||
&def->mac_check) < 0)
|
&def->mac_check) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info,
|
if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info,
|
||||||
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT
|
flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT
|
||||||
| VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) < 0) {
|
| VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) < 0) {
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model != NULL &&
|
if (model != NULL &&
|
||||||
virDomainNetSetModelString(def, model) < 0)
|
virDomainNetSetModelString(def, model) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
switch (def->type) {
|
switch (def->type) {
|
||||||
case VIR_DOMAIN_NET_TYPE_NETWORK:
|
case VIR_DOMAIN_NET_TYPE_NETWORK:
|
||||||
@ -9095,13 +9095,13 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("No <source> 'network' attribute "
|
_("No <source> 'network' attribute "
|
||||||
"specified with <interface type='network'/>"));
|
"specified with <interface type='network'/>"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (portid &&
|
if (portid &&
|
||||||
virUUIDParse(portid, def->data.network.portid) < 0) {
|
virUUIDParse(portid, def->data.network.portid) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unable to parse port id '%s'"), portid);
|
_("Unable to parse port id '%s'"), portid);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
def->data.network.name = g_steal_pointer(&network);
|
def->data.network.name = g_steal_pointer(&network);
|
||||||
@ -9115,7 +9115,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
_("Wrong or no <model> 'type' attribute "
|
_("Wrong or no <model> 'type' attribute "
|
||||||
"specified with <interface type='vhostuser'/>. "
|
"specified with <interface type='vhostuser'/>. "
|
||||||
"vhostuser requires the virtio-net* frontend"));
|
"vhostuser requires the virtio-net* frontend"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STRNEQ_NULLABLE(vhostuser_type, "unix")) {
|
if (STRNEQ_NULLABLE(vhostuser_type, "unix")) {
|
||||||
@ -9129,7 +9129,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
_("No <source> 'type' attribute "
|
_("No <source> 'type' attribute "
|
||||||
"specified for <interface "
|
"specified for <interface "
|
||||||
"type='vhostuser'>"));
|
"type='vhostuser'>"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vhostuser_path == NULL) {
|
if (vhostuser_path == NULL) {
|
||||||
@ -9137,7 +9137,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
_("No <source> 'path' attribute "
|
_("No <source> 'path' attribute "
|
||||||
"specified with <interface "
|
"specified with <interface "
|
||||||
"type='vhostuser'/>"));
|
"type='vhostuser'/>"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vhostuser_mode == NULL) {
|
if (vhostuser_mode == NULL) {
|
||||||
@ -9145,11 +9145,11 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
_("No <source> 'mode' attribute "
|
_("No <source> 'mode' attribute "
|
||||||
"specified with <interface "
|
"specified with <interface "
|
||||||
"type='vhostuser'/>"));
|
"type='vhostuser'/>"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(def->data.vhostuser = virDomainChrSourceDefNew(xmlopt)))
|
if (!(def->data.vhostuser = virDomainChrSourceDefNew(xmlopt)))
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
def->data.vhostuser->type = VIR_DOMAIN_CHR_TYPE_UNIX;
|
def->data.vhostuser->type = VIR_DOMAIN_CHR_TYPE_UNIX;
|
||||||
def->data.vhostuser->data.nix.path = g_steal_pointer(&vhostuser_path);
|
def->data.vhostuser->data.nix.path = g_steal_pointer(&vhostuser_path);
|
||||||
@ -9160,7 +9160,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("'reconnect' attribute unsupported "
|
_("'reconnect' attribute unsupported "
|
||||||
"'server' mode for <interface type='vhostuser'>"));
|
"'server' mode for <interface type='vhostuser'>"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else if (STREQ(vhostuser_mode, "client")) {
|
} else if (STREQ(vhostuser_mode, "client")) {
|
||||||
def->data.vhostuser->data.nix.listen = false;
|
def->data.vhostuser->data.nix.listen = false;
|
||||||
@ -9170,7 +9170,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
_("Wrong <source> 'mode' attribute "
|
_("Wrong <source> 'mode' attribute "
|
||||||
"specified with <interface "
|
"specified with <interface "
|
||||||
"type='vhostuser'/>"));
|
"type='vhostuser'/>"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -9179,7 +9179,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("No <source> 'dev' attribute "
|
_("No <source> 'dev' attribute "
|
||||||
"specified with <interface type='vdpa'/>"));
|
"specified with <interface type='vdpa'/>"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
def->data.vdpa.devicepath = g_steal_pointer(&dev);
|
def->data.vdpa.devicepath = g_steal_pointer(&dev);
|
||||||
break;
|
break;
|
||||||
@ -9189,7 +9189,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("No <source> 'bridge' attribute "
|
_("No <source> 'bridge' attribute "
|
||||||
"specified with <interface type='bridge'/>"));
|
"specified with <interface type='bridge'/>"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
def->data.bridge.brname = g_steal_pointer(&bridge);
|
def->data.bridge.brname = g_steal_pointer(&bridge);
|
||||||
break;
|
break;
|
||||||
@ -9202,13 +9202,13 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("No <source> 'port' attribute "
|
_("No <source> 'port' attribute "
|
||||||
"specified with socket interface"));
|
"specified with socket interface"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (virStrToLong_i(port, NULL, 10, &def->data.socket.port) < 0) {
|
if (virStrToLong_i(port, NULL, 10, &def->data.socket.port) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Cannot parse <source> 'port' attribute "
|
_("Cannot parse <source> 'port' attribute "
|
||||||
"with socket interface"));
|
"with socket interface"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (address == NULL) {
|
if (address == NULL) {
|
||||||
@ -9218,7 +9218,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("No <source> 'address' attribute "
|
_("No <source> 'address' attribute "
|
||||||
"specified with socket interface"));
|
"specified with socket interface"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
def->data.socket.address = g_steal_pointer(&address);
|
def->data.socket.address = g_steal_pointer(&address);
|
||||||
@ -9231,20 +9231,20 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("No <local> 'port' attribute "
|
_("No <local> 'port' attribute "
|
||||||
"specified with socket interface"));
|
"specified with socket interface"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (virStrToLong_i(localport, NULL, 10, &def->data.socket.localport) < 0) {
|
if (virStrToLong_i(localport, NULL, 10, &def->data.socket.localport) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Cannot parse <local> 'port' attribute "
|
_("Cannot parse <local> 'port' attribute "
|
||||||
"with socket interface"));
|
"with socket interface"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localaddr == NULL) {
|
if (localaddr == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("No <local> 'address' attribute "
|
_("No <local> 'address' attribute "
|
||||||
"specified with socket interface"));
|
"specified with socket interface"));
|
||||||
goto error;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
def->data.socket.localaddr = g_steal_pointer(&localaddr);
|
def->data.socket.localaddr = g_steal_pointer(&localaddr);
|
||||||
}
|
}
|
||||||
@ -9255,7 +9255,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("No <source> 'name' attribute specified "
|
_("No <source> 'name' attribute specified "
|
||||||
"with <interface type='internal'/>"));
|
"with <interface type='internal'/>"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
def->data.internal.name = g_steal_pointer(&internal);
|
def->data.internal.name = g_steal_pointer(&internal);
|
||||||
break;
|
break;
|
||||||
@ -9265,14 +9265,14 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("No <source> 'dev' attribute specified "
|
_("No <source> 'dev' attribute specified "
|
||||||
"with <interface type='direct'/>"));
|
"with <interface type='direct'/>"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode != NULL) {
|
if (mode != NULL) {
|
||||||
if ((val = virNetDevMacVLanModeTypeFromString(mode)) < 0) {
|
if ((val = virNetDevMacVLanModeTypeFromString(mode)) < 0) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Unknown mode has been specified"));
|
_("Unknown mode has been specified"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
def->data.direct.mode = val;
|
def->data.direct.mode = val;
|
||||||
} else {
|
} else {
|
||||||
@ -9297,7 +9297,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
hostdev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
hostdev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
||||||
if (virDomainHostdevDefParseXMLSubsys(node, ctxt, addrtype,
|
if (virDomainHostdevDefParseXMLSubsys(node, ctxt, addrtype,
|
||||||
hostdev, flags, xmlopt) < 0) {
|
hostdev, flags, xmlopt) < 0) {
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -9306,46 +9306,46 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Missing source switchid for interface type '%s'"),
|
_("Missing source switchid for interface type '%s'"),
|
||||||
virDomainNetTypeToString(def->type));
|
virDomainNetTypeToString(def->type));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!portid) {
|
if (!portid) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Missing source portid for interface type '%s'"),
|
_("Missing source portid for interface type '%s'"),
|
||||||
virDomainNetTypeToString(def->type));
|
virDomainNetTypeToString(def->type));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!connectionid) {
|
if (!connectionid) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Missing source connectionid for interface type '%s'"),
|
_("Missing source connectionid for interface type '%s'"),
|
||||||
virDomainNetTypeToString(def->type));
|
virDomainNetTypeToString(def->type));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!portgroup) {
|
if (!portgroup) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Missing source portgroup for interface type '%s'"),
|
_("Missing source portgroup for interface type '%s'"),
|
||||||
virDomainNetTypeToString(def->type));
|
virDomainNetTypeToString(def->type));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virUUIDParse(switchid, def->data.vds.switch_id) < 0) {
|
if (virUUIDParse(switchid, def->data.vds.switch_id) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unable to parse switchid '%s'"), switchid);
|
_("Unable to parse switchid '%s'"), switchid);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStrToLong_ll(portid, NULL, 0, &def->data.vds.port_id) < 0) {
|
if (virStrToLong_ll(portid, NULL, 0, &def->data.vds.port_id) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unable to parse portid '%s'"), portid);
|
_("Unable to parse portid '%s'"), portid);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStrToLong_ll(connectionid, NULL, 0, &def->data.vds.connection_id) < 0) {
|
if (virStrToLong_ll(connectionid, NULL, 0, &def->data.vds.connection_id) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unable to parse connectionid '%s'"), connectionid);
|
_("Unable to parse connectionid '%s'"), connectionid);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
def->data.vds.portgroup_id = g_steal_pointer(&portgroup);
|
def->data.vds.portgroup_id = g_steal_pointer(&portgroup);
|
||||||
@ -9361,7 +9361,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
|
|
||||||
if (virDomainNetIPInfoParseXML(_("guest interface"),
|
if (virDomainNetIPInfoParseXML(_("guest interface"),
|
||||||
ctxt, &def->guestIP) < 0)
|
ctxt, &def->guestIP) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (managed_tap) {
|
if (managed_tap) {
|
||||||
bool state = false;
|
bool state = false;
|
||||||
@ -9369,7 +9369,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("invalid 'managed' value '%s'"),
|
_("invalid 'managed' value '%s'"),
|
||||||
managed_tap);
|
managed_tap);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
def->managed_tap = virTristateBoolFromBool(state);
|
def->managed_tap = virTristateBoolFromBool(state);
|
||||||
}
|
}
|
||||||
@ -9404,28 +9404,28 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virDomainNetBackendTypeFromString,
|
virDomainNetBackendTypeFromString,
|
||||||
VIR_XML_PROP_NONZERO,
|
VIR_XML_PROP_NONZERO,
|
||||||
&def->driver.virtio.name) < 0)
|
&def->driver.virtio.name) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropEnum(driver_node, "txmode",
|
if (virXMLPropEnum(driver_node, "txmode",
|
||||||
virDomainNetVirtioTxModeTypeFromString,
|
virDomainNetVirtioTxModeTypeFromString,
|
||||||
VIR_XML_PROP_NONZERO,
|
VIR_XML_PROP_NONZERO,
|
||||||
&def->driver.virtio.txmode) < 0)
|
&def->driver.virtio.txmode) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(driver_node, "ioeventfd",
|
if (virXMLPropTristateSwitch(driver_node, "ioeventfd",
|
||||||
VIR_XML_PROP_NONE,
|
VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.ioeventfd) < 0)
|
&def->driver.virtio.ioeventfd) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(driver_node, "event_idx",
|
if (virXMLPropTristateSwitch(driver_node, "event_idx",
|
||||||
VIR_XML_PROP_NONE,
|
VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.event_idx) < 0)
|
&def->driver.virtio.event_idx) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropUInt(driver_node, "queues", 10,
|
if (virXMLPropUInt(driver_node, "queues", 10,
|
||||||
VIR_XML_PROP_NONE,
|
VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.queues) < 0)
|
&def->driver.virtio.queues) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
/* There's always at least one TX/RX queue. */
|
/* There's always at least one TX/RX queue. */
|
||||||
if (def->driver.virtio.queues == 1)
|
if (def->driver.virtio.queues == 1)
|
||||||
@ -9434,74 +9434,74 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
if (virXMLPropUInt(driver_node, "rx_queue_size", 10,
|
if (virXMLPropUInt(driver_node, "rx_queue_size", 10,
|
||||||
VIR_XML_PROP_NONE,
|
VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.rx_queue_size) < 0)
|
&def->driver.virtio.rx_queue_size) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropUInt(driver_node, "tx_queue_size", 10,
|
if (virXMLPropUInt(driver_node, "tx_queue_size", 10,
|
||||||
VIR_XML_PROP_NONE,
|
VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.tx_queue_size) < 0)
|
&def->driver.virtio.tx_queue_size) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(driver_node, "rss",
|
if (virXMLPropTristateSwitch(driver_node, "rss",
|
||||||
VIR_XML_PROP_NONE,
|
VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.rss) < 0)
|
&def->driver.virtio.rss) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(driver_node, "rss_hash_report",
|
if (virXMLPropTristateSwitch(driver_node, "rss_hash_report",
|
||||||
VIR_XML_PROP_NONE,
|
VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.rss_hash_report) < 0)
|
&def->driver.virtio.rss_hash_report) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if ((tmpNode = virXPathNode("./driver/host", ctxt))) {
|
if ((tmpNode = virXPathNode("./driver/host", ctxt))) {
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "csum", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "csum", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.host.csum) < 0)
|
&def->driver.virtio.host.csum) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "gso", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "gso", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.host.gso) < 0)
|
&def->driver.virtio.host.gso) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "tso4", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "tso4", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.host.tso4) < 0)
|
&def->driver.virtio.host.tso4) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "tso6", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "tso6", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.host.tso6) < 0)
|
&def->driver.virtio.host.tso6) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "ecn", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "ecn", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.host.ecn) < 0)
|
&def->driver.virtio.host.ecn) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "ufo", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "ufo", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.host.ufo) < 0)
|
&def->driver.virtio.host.ufo) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "mrg_rxbuf",
|
if (virXMLPropTristateSwitch(tmpNode, "mrg_rxbuf",
|
||||||
VIR_XML_PROP_NONE,
|
VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.host.mrg_rxbuf) < 0)
|
&def->driver.virtio.host.mrg_rxbuf) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tmpNode = virXPathNode("./driver/guest", ctxt))) {
|
if ((tmpNode = virXPathNode("./driver/guest", ctxt))) {
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "csum", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "csum", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.guest.csum) < 0)
|
&def->driver.virtio.guest.csum) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "tso4", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "tso4", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.guest.tso4) < 0)
|
&def->driver.virtio.guest.tso4) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "tso6", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "tso6", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.guest.tso6) < 0)
|
&def->driver.virtio.guest.tso6) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "ecn", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "ecn", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.guest.ecn) < 0)
|
&def->driver.virtio.guest.ecn) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
if (virXMLPropTristateSwitch(tmpNode, "ufo", VIR_XML_PROP_NONE,
|
if (virXMLPropTristateSwitch(tmpNode, "ufo", VIR_XML_PROP_NONE,
|
||||||
&def->driver.virtio.guest.ufo) < 0)
|
&def->driver.virtio.guest.ufo) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
def->backend.vhost = g_steal_pointer(&vhost_path);
|
def->backend.vhost = g_steal_pointer(&vhost_path);
|
||||||
}
|
}
|
||||||
@ -9512,7 +9512,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("unknown interface link state '%s'"),
|
_("unknown interface link state '%s'"),
|
||||||
linkstate);
|
linkstate);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9540,12 +9540,12 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
case VIR_DOMAIN_NET_TYPE_LAST:
|
case VIR_DOMAIN_NET_TYPE_LAST:
|
||||||
default:
|
default:
|
||||||
virReportEnumRangeError(virDomainNetType, def->type);
|
virReportEnumRangeError(virDomainNetType, def->type);
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainNetTeamingInfoParseXML(ctxt, &def->teaming) < 0)
|
if (virDomainNetTeamingInfoParseXML(ctxt, &def->teaming) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
rv = virXPathULong("string(./tune/sndbuf)", ctxt, &def->tune.sndbuf);
|
rv = virXPathULong("string(./tune/sndbuf)", ctxt, &def->tune.sndbuf);
|
||||||
if (rv >= 0) {
|
if (rv >= 0) {
|
||||||
@ -9553,28 +9553,25 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
} else if (rv == -2) {
|
} else if (rv == -2) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("sndbuf must be a positive integer"));
|
_("sndbuf must be a positive integer"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virXPathUInt("string(./mtu/@size)", ctxt, &def->mtu) < -1) {
|
if (virXPathUInt("string(./mtu/@size)", ctxt, &def->mtu) < -1) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("malformed mtu size"));
|
_("malformed mtu size"));
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = virXPathNode("./coalesce", ctxt);
|
node = virXPathNode("./coalesce", ctxt);
|
||||||
if (node) {
|
if (node) {
|
||||||
if (virDomainNetDefCoalesceParseXML(node, ctxt, &def->coalesce) < 0)
|
if (virDomainNetDefCoalesceParseXML(node, ctxt, &def->coalesce) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virNetworkPortOptionsParseXML(ctxt, &def->isolatedPort) < 0)
|
if (virNetworkPortOptionsParseXML(ctxt, &def->isolatedPort) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
return g_steal_pointer(&def);
|
return g_steal_pointer(&def);
|
||||||
|
|
||||||
error:
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user