mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
Support for 'internal' network
* src/domain_conf.[ch] docs/schemas/domain.rng: add support for internal network in the generic part of the code, and update the Relax-NG grammar accordingly, patch by Pritesh Kothari daniel
This commit is contained in:
parent
b81c7c0892
commit
070c1c82b0
@ -1,3 +1,9 @@
|
||||
Mon May 11 11:47:51 CEST 2009 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/domain_conf.[ch] docs/schemas/domain.rng: add support
|
||||
for internal network in the generic part of the code, and
|
||||
update the Relax-NG grammar accordingly, patch by Pritesh Kothari
|
||||
|
||||
Fri May 8 11:24:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/cgroup.c: Create cgroups mode 755, not 655 (Ryota Ozaki)
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
@ -889,6 +894,7 @@ virDomainNetDefParseXML(virConnectPtr conn,
|
||||
char *address = NULL;
|
||||
char *port = NULL;
|
||||
char *model = NULL;
|
||||
char *internal = NULL;
|
||||
|
||||
if (VIR_ALLOC(def) < 0) {
|
||||
virReportOOMError(conn);
|
||||
@ -916,6 +922,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"))) {
|
||||
@ -1031,6 +1041,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) {
|
||||
@ -1068,6 +1087,7 @@ cleanup:
|
||||
VIR_FREE(bridge);
|
||||
VIR_FREE(model);
|
||||
VIR_FREE(type);
|
||||
VIR_FREE(internal);
|
||||
|
||||
return def;
|
||||
|
||||
@ -3051,6 +3071,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)
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user