X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sliver_libvirt.py;h=778eb1044ad21d0235eb57a0a2ba606f70ab4339;hb=da86cf851cca445bee8da1d495cca83ec196bb13;hp=d5c327baffff0491746c3ef15b49dd678db09839;hpb=0f51f7fc64906f87640def6f27a1dc732ed8f453;p=nodemanager.git
diff --git a/sliver_libvirt.py b/sliver_libvirt.py
index d5c327b..778eb10 100644
--- a/sliver_libvirt.py
+++ b/sliver_libvirt.py
@@ -9,7 +9,7 @@ import libvirt
from account import Account
import logger
-import bwlimit
+import plnode.bwlimit as bwlimit
import cgroups
STATES = {
@@ -55,7 +55,7 @@ class Sliver_Libvirt(Account):
self.rspec = {}
self.slice_id = rec['slice_id']
self.enabled = True
- self.conn = getConnection(rec['type'])
+ self.conn = Sliver_Libvirt.getConnection(rec['type'])
self.xid = bwlimit.get_xid(self.name)
dom = None
@@ -163,3 +163,28 @@ class Sliver_Libvirt(Account):
# Call the upper configure method (ssh keys...)
Account.configure(self, rec)
+ # A placeholder until we get true VirtualInterface objects
+ @staticmethod
+ def get_interfaces_xml(rec):
+ xml = """
+
+
+
+"""
+ try:
+ tags = rec['rspec']['tags']
+ if 'interface' in tags:
+ interface = eval(tags['interface'])
+ if 'bridge' in interface:
+ xml = """
+
+
+
+
+""" % interface['bridge']
+ logger.log('sliver_libvirty.py: interface XML is: %s' % xml)
+ except:
+ logger.log('sliver_libvirt.py: ERROR parsing "interface" tag for slice %s' % rec['name'])
+ logger.log('sliver_libvirt.py: tag value: %s' % tags['interface'])
+
+ return xml