Guo Lian Yun wrote:
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1207726933 25200
# Node ID ca5633160e1cf78353d7b892a480f6fb5833e028
# Parent e72f3a8d54c5f9e6b895f4930126acca1c97e380
[TEST] add net_type setting in device node for KVM
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r e72f3a8d54c5 -r ca5633160e1c suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Apr 09 00:37:33 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Apr 09 00:42:13 2008 -0700
@@ -488,12 +488,12 @@ class KVMXML(VirtXML):
sys.exit(1)
VirtXML.__init__(self, 'kvm', test_dom, set_uuid(), mem, vcpus)
self._os()
- self._devices(const.KVM_default_emulator, disk_file_path, disk, mac)
+ self._devices(const.KVM_default_emulator, const.KVM_default_net_type,
disk_file_path, disk, mac)
def _os(self):
self.add_sub_node('/domain/os', 'type', 'hvm')
- def _devices(self, emu, disk_img, disk_dev, net_mac):
+ def _devices(self, emu, net_type, disk_img, disk_dev, net_mac):
devices = self.get_node('/domain/devices')
self.add_sub_node(devices, 'emulator', emu)
@@ -501,9 +501,10 @@ class KVMXML(VirtXML):
self.add_sub_node(disk, 'source', file=disk_img)
self.add_sub_node(disk, 'target', dev=disk_dev)
- interface = self.add_sub_node(devices, 'interface',
type='bridge')
+ interface = self.add_sub_node(devices, 'interface', type=net_type)
self.add_sub_node(interface, 'mac', address=net_mac)
- self.set_bridge(CIM_IP)
+ if net_type == 'bridge':
+ self.set_bridge(CIM_IP)
I think we should make use of the set_vbridge() instead of set_bridge().
set_bridge() sets the first bridge available on the machine. This might
not be useful in case there are more than one bridge that are available
on the machine,
and the virtual network present on the machine is not associated with
the first bridge on the machine every time.
Though the domain gets created with no problem, the tc which uses
NetRASD will fail since it wont be able to associate with the virtual
Network to which the domain belongs.
def set_emulator(self, emu):
return self._set_emulator(emu)
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim