mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Restore configurability of vif bring up script and passing arguments to the script.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
This commit is contained in:
1 parent
fdda579ede
commit
074210e720
5 files changed
+110
-10
No files matched your search
@@ -430,6 +430,15 @@ class XendDomainInfo:
|
||||
return
|
||||
|
||||
if type == 'vif':
|
||||
from xen.xend import XendRoot
|
||||
xroot = XendRoot.instance()
|
||||
|
||||
def _get_config_ipaddr(config):
|
||||
val = []
|
||||
for ipaddr in sxp.children(config, elt='ip'):
|
||||
val.append(sxp.child0(ipaddr))
|
||||
return val
|
||||
|
||||
backdom = domain_exists(sxp.child_value(devconfig, 'backend', '0'))
|
||||
|
||||
log.error(devconfig)
|
||||
@@ -437,6 +446,14 @@ class XendDomainInfo:
|
||||
devnum = self.netif_idx
|
||||
self.netif_idx += 1
|
||||
|
||||
script = sxp.child_value(devconfig, 'script',
|
||||
xroot.get_vif_script())
|
||||
script = os.path.join(xroot.network_script_dir, script)
|
||||
bridge = sxp.child_value(devconfig, 'bridge',
|
||||
xroot.get_vif_bridge())
|
||||
mac = sxp.child_value(devconfig, 'mac')
|
||||
ipaddr = _get_config_ipaddr(devconfig)
|
||||
|
||||
# create backend db
|
||||
backdb = backdom.db.addChild("/backend/%s/%s/%d" %
|
||||
(type, self.uuid, devnum))
|
||||
@@ -444,6 +461,12 @@ class XendDomainInfo:
|
||||
# create frontend db
|
||||
db = self.db.addChild("/device/%s/%d" % (type, devnum))
|
||||
|
||||
backdb['script'] = script
|
||||
backdb['domain'] = self.name
|
||||
backdb['mac'] = mac
|
||||
backdb['bridge'] = bridge
|
||||
if ipaddr:
|
||||
backdb['ip'] = ' '.join(ipaddr)
|
||||
backdb['frontend'] = db.getPath()
|
||||
backdb['frontend-id'] = "%i" % self.id
|
||||
backdb['handle'] = "%i" % devnum
|
||||
@@ -452,8 +475,7 @@ class XendDomainInfo:
|
||||
db['backend'] = backdb.getPath()
|
||||
db['backend-id'] = "%i" % backdom.id
|
||||
db['handle'] = "%i" % devnum
|
||||
log.error(sxp.child_value(devconfig, 'mac'))
|
||||
db['mac'] = sxp.child_value(devconfig, 'mac')
|
||||
db['mac'] = mac
|
||||
|
||||
db.saveDB(save=True)
|
||||
|
||||
|
||||