mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +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>
|
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)
|
* src/cgroup.c: Create cgroups mode 755, not 655 (Ryota Ozaki)
|
||||||
|
@ -586,6 +586,20 @@
|
|||||||
<ref name="interface-options"/>
|
<ref name="interface-options"/>
|
||||||
</interleave>
|
</interleave>
|
||||||
</group>
|
</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>
|
</choice>
|
||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
@ -119,7 +119,8 @@ VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST,
|
|||||||
"client",
|
"client",
|
||||||
"mcast",
|
"mcast",
|
||||||
"network",
|
"network",
|
||||||
"bridge")
|
"bridge",
|
||||||
|
"internal")
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainChr, VIR_DOMAIN_CHR_TYPE_LAST,
|
VIR_ENUM_IMPL(virDomainChr, VIR_DOMAIN_CHR_TYPE_LAST,
|
||||||
"null",
|
"null",
|
||||||
@ -310,6 +311,10 @@ void virDomainNetDefFree(virDomainNetDefPtr def)
|
|||||||
VIR_FREE(def->data.bridge.script);
|
VIR_FREE(def->data.bridge.script);
|
||||||
VIR_FREE(def->data.bridge.ipaddr);
|
VIR_FREE(def->data.bridge.ipaddr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_NET_TYPE_INTERNAL:
|
||||||
|
VIR_FREE(def->data.internal.name);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(def->ifname);
|
VIR_FREE(def->ifname);
|
||||||
@ -889,6 +894,7 @@ virDomainNetDefParseXML(virConnectPtr conn,
|
|||||||
char *address = NULL;
|
char *address = NULL;
|
||||||
char *port = NULL;
|
char *port = NULL;
|
||||||
char *model = NULL;
|
char *model = NULL;
|
||||||
|
char *internal = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0) {
|
if (VIR_ALLOC(def) < 0) {
|
||||||
virReportOOMError(conn);
|
virReportOOMError(conn);
|
||||||
@ -916,6 +922,10 @@ virDomainNetDefParseXML(virConnectPtr conn,
|
|||||||
(def->type == VIR_DOMAIN_NET_TYPE_NETWORK) &&
|
(def->type == VIR_DOMAIN_NET_TYPE_NETWORK) &&
|
||||||
(xmlStrEqual(cur->name, BAD_CAST "source"))) {
|
(xmlStrEqual(cur->name, BAD_CAST "source"))) {
|
||||||
network = virXMLPropString(cur, "network");
|
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) &&
|
} else if ((network == NULL) &&
|
||||||
(def->type == VIR_DOMAIN_NET_TYPE_BRIDGE) &&
|
(def->type == VIR_DOMAIN_NET_TYPE_BRIDGE) &&
|
||||||
(xmlStrEqual(cur->name, BAD_CAST "source"))) {
|
(xmlStrEqual(cur->name, BAD_CAST "source"))) {
|
||||||
@ -1031,6 +1041,15 @@ virDomainNetDefParseXML(virConnectPtr conn,
|
|||||||
def->data.socket.address = address;
|
def->data.socket.address = address;
|
||||||
address = NULL;
|
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) {
|
if (ifname != NULL) {
|
||||||
@ -1068,6 +1087,7 @@ cleanup:
|
|||||||
VIR_FREE(bridge);
|
VIR_FREE(bridge);
|
||||||
VIR_FREE(model);
|
VIR_FREE(model);
|
||||||
VIR_FREE(type);
|
VIR_FREE(type);
|
||||||
|
VIR_FREE(internal);
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
|
|
||||||
@ -3051,6 +3071,12 @@ virDomainNetDefFormat(virConnectPtr conn,
|
|||||||
else
|
else
|
||||||
virBufferVSprintf(buf, " <source port='%d'/>\n",
|
virBufferVSprintf(buf, " <source port='%d'/>\n",
|
||||||
def->data.socket.port);
|
def->data.socket.port);
|
||||||
|
|
||||||
|
case VIR_DOMAIN_NET_TYPE_INTERNAL:
|
||||||
|
virBufferEscapeString(buf, " <source name='%s'/>\n",
|
||||||
|
def->data.internal.name);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->ifname)
|
if (def->ifname)
|
||||||
|
@ -138,6 +138,7 @@ enum virDomainNetType {
|
|||||||
VIR_DOMAIN_NET_TYPE_MCAST,
|
VIR_DOMAIN_NET_TYPE_MCAST,
|
||||||
VIR_DOMAIN_NET_TYPE_NETWORK,
|
VIR_DOMAIN_NET_TYPE_NETWORK,
|
||||||
VIR_DOMAIN_NET_TYPE_BRIDGE,
|
VIR_DOMAIN_NET_TYPE_BRIDGE,
|
||||||
|
VIR_DOMAIN_NET_TYPE_INTERNAL,
|
||||||
|
|
||||||
VIR_DOMAIN_NET_TYPE_LAST,
|
VIR_DOMAIN_NET_TYPE_LAST,
|
||||||
};
|
};
|
||||||
@ -168,6 +169,9 @@ struct _virDomainNetDef {
|
|||||||
char *script;
|
char *script;
|
||||||
char *ipaddr;
|
char *ipaddr;
|
||||||
} bridge;
|
} bridge;
|
||||||
|
struct {
|
||||||
|
char *name;
|
||||||
|
} internal;
|
||||||
} data;
|
} data;
|
||||||
char *ifname;
|
char *ifname;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user