aboutsummaryrefslogtreecommitdiffstats
path: root/tools/python/xen/xend/Vifctl.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/python/xen/xend/Vifctl.py')
-rw-r--r--tools/python/xen/xend/Vifctl.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/python/xen/xend/Vifctl.py b/tools/python/xen/xend/Vifctl.py
new file mode 100644
index 0000000000..49df8f6bd0
--- /dev/null
+++ b/tools/python/xen/xend/Vifctl.py
@@ -0,0 +1,28 @@
+import os
+import os.path
+import sys
+
+VIFCTL = '/etc/xen/xend/vifctl'
+
+def init():
+ os.system(VIFCTL + ' init ')
+
+def up(vif, mac=None, bridge=None, ipaddr=[]):
+ args = ['vif=%s' % vif]
+ if mac:
+ args.append('mac=%s' % mac)
+ if bridge:
+ args.append('bridge=%s' % bridge)
+ if ipaddr:
+ args.append('ipaddr=%s' % ','.join(ipaddr))
+ os.system(VIFCTL + ' up ' + ' '.join(args))
+
+def down(vif, mac=None, bridge=None, ipaddr=[]):
+ args = ['vif=%s' % vif]
+ if mac:
+ args.append('mac=%s' % mac)
+ if bridge:
+ args.append('bridge=%s' % bridge)
+ if ipaddr:
+ args.append('ipaddr=%s' % ','.join(ipaddr))
+ os.system(VIFCTL + ' down ' + ' '.join(args))