mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
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>
This commit is contained in:
1 parent
dc3c184731
commit
464379d285
2 files changed
+23
-6
No files matched your search
@@ -74,9 +74,10 @@ class NetifController(DevController):
|
||||
typ = sxp.child_value(config, 'type')
|
||||
if typ == 'ioemu':
|
||||
return (None,{},{})
|
||||
bridge = sxp.child_value(config, 'bridge')
|
||||
mac = sxp.child_value(config, 'mac')
|
||||
ipaddr = _get_config_ipaddr(config)
|
||||
bridge = sxp.child_value(config, 'bridge')
|
||||
mac = sxp.child_value(config, 'mac')
|
||||
vifname = sxp.child_value(config, 'vifname')
|
||||
ipaddr = _get_config_ipaddr(config)
|
||||
|
||||
devid = self.allocateDeviceID()
|
||||
|
||||
@@ -90,6 +91,8 @@ class NetifController(DevController):
|
||||
back['ip'] = ' '.join(ipaddr)
|
||||
if bridge:
|
||||
back['bridge'] = bridge
|
||||
if vifname:
|
||||
back['vifname'] = vifname
|
||||
|
||||
front = { 'handle' : "%i" % devid,
|
||||
'mac' : mac }
|
||||
@@ -102,9 +105,8 @@ class NetifController(DevController):
|
||||
|
||||
result = DevController.configuration(self, devid)
|
||||
|
||||
(script, ip, bridge, mac) = self.readBackend(devid,
|
||||
'script', 'ip', 'bridge',
|
||||
'mac')
|
||||
(script, ip, bridge, mac, typ, vifname) = self.readBackend(
|
||||
devid, 'script', 'ip', 'bridge', 'mac', 'type', 'vifname')
|
||||
|
||||
if script:
|
||||
result.append(['script',
|
||||
@@ -116,5 +118,9 @@ class NetifController(DevController):
|
||||
result.append(['bridge', bridge])
|
||||
if mac:
|
||||
result.append(['mac', mac])
|
||||
if typ:
|
||||
result.append(['type', typ])
|
||||
if vifname:
|
||||
result.append(['vifname', vifname])
|
||||
|
||||
return result
|
||||