virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
xmlNodePtr node,
xmlXPathContextPtr ctxt,
- char *prefix,
unsigned int flags)
{
virDomainNetDefPtr def;
g_autofree char *vhostuser_type = NULL;
g_autofree char *trustGuestRxFilters = NULL;
g_autofree char *vhost_path = NULL;
+ const char *prefix = xmlopt ? xmlopt->config.netPrefix : NULL;
if (!(def = virDomainNetDefNew(xmlopt)))
return NULL;
xmlNodePtr node;
g_autoptr(xmlXPathContext) ctxt = NULL;
g_autofree virDomainDeviceDefPtr dev = NULL;
- char *netprefix;
if (!(xml = virXMLParseStringCtxt(xmlStr, _("(device_definition)"), &ctxt)))
return NULL;
return NULL;
break;
case VIR_DOMAIN_DEVICE_NET:
- netprefix = caps->host.netprefix;
- if (!(dev->data.net = virDomainNetDefParseXML(xmlopt, node, ctxt,
- netprefix, flags)))
+ if (!(dev->data.net = virDomainNetDefParseXML(xmlopt, node, ctxt, flags)))
return NULL;
break;
case VIR_DOMAIN_DEVICE_INPUT:
bool usb_none = false;
bool usb_other = false;
bool usb_master = false;
- char *netprefix = NULL;
g_autofree xmlNodePtr *nodes = NULL;
g_autofree char *tmp = NULL;
goto error;
if (n && VIR_ALLOC_N(def->nets, n) < 0)
goto error;
- netprefix = caps->host.netprefix;
for (i = 0; i < n; i++) {
virDomainNetDefPtr net = virDomainNetDefParseXML(xmlopt,
nodes[i],
ctxt,
- netprefix,
flags);
if (!net)
goto error;
int
virDomainNetDefFormat(virBufferPtr buf,
virDomainNetDefPtr def,
- char *prefix,
+ virDomainXMLOptionPtr xmlopt,
unsigned int flags)
{
virDomainNetType actualType = virDomainNetGetActualType(def);
virDomainHostdevDefPtr hostdef = NULL;
char macstr[VIR_MAC_STRING_BUFLEN];
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ const char *prefix = xmlopt ? xmlopt->config.netPrefix : NULL;
/* publicActual is true if we should report the current state in
* def->data.network.actual *instead of* the config (*not* in
int
virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
virDomainXMLOptionPtr xmlopt,
- virCapsPtr caps,
+ virCapsPtr caps G_GNUC_UNUSED,
virBufferPtr buf,
const char *rootname,
unsigned int flags)
const char *type = NULL;
int n;
size_t i;
- char *netprefix = NULL;
virCheckFlags(VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS |
VIR_DOMAIN_DEF_FORMAT_STATUS |
if (virDomainFSDefFormat(buf, def->fss[n], flags) < 0)
goto error;
- if (caps)
- netprefix = caps->host.netprefix;
for (n = 0; n < def->nnets; n++)
- if (virDomainNetDefFormat(buf, def->nets[n], netprefix, flags) < 0)
+ if (virDomainNetDefFormat(buf, def->nets[n], xmlopt, flags) < 0)
goto error;
for (n = 0; n < def->nsmartcards; n++)
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
int flags = VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_FORMAT_SECURE;
int rc = -1;
- char *netprefix;
g_autofree char *xmlStr = NULL;
switch ((virDomainDeviceType) src->type) {
rc = virDomainFSDefFormat(&buf, src->data.fs, flags);
break;
case VIR_DOMAIN_DEVICE_NET:
- netprefix = caps->host.netprefix;
- rc = virDomainNetDefFormat(&buf, src->data.net, netprefix, flags);
+ rc = virDomainNetDefFormat(&buf, src->data.net, xmlopt, flags);
break;
case VIR_DOMAIN_DEVICE_INPUT:
rc = virDomainInputDefFormat(&buf, src->data.input, flags);