aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-09-02 14:15:49 +0000
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-09-02 14:15:49 +0000
commit074210e7201885f802a6f745345eda90072be2bd (patch)
tree013cd31647fdc7e6908e2b86c423fdfd58b26476 /tools
parentfdda579ede6de2a4f182fc0553c3758c3365cfd4 (diff)
downloadxen-074210e7201885f802a6f745345eda90072be2bd.tar.gz
xen-074210e7201885f802a6f745345eda90072be2bd.tar.bz2
xen-074210e7201885f802a6f745345eda90072be2bd.zip
Restore configurability of vif bring up script and passing arguments to the script.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/examples/xen-backend.agent18
-rw-r--r--tools/python/xen/xend/XendDomainInfo.py26
2 files changed, 35 insertions, 9 deletions
diff --git a/tools/examples/xen-backend.agent b/tools/examples/xen-backend.agent
index a708aad8f3..0058bd2842 100755
--- a/tools/examples/xen-backend.agent
+++ b/tools/examples/xen-backend.agent
@@ -1,21 +1,25 @@
#! /bin/sh
-#DEVPATH=/devices/xen-backend/vif-1-0
#ACTION=add
+#DEVPATH=/devices/xen-backend/vif-1-0
+#PHYSDEVDRIVER=vif
+#XENBUS_TYPE=vif
PATH=/etc/xen/scripts:$PATH
-DEV=$(basename "$DEVPATH")
case "$ACTION" in
add)
- case "$DEV" in
- vif-*)
- vif=$(echo "$DEV" | sed 's/-\([0-9]*\)-\([0-9]*\)/\1.\2/')
- vif-bridge up domain=unknown vif="$vif" mac=fe:ff:ff:ff:ff:ff bridge=xen-br0 >/dev/null 2>&1
+ ;;
+ remove)
+ ;;
+ online)
+ case "$PHYSDEVDRIVER" in
+ vif)
+ [ -n "$script" ] && $script up
;;
esac
;;
- remove)
+ offline)
;;
esac
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index ee8edd566f..dcd6bcc529 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -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)