ia64/xen-unstable
changeset 8347:95f84e37c90d
Resurrect vifname xm create vif option support. This was present in earlier
versions of Xen, and allows one to name a vif when it is created. This is
useful for integration with IP accounting packages, for example.
Closes bug #439.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
versions of Xen, and allows one to name a vif when it is created. This is
useful for integration with IP accounting packages, for example.
Closes bug #439.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author | emellor@leeni.uk.xensource.com |
---|---|
date | Tue Dec 13 18:06:03 2005 +0000 (2005-12-13) |
parents | 7256d2425fa7 |
children | d37644abe52d |
files | tools/examples/vif-common.sh tools/python/xen/xend/server/netif.py |
line diff
1.1 --- a/tools/examples/vif-common.sh Tue Dec 13 17:31:35 2005 +0000 1.2 +++ b/tools/examples/vif-common.sh Tue Dec 13 18:06:03 2005 +0000 1.3 @@ -53,6 +53,17 @@ XENBUS_PATH="${XENBUS_PATH:?}" 1.4 vif="${vif:?}" 1.5 1.6 1.7 +vifname=$(xenstore_read_default "$XENBUS_PATH/vifname" "") 1.8 +if [ "$vifname" ] 1.9 +then 1.10 + if [ "$command" == "online" ] && ! ip link show "$vifname" >&/dev/null 1.11 + then 1.12 + do_or_die ip link set "$vif" name "$vifname" 1.13 + fi 1.14 + vif="$vifname" 1.15 +fi 1.16 + 1.17 + 1.18 function frob_iptable() 1.19 { 1.20 if [ "$command" == "online" ]
2.1 --- a/tools/python/xen/xend/server/netif.py Tue Dec 13 17:31:35 2005 +0000 2.2 +++ b/tools/python/xen/xend/server/netif.py Tue Dec 13 18:06:03 2005 +0000 2.3 @@ -74,9 +74,10 @@ class NetifController(DevController): 2.4 typ = sxp.child_value(config, 'type') 2.5 if typ == 'ioemu': 2.6 return (None,{},{}) 2.7 - bridge = sxp.child_value(config, 'bridge') 2.8 - mac = sxp.child_value(config, 'mac') 2.9 - ipaddr = _get_config_ipaddr(config) 2.10 + bridge = sxp.child_value(config, 'bridge') 2.11 + mac = sxp.child_value(config, 'mac') 2.12 + vifname = sxp.child_value(config, 'vifname') 2.13 + ipaddr = _get_config_ipaddr(config) 2.14 2.15 devid = self.allocateDeviceID() 2.16 2.17 @@ -90,6 +91,8 @@ class NetifController(DevController): 2.18 back['ip'] = ' '.join(ipaddr) 2.19 if bridge: 2.20 back['bridge'] = bridge 2.21 + if vifname: 2.22 + back['vifname'] = vifname 2.23 2.24 front = { 'handle' : "%i" % devid, 2.25 'mac' : mac } 2.26 @@ -102,9 +105,8 @@ class NetifController(DevController): 2.27 2.28 result = DevController.configuration(self, devid) 2.29 2.30 - (script, ip, bridge, mac) = self.readBackend(devid, 2.31 - 'script', 'ip', 'bridge', 2.32 - 'mac') 2.33 + (script, ip, bridge, mac, typ, vifname) = self.readBackend( 2.34 + devid, 'script', 'ip', 'bridge', 'mac', 'type', 'vifname') 2.35 2.36 if script: 2.37 result.append(['script', 2.38 @@ -116,5 +118,9 @@ class NetifController(DevController): 2.39 result.append(['bridge', bridge]) 2.40 if mac: 2.41 result.append(['mac', mac]) 2.42 + if typ: 2.43 + result.append(['type', typ]) 2.44 + if vifname: 2.45 + result.append(['vifname', vifname]) 2.46 2.47 return result