From: Marek Marczykowski Date: Fri, 20 Feb 2015 03:22:05 +0000 (+0100) Subject: conf: support backend domain name in disk and network devices X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=c374353ca09bf94f55ea9c75466f24f84214c175;p=libvirt.git conf: support backend domain name in disk and network devices At least Xen supports backend drivers in another domain (aka "driver domain"). This patch introduces an XML config option for specifying the backend domain name for and devices. E.g. ... ... In the future, same option will be needed for USB devices (hostdev objects), but for now libxl doesn't have support for PVUSB. Signed-off-by: Marek Marczykowski-Górecki --- diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index f6477c28d4..fb0a0d14c9 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2372,6 +2372,12 @@ +
backenddomain
+
The optional backenddomain element allows specifying a + backend domain (aka driver domain) hosting the disk. Use the + name attribute to specify the backend domain name. + Since 1.2.13 (Xen only) +
boot
Specifies that the disk is bootable. The order attribute determines the order in which devices will be tried during @@ -4256,6 +4262,29 @@ qemu-kvm -net nic,model=? /dev/null network device. Since 0.9.10 (QEMU and KVM only).

+
Setting up a network backend in a driver domain
+
+  ...
+  <devices>
+    ...
+    <interface type='bridge'>
+      <source bridge='br0'/>
+      <backenddomain name='netvm'/>
+    </interface>
+    ...
+  </devices>
+  ...
+ +

+ The optional backenddomain element allows specifying a + backend domain (aka driver domain) for the interface. Use the + name attribute to specify the backend domain name. You + can use it to create a direct network link between domains (so data + will not go through host system). Use with type 'ethernet' to create + plain network link, or with type 'bridge' to connect to a bridge inside + the backend domain. + Since 1.2.13 (Xen only) +

Quality of service
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 27a24b46ba..f41ca43434 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1173,6 +1173,14 @@ + + + + + + + + @@ -2371,6 +2379,14 @@ + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b155a5a34c..d95dd3ebd5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1267,6 +1267,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def) VIR_FREE(def->wwn); VIR_FREE(def->vendor); VIR_FREE(def->product); + VIR_FREE(def->domain_name); virDomainDeviceInfoClear(&def->info); VIR_FREE(def); @@ -1449,6 +1450,7 @@ void virDomainNetDefFree(virDomainNetDefPtr def) VIR_FREE(def->backend.vhost); VIR_FREE(def->virtPortProfile); VIR_FREE(def->script); + VIR_FREE(def->domain_name); VIR_FREE(def->ifname); VIR_FREE(def->ifname_guest); VIR_FREE(def->ifname_guest_actual); @@ -5887,6 +5889,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, char *discard = NULL; char *mirrorFormat = NULL; char *mirrorType = NULL; + char *domain_name = NULL; int expected_secret_usage = -1; int auth_secret_usage = -1; int ret = 0; @@ -5952,6 +5955,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, if (target && STRPREFIX(target, "ioemu:")) memmove(target, target+6, strlen(target)-5); + } else if (!domain_name && + xmlStrEqual(cur->name, BAD_CAST "backenddomain")) { + domain_name = virXMLPropString(cur, "name"); } else if (xmlStrEqual(cur->name, BAD_CAST "geometry")) { if (virXPathUInt("string(./geometry/@cyls)", ctxt, &def->geometry.cylinders) < 0) { @@ -6676,6 +6682,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, driverName = NULL; def->src->encryption = encryption; encryption = NULL; + def->domain_name = domain_name; + domain_name = NULL; def->serial = serial; serial = NULL; def->wwn = wwn; @@ -6738,6 +6746,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_FREE(product); VIR_FREE(mirrorType); VIR_FREE(mirrorFormat); + VIR_FREE(domain_name); ctxt->node = save_ctxt; return def; @@ -7527,6 +7536,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, char *mode = NULL; char *linkstate = NULL; char *addrtype = NULL; + char *domain_name = NULL; char *vhostuser_mode = NULL; char *vhostuser_path = NULL; char *vhostuser_type = NULL; @@ -7666,6 +7676,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, } else if (!script && xmlStrEqual(cur->name, BAD_CAST "script")) { script = virXMLPropString(cur, "path"); + } else if (!domain_name && + xmlStrEqual(cur->name, BAD_CAST "backenddomain")) { + domain_name = virXMLPropString(cur, "name"); } else if (xmlStrEqual(cur->name, BAD_CAST "model")) { model = virXMLPropString(cur, "type"); } else if (xmlStrEqual(cur->name, BAD_CAST "driver")) { @@ -7965,6 +7978,10 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, def->script = script; script = NULL; } + if (domain_name != NULL) { + def->domain_name = domain_name; + domain_name = NULL; + } if (ifname != NULL) { def->ifname = ifname; ifname = NULL; @@ -8234,6 +8251,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_FREE(mode); VIR_FREE(linkstate); VIR_FREE(addrtype); + VIR_FREE(domain_name); VIR_FREE(trustGuestRxFilters); VIR_FREE(ips); VIR_FREE(vhost_path); @@ -17162,6 +17180,8 @@ virDomainDiskDefFormat(virBufferPtr buf, def->src->backingStoreRaw, 1) < 0) return -1; + virBufferEscapeString(buf, "\n", def->domain_name); + virDomainDiskGeometryDefFormat(buf, def); virDomainDiskBlockIoDefFormat(buf, def); @@ -18136,6 +18156,7 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferEscapeString(buf, "