Hi All, I have attached a patch which when applied on the HEAD as of today would allow virtualbox support in libvirt. It takes cares of all the stuff mentioned on the list earlier. Still if I have missed anything, please do tell me. The patches are organized as below: Patch 0/4: contains sample xml file Patch 1/4: contains diff of files already in libvirt. Patch 2/4: contains new files needed for VirtualBox support. Patch 3/4: contains support for host only and internal network. Patch 4/4: contains support for rdp in libvirt as mentioned by danpb (also had sent it separately earlier) Regards, Pritesh
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index 309dcae..ef0f276 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -586,6 +586,34 @@ <ref name="interface-options"/> </interleave> </group> + <group> + <attribute name="type"> + <value>hostonly</value> + </attribute> + <interleave> + <element name="source"> + <attribute name="name"> + <ref name="deviceName"/> + </attribute> + <empty/> + </element> + <ref name="interface-options"/> + </interleave> + </group> + <group> + <attribute name="type"> + <value>internal</value> + </attribute> + <interleave> + <element name="source"> + <attribute name="name"> + <ref name="deviceName"/> + </attribute> + <empty/> + </element> + <ref name="interface-options"/> + </interleave> + </group> </choice> </element> </define> diff --git a/src/domain_conf.c b/src/domain_conf.c index b160edd..063c776 100644 --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -119,7 +119,9 @@ VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST, "client", "mcast", "network", - "bridge") + "bridge", + "hostonly", + "internal") VIR_ENUM_IMPL(virDomainChr, VIR_DOMAIN_CHR_TYPE_LAST, "null", @@ -316,6 +318,14 @@ void virDomainNetDefFree(virDomainNetDefPtr def) VIR_FREE(def->data.bridge.script); VIR_FREE(def->data.bridge.ipaddr); break; + + case VIR_DOMAIN_NET_TYPE_HOSTONLY: + VIR_FREE(def->data.hostonly.name); + break; + + case VIR_DOMAIN_NET_TYPE_INTERNAL: + VIR_FREE(def->data.internal.name); + break; } VIR_FREE(def->ifname); @@ -893,6 +903,8 @@ virDomainNetDefParseXML(virConnectPtr conn, char *address = NULL; char *port = NULL; char *model = NULL; + char *hostonly = NULL; + char *internal = NULL; if (VIR_ALLOC(def) < 0) { virReportOOMError(conn); @@ -920,6 +932,14 @@ virDomainNetDefParseXML(virConnectPtr conn, (def->type == VIR_DOMAIN_NET_TYPE_NETWORK) && (xmlStrEqual(cur->name, BAD_CAST "source"))) { network = virXMLPropString(cur, "network"); + } else if ((hostonly == NULL) && + (def->type == VIR_DOMAIN_NET_TYPE_HOSTONLY) && + (xmlStrEqual(cur->name, BAD_CAST "source"))) { + hostonly = virXMLPropString(cur, "name"); + } else if ((internal == NULL) && + (def->type == VIR_DOMAIN_NET_TYPE_INTERNAL) && + (xmlStrEqual(cur->name, BAD_CAST "source"))) { + internal = virXMLPropString(cur, "name"); } else if ((network == NULL) && (def->type == VIR_DOMAIN_NET_TYPE_BRIDGE) && (xmlStrEqual(cur->name, BAD_CAST "source"))) { @@ -1035,6 +1055,24 @@ virDomainNetDefParseXML(virConnectPtr conn, def->data.socket.address = address; address = NULL; } + case VIR_DOMAIN_NET_TYPE_HOSTONLY: + if (hostonly == NULL) { + virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s", + "No <source> 'name' attribute specified with <interface type='hostonly'/>"); + goto error; + } + def->data.hostonly.name = hostonly; + hostonly = NULL; + break; + case VIR_DOMAIN_NET_TYPE_INTERNAL: + if (internal == NULL) { + virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s", + "No <source> 'name' attribute specified with <interface type='internal'/>"); + goto error; + } + def->data.internal.name = internal; + internal = NULL; + break; } if (ifname != NULL) { @@ -1072,6 +1110,8 @@ cleanup: VIR_FREE(bridge); VIR_FREE(model); VIR_FREE(type); + VIR_FREE(hostonly); + VIR_FREE(internal); return def; @@ -3116,6 +3156,17 @@ virDomainNetDefFormat(virConnectPtr conn, else virBufferVSprintf(buf, " <source port='%d'/>\n", def->data.socket.port); + + case VIR_DOMAIN_NET_TYPE_HOSTONLY: + virBufferEscapeString(buf, " <source name='%s'/>\n", + def->data.hostonly.name); + break; + + case VIR_DOMAIN_NET_TYPE_INTERNAL: + virBufferEscapeString(buf, " <source name='%s'/>\n", + def->data.internal.name); + break; + } if (def->ifname) diff --git a/src/domain_conf.h b/src/domain_conf.h index a52c059..6c49bda 100644 --- a/src/domain_conf.h +++ b/src/domain_conf.h @@ -138,6 +138,8 @@ enum virDomainNetType { VIR_DOMAIN_NET_TYPE_MCAST, VIR_DOMAIN_NET_TYPE_NETWORK, VIR_DOMAIN_NET_TYPE_BRIDGE, + VIR_DOMAIN_NET_TYPE_HOSTONLY, + VIR_DOMAIN_NET_TYPE_INTERNAL, VIR_DOMAIN_NET_TYPE_LAST, }; @@ -168,6 +170,12 @@ struct _virDomainNetDef { char *script; char *ipaddr; } bridge; + struct { + char *name; + } hostonly; + struct { + char *name; + } internal; } data; char *ifname; };
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list