X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sliver_libvirt.py;h=c5b4bbce9c81385df443b020de48b89c5d5a99ec;hb=fdc12c02616ed5b342630cab90d01e85f43cfc1f;hp=619448fdb76a010eb87ab89586dcac087386ece8;hpb=aaed32c80a83c4c8eb1db7f93ec7fb32f3a74c5e;p=nodemanager.git diff --git a/sliver_libvirt.py b/sliver_libvirt.py index 619448f..c5b4bbc 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 = { @@ -163,3 +163,33 @@ 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 'vlan' in interface: + vlanxml = "" % interface['vlan'] + else: + vlanxml = "" + if 'bridge' in interface: + xml = """ + + + %s + + +""" % (interface['bridge'], vlanxml) + 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