On Wed, May 06, 2009 at 06:11:42PM +0200, Pritesh Kothari wrote:
Hi All,
As discussed on the list resending the networking patch's. the patch's are as
below:
[PATCH 1/3]: contains support for "Internal" network in libvirt
ACK
commit 34a1776a7049ad5b5678739d597e441686aa6e7e
Author: pk221555 <pk221555(a)krishna.(none)>
Date: Wed May 6 17:05:32 2009 +0200
libvirt: Added support for "Internal" network in libvirt
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 2f784e1..f1fc8c7 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -586,6 +586,20 @@
<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 dde4020..878cd5e 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -119,7 +119,8 @@ VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST,
"client",
"mcast",
"network",
- "bridge")
+ "bridge",
+ "internal")
VIR_ENUM_IMPL(virDomainChr, VIR_DOMAIN_CHR_TYPE_LAST,
"null",
@@ -310,6 +311,10 @@ void virDomainNetDefFree(virDomainNetDefPtr def)
VIR_FREE(def->data.bridge.script);
VIR_FREE(def->data.bridge.ipaddr);
break;
+
+ case VIR_DOMAIN_NET_TYPE_INTERNAL:
+ VIR_FREE(def->data.internal.name);
+ break;
}
VIR_FREE(def->ifname);
@@ -887,6 +892,7 @@ virDomainNetDefParseXML(virConnectPtr conn,
char *address = NULL;
char *port = NULL;
char *model = NULL;
+ char *internal = NULL;
if (VIR_ALLOC(def) < 0) {
virReportOOMError(conn);
@@ -914,6 +920,10 @@ virDomainNetDefParseXML(virConnectPtr conn,
(def->type == VIR_DOMAIN_NET_TYPE_NETWORK) &&
(xmlStrEqual(cur->name, BAD_CAST "source"))) {
network = virXMLPropString(cur, "network");
+ } 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"))) {
@@ -1029,6 +1039,15 @@ virDomainNetDefParseXML(virConnectPtr conn,
def->data.socket.address = address;
address = NULL;
}
+ 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) {
@@ -1066,6 +1085,7 @@ cleanup:
VIR_FREE(bridge);
VIR_FREE(model);
VIR_FREE(type);
+ VIR_FREE(internal);
return def;
@@ -3047,6 +3067,12 @@ virDomainNetDefFormat(virConnectPtr conn,
else
virBufferVSprintf(buf, " <source
port='%d'/>\n",
def->data.socket.port);
+
+ 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 d4e7442..e79f1d5 100644
--- a/src/domain_conf.h
+++ b/src/domain_conf.h
@@ -138,6 +138,7 @@ enum virDomainNetType {
VIR_DOMAIN_NET_TYPE_MCAST,
VIR_DOMAIN_NET_TYPE_NETWORK,
VIR_DOMAIN_NET_TYPE_BRIDGE,
+ VIR_DOMAIN_NET_TYPE_INTERNAL,
VIR_DOMAIN_NET_TYPE_LAST,
};
@@ -168,6 +169,9 @@ struct _virDomainNetDef {
char *script;
char *ipaddr;
} bridge;
+ struct {
+ char *name;
+ } internal;
} data;
char *ifname;
};
--
Libvir-list mailing list
Libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|