- interface = eval(tags['interface'])
- if 'bridge' in interface:
- xml = """
- <interface type='bridge'>
- <source bridge='%s'/>
- <virtualport type='openvswitch'/>
- </interface>
-""" % interface['bridge']
- logger.log('sliver_libvirty.py: interface XML is: %s' % xml)
+ interfaces = eval(tags['interface'])
+ if not isinstance(interfaces, (list, tuple)):
+ # if interface is not a list, then make it into a singleton list
+ interfaces = [interfaces]
+ tag_xml = ""
+ for interface in interfaces:
+ if 'vlan' in interface:
+ vlanxml = "<vlan><tag id='%s'/></vlan>" % interface['vlan']
+ else:
+ vlanxml = ""
+ if 'bridge' in interface:
+ tag_xml = tag_xml + """
+ <interface type='bridge'>
+ <source bridge='%s'/>
+ %s
+ <virtualport type='openvswitch'/>
+ <target dev='%s'/>
+ </interface>
+ """ % (interface['bridge'], vlanxml, Sliver_Libvirt.get_unique_vif())
+ else:
+ tag_xml = tag_xml + """
+ <interface type='network'>
+ <source network='default'/>
+ <target dev='%s'/>
+ </interface>
+ """ % (Sliver_Libvirt.get_unique_vif())
+
+ xml = tag_xml
+ logger.log('sliver_libvirty.py: interface XML is: %s' % xml)
+