[Libvirt-cim] [PATCH] [TEST] Update vsms.py and vxml.py to support emu_type for Xen and KVM, also pass for LXC

yunguol at cn.ibm.com yunguol at cn.ibm.com
Mon Jan 12 09:59:13 UTC 2009


# HG changeset patch
# User Guolian Yun <yunguol at cn.ibm.com>
# Date 1231754345 28800
# Node ID 3514eb48a62cab3ed58a2aee14de5f781f779c59
# Parent  5cd63239ee18370a87d82b8d72856fa0f297b273
[TEST] Update vsms.py and vxml.py to support emu_type for Xen and KVM, also pass for LXC

Signed-off-by: Guolian Yun <yunguol at cn.ibm.com>

diff -r 5cd63239ee18 -r 3514eb48a62c suites/libvirt-cim/lib/XenKvmLib/vsms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py	Thu Jan 08 15:02:43 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py	Mon Jan 12 01:59:05 2009 -0800
@@ -249,13 +249,15 @@
     if virt == 'KVM':
         disk_dev = 'hda'
         disk_source = const.KVM_disk_path
+        d = class_dasd(disk_dev, disk_source, dom_name, emu_type)
     elif virt == 'XenFV':
         disk_dev = 'hda'
         disk_source = const.XenFV_disk_path
+        d = class_dasd(disk_dev, disk_source, dom_name, emu_type)
     elif virt == 'LXC':
         disk_dev = const.LXC_default_mp
         disk_source = const.LXC_default_source
-    d = class_dasd(disk_dev, disk_source, dom_name, emu_type)
+        d = class_dasd(disk_dev, disk_source, dom_name)
     
     class_masd = get_masd_class(virt)
     m = class_masd(
diff -r 5cd63239ee18 -r 3514eb48a62c suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py	Thu Jan 08 15:02:43 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py	Mon Jan 12 01:59:05 2009 -0800
@@ -471,16 +471,18 @@
         self.virt = virt
         self.domain_name = dom_name
         self.vssd = vsms.get_vssd_mof(virt, dom_name)
-        self.dasd = vsms.get_dasd_class(virt)(disk_dev, disk_source, 
-                                              dom_name, emu_type)
         self.nasd = vsms.get_nasd_class(virt)(type=net_type, 
                                               mac=net_mac,
                                               name=dom_name,
                                               virt_net=net_name)
         if virt == 'LXC':
             self.pasd = vsms.get_pasd_class(virt)(name=dom_name)
+            self.dasd = vsms.get_dasd_class(virt)(disk_dev, disk_source,
+                                                  dom_name)
         else:
             self.pasd = vsms.get_pasd_class(virt)(vcpu=vcpus, name=dom_name)
+            self.dasd = vsms.get_dasd_class(virt)(disk_dev, disk_source,
+                                                  dom_name, emu_type)
         self.masd = vsms.get_masd_class(virt)(megabytes=mem, 
                                               mallocunits=mem_allocunits,
                                               name=dom_name)
@@ -631,7 +633,8 @@
                        disk_file_path=const.Xen_disk_path,
                        disk=const.Xen_default_disk_dev, 
                        ntype=const.default_net_type,
-                       net_name=const.default_network_name): 
+                       net_name=const.default_network_name,
+                       emu_type=None): 
         if not (os.path.exists(const.Xen_kernel_path) \
                 and os.path.exists(const.Xen_init_path)):
             logger.error('ERROR: Either the kernel image '
@@ -642,7 +645,8 @@
         self._devices(disk_file_path, disk, ntype, mac, net_name)
 
         VirtCIM.__init__(self, 'Xen', test_dom, disk, disk_file_path, 
-                         ntype, net_name, mac, vcpus, mem, mem_allocunits)
+                         ntype, net_name, mac, vcpus, mem, mem_allocunits, 
+                         emu_type)
 
     def _os(self, os_kernel, os_initrd):
         os = self.get_node('/domain/os')
@@ -743,13 +747,15 @@
                        disk_file_path=const.XenFV_disk_path,
                        disk=const.XenFV_default_disk_dev, 
                        ntype=const.default_net_type,
-                       net_name=const.default_network_name):
+                       net_name=const.default_network_name,
+                       emu_type=None):
         if not os.path.exists(disk_file_path):
             logger.error('Error: Disk image does not exist')
             sys.exit(1)
         VirtXML.__init__(self, 'xenfv', test_dom, set_uuid(), mem, vcpus)
         VirtCIM.__init__(self, 'XenFV', test_dom, disk, disk_file_path,
-                         ntype, net_name, mac, vcpus, mem, mem_allocunits)
+                         ntype, net_name, mac, vcpus, mem, mem_allocunits, 
+                         emu_type)
         self._features()
         self._os(const.XenFV_default_loader)
         self._devices(const.XenFV_default_emulator,
@@ -800,7 +806,7 @@
         VirtXML.__init__(self, 'lxc', test_dom, set_uuid(), mem, vcpus)
         VirtCIM.__init__(self, 'LXC', test_dom, const.LXC_default_mp,
                          const.LXC_default_source, ntype, net_name, mac, vcpus,
-                         mem, const.default_mallocunits)
+                         mem, const.default_mallocunits, None)
         self._os(const.LXC_init_path)
         self._devices(mac, ntype, net_name, const.LXC_default_tty)
         self.create_lxc_file(CIM_IP, const.LXC_init_path)




More information about the Libvirt-cim mailing list