mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
Support script for bridge interface type
This commit is contained in:
parent
39e6ded8ae
commit
fb4ec82358
28
ChangeLog
28
ChangeLog
@ -1,3 +1,31 @@
|
||||
Thu Jan 22 09:51:29 PST 2009 John Levon <john.levon@sun.com>
|
||||
|
||||
* src/domain_conf.h, src/domain_conf.c, src/xend_internal.c,
|
||||
src/xm_internal.c: Support script for bridge interface type
|
||||
|
||||
* tests/sexpr2xmldata/sexpr2xml-curmem.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-disk-block-shareable.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp-telnet.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-sound.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-utc.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv-v2.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-fv.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-net-bridged.xml,
|
||||
tests/sexpr2xmldata/sexpr2xml-net-e1000.xml: update tests
|
||||
|
||||
Wed Jan 21 18:18:12 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
Missing test case fix up from Xen threadsafety changes
|
||||
|
@ -288,6 +288,7 @@ void virDomainNetDefFree(virDomainNetDefPtr def)
|
||||
|
||||
case VIR_DOMAIN_NET_TYPE_BRIDGE:
|
||||
VIR_FREE(def->data.bridge.brname);
|
||||
VIR_FREE(def->data.bridge.script);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -897,7 +898,8 @@ virDomainNetDefParseXML(virConnectPtr conn,
|
||||
VIR_FREE(ifname);
|
||||
}
|
||||
} else if ((script == NULL) &&
|
||||
(def->type == VIR_DOMAIN_NET_TYPE_ETHERNET) &&
|
||||
(def->type == VIR_DOMAIN_NET_TYPE_ETHERNET ||
|
||||
def->type == VIR_DOMAIN_NET_TYPE_BRIDGE) &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "script")) {
|
||||
script = virXMLPropString(cur, "path");
|
||||
} else if (xmlStrEqual (cur->name, BAD_CAST "model")) {
|
||||
@ -948,6 +950,10 @@ virDomainNetDefParseXML(virConnectPtr conn,
|
||||
}
|
||||
def->data.bridge.brname = bridge;
|
||||
bridge = NULL;
|
||||
if (script != NULL) {
|
||||
def->data.bridge.script = script;
|
||||
script = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_NET_TYPE_CLIENT:
|
||||
@ -2883,6 +2889,9 @@ virDomainNetDefFormat(virConnectPtr conn,
|
||||
case VIR_DOMAIN_NET_TYPE_BRIDGE:
|
||||
virBufferEscapeString(buf, " <source bridge='%s'/>\n",
|
||||
def->data.bridge.brname);
|
||||
if (def->data.bridge.script)
|
||||
virBufferEscapeString(buf, " <script path='%s'/>\n",
|
||||
def->data.bridge.script);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_NET_TYPE_SERVER:
|
||||
|
@ -154,6 +154,7 @@ struct _virDomainNetDef {
|
||||
} network;
|
||||
struct {
|
||||
char *brname;
|
||||
char *script;
|
||||
} bridge;
|
||||
} data;
|
||||
char *ifname;
|
||||
|
@ -61,6 +61,12 @@
|
||||
|
||||
#endif /* PROXY */
|
||||
|
||||
#ifdef __sun
|
||||
#define DEFAULT_VIF_SCRIPT "vif-vnic"
|
||||
#else
|
||||
#define DEFAULT_VIF_SCRIPT "vif-bridge"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_RHEL5_API
|
||||
#define XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU 0
|
||||
#define XEND_CONFIG_MIN_VERS_PVFB_NEWCONF 2
|
||||
@ -1739,15 +1745,22 @@ xenDaemonParseSxprNets(virConnectPtr conn,
|
||||
if (VIR_ALLOC(net) < 0)
|
||||
goto no_memory;
|
||||
|
||||
if ((tmp2 && strstr(tmp2, "bridge")) || tmp) {
|
||||
if (tmp != NULL || (STREQ(tmp2, DEFAULT_VIF_SCRIPT))) {
|
||||
net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
|
||||
/* XXX virtual network reverse resolve */
|
||||
|
||||
if (tmp &&
|
||||
!(net->data.bridge.brname = strdup(tmp)))
|
||||
goto no_memory;
|
||||
if (tmp2 &&
|
||||
net->type == VIR_DOMAIN_NET_TYPE_BRIDGE &&
|
||||
!(net->data.bridge.script = strdup(tmp2)))
|
||||
goto no_memory;
|
||||
} else {
|
||||
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
|
||||
if (tmp2 &&
|
||||
!(net->data.ethernet.script = strdup(tmp2)))
|
||||
goto no_memory;
|
||||
}
|
||||
|
||||
tmp = sexpr_node(node, "device/vif/vifname");
|
||||
@ -1786,11 +1799,6 @@ xenDaemonParseSxprNets(virConnectPtr conn,
|
||||
!(net->data.ethernet.ipaddr = strdup(tmp)))
|
||||
goto no_memory;
|
||||
|
||||
if (tmp2 &&
|
||||
net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
|
||||
!(net->data.ethernet.script = strdup(tmp2)))
|
||||
goto no_memory;
|
||||
|
||||
if (model &&
|
||||
!(net->model = strdup(model)))
|
||||
goto no_memory;
|
||||
@ -5089,6 +5097,8 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
|
||||
int xendConfigVersion,
|
||||
int isAttach)
|
||||
{
|
||||
const char *script = DEFAULT_VIF_SCRIPT;
|
||||
|
||||
if (def->type != VIR_DOMAIN_NET_TYPE_BRIDGE &&
|
||||
def->type != VIR_DOMAIN_NET_TYPE_NETWORK &&
|
||||
def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) {
|
||||
@ -5110,7 +5120,10 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
|
||||
switch (def->type) {
|
||||
case VIR_DOMAIN_NET_TYPE_BRIDGE:
|
||||
virBufferVSprintf(buf, "(bridge '%s')", def->data.bridge.brname);
|
||||
virBufferAddLit(buf, "(script 'vif-bridge')");
|
||||
if (def->data.bridge.script)
|
||||
script = def->data.bridge.script;
|
||||
|
||||
virBufferVSprintf(buf, "(script '%s')", script);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_NET_TYPE_NETWORK:
|
||||
@ -5133,7 +5146,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
|
||||
return -1;
|
||||
}
|
||||
virBufferVSprintf(buf, "(bridge '%s')", bridge);
|
||||
virBufferAddLit(buf, "(script 'vif-bridge')");
|
||||
virBufferVSprintf(buf, "(script '%s')", script);
|
||||
VIR_FREE(bridge);
|
||||
}
|
||||
break;
|
||||
|
@ -1075,15 +1075,20 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
|
||||
net->mac[5] = rawmac[5];
|
||||
}
|
||||
|
||||
if (bridge[0] || STREQ(script, "vif-bridge"))
|
||||
if (bridge[0] || STREQ(script, "vif-bridge") ||
|
||||
STREQ(script, "vif-vnic")) {
|
||||
net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
|
||||
else
|
||||
} else {
|
||||
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
|
||||
}
|
||||
|
||||
if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
|
||||
if (bridge[0] &&
|
||||
!(net->data.bridge.brname = strdup(bridge)))
|
||||
goto no_memory;
|
||||
if (script[0] &&
|
||||
!(net->data.bridge.script = strdup(script)))
|
||||
goto no_memory;
|
||||
} else {
|
||||
if (script[0] &&
|
||||
!(net->data.ethernet.script = strdup(script)))
|
||||
|
@ -24,6 +24,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1d:06:15'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif5.0'/>
|
||||
</interface>
|
||||
<console type='pty'>
|
||||
|
@ -22,6 +22,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:23:9e:eb'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif6.0'/>
|
||||
</interface>
|
||||
<console type='pty'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif3.0'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif1.0'/>
|
||||
</interface>
|
||||
<parallel type='tcp'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif1.0'/>
|
||||
</interface>
|
||||
<serial type='file'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif1.0'/>
|
||||
</interface>
|
||||
<serial type='null'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif1.0'/>
|
||||
</interface>
|
||||
<serial type='pipe'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif1.0'/>
|
||||
</interface>
|
||||
<serial type='pty'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif1.0'/>
|
||||
</interface>
|
||||
<serial type='stdio'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif1.0'/>
|
||||
</interface>
|
||||
<serial type='tcp'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif1.0'/>
|
||||
</interface>
|
||||
<serial type='tcp'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif1.0'/>
|
||||
</interface>
|
||||
<serial type='udp'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif1.0'/>
|
||||
</interface>
|
||||
<serial type='unix'>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif3.0'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif3.0'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif3.0'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='usb'/>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif3.0'/>
|
||||
</interface>
|
||||
<input type='tablet' bus='usb'/>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif3.0'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif3.0'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:16:3e:1b:b1:47'/>
|
||||
<source bridge='xenbr0'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif3.0'/>
|
||||
</interface>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
|
@ -23,6 +23,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:11:22:33:44:55'/>
|
||||
<source bridge='xenbr2'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif6.0'/>
|
||||
</interface>
|
||||
<console type='pty'>
|
||||
|
@ -23,6 +23,7 @@
|
||||
<interface type='bridge'>
|
||||
<mac address='00:11:22:33:44:55'/>
|
||||
<source bridge='xenbr2'/>
|
||||
<script path='vif-bridge'/>
|
||||
<target dev='vif6.0'/>
|
||||
<model type='e1000'/>
|
||||
</interface>
|
||||
|
Loading…
Reference in New Issue
Block a user