# HG changeset patch
# User anantyog(a)in.ibm.com
# Date 1249603785 25200
# Node ID 849bed1d2e467d6a2735e2c510ec0f40911c1554
# Parent ca99e2ff90ec82d9668f0751e201882acc0c0f16
[Test] (#2) Patch to set UUID in domain
Patch enables the user to set the UUID while defining a domain
Signed-off-by: Yogananth Subramanian <anantyog(a)linux.vnet.ibm.com>
diff -r ca99e2ff90ec -r 849bed1d2e46 suites/libvirt-cim/lib/XenKvmLib/vsms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Wed Aug 05 03:23:04 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Thu Aug 06 17:09:45 2009 -0700
@@ -91,7 +91,7 @@
# classes to define VSSD parameters
class CIM_VirtualSystemSettingData(CIMClassMOF):
- def __init__(self, name, virt, bldr=None, emulator=None):
+ def __init__(self, name, virt, uuid=None, bldr=None, emulator=None):
type = get_class_type(self.__class__.__name__)
self.InstanceID = '%s:%s' % (type, name)
self.Caption = self.Description = 'Virtual System'
@@ -116,6 +116,9 @@
if bldr is not None:
self.Bootloader = bldr
+ if uuid is not None:
+ self.UUID = uuid
+
class Xen_VirtualSystemSettingData(CIM_VirtualSystemSettingData):
pass
diff -r ca99e2ff90ec -r 849bed1d2e46 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Aug 05 03:23:04 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Thu Aug 06 17:09:45 2009 -0700
@@ -555,7 +555,7 @@
class VirtCIM:
- def __init__(self, virt, dom_name, disk_dev, disk_source,
+ def __init__(self, virt, dom_name, uuid, disk_dev, disk_source,
net_type, net_name, net_mac, vcpus, mem,
mem_allocunits, emu_type, grstype, ip,
port_num, kmap, irstype, btype, vnc_passwd):
@@ -563,7 +563,7 @@
self.domain_name = dom_name
self.err_rc = None
self.err_desc = None
- self.vssd = vsms.get_vssd_mof(virt, dom_name)
+ self.vssd = vsms.get_vssd_mof(virt, dom_name, uuid)
self.nasd = vsms.get_nasd_class(virt)(type=net_type,
mac=net_mac,
name=dom_name,
@@ -787,6 +787,7 @@
secondary_disk_path = const.Xen_secondary_disk_path
def __init__(self, test_dom=const.default_domname,
+ uuid=None,
mem=const.default_memory,
mem_allocunits=const.default_mallocunits,
vcpus=const.default_vcpus,
@@ -807,7 +808,7 @@
self._os(const.Xen_kernel_path, const.Xen_init_path)
self._devices(disk_file_path, disk, ntype, mac, net_name)
- VirtCIM.__init__(self, 'Xen', test_dom, disk, disk_file_path,
+ VirtCIM.__init__(self, 'Xen', test_dom, uuid, disk, disk_file_path,
ntype, net_name, mac, vcpus, mem, mem_allocunits,
emu_type, grstype, address, port_num, keymap, irstype,
btype, vnc_passwd)
@@ -852,6 +853,7 @@
secondary_disk_path = const.KVM_secondary_disk_path
def __init__(self, test_dom=const.default_domname,
+ uuid=None,
mem=const.default_memory,
mem_allocunits=const.default_mallocunits,
vcpus=const.default_vcpus,
@@ -867,7 +869,7 @@
logger.error('Error: Disk image does not exist')
sys.exit(1)
VirtXML.__init__(self, 'kvm', test_dom, set_uuid(), mem, vcpus)
- VirtCIM.__init__(self, 'KVM', test_dom, disk, disk_file_path,
+ VirtCIM.__init__(self, 'KVM', test_dom, uuid, disk, disk_file_path,
ntype, net_name, mac, vcpus, mem,
mem_allocunits, emu_type, grstype, address,
port_num, keymap, irstype, btype, vnc_passwd)
@@ -907,6 +909,7 @@
secondary_disk_path = const.XenFV_secondary_disk_path
def __init__(self, test_dom=const.default_domname,
+ uuid=None,
mem=const.default_memory,
mem_allocunits=const.default_mallocunits,
vcpus=const.default_vcpus,
@@ -922,7 +925,7 @@
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,
+ VirtCIM.__init__(self, 'XenFV', test_dom, disk, uuid, disk_file_path,
ntype, net_name, mac, vcpus, mem, mem_allocunits,
emu_type, grstype, address, port_num, keymap,
irstype, btype, vnc_passwd)
@@ -967,6 +970,7 @@
class LXCXML(VirtXML, VirtCIM):
def __init__(self, test_dom=const.default_domname,
+ uuid=None,
mem=const.default_memory,
vcpus=const.default_vcpus,
mac=const.LXC_default_mac,
@@ -976,7 +980,7 @@
address="127.0.0.1", port_num='-1',
keymap="en-us",
irstype="mouse", btype="usb",
vnc_passwd=None):
VirtXML.__init__(self, 'lxc', test_dom, set_uuid(), mem, vcpus)
- VirtCIM.__init__(self, 'LXC', test_dom, const.LXC_default_mp,
+ VirtCIM.__init__(self, 'LXC', test_dom, uuid, const.LXC_default_mp,
const.LXC_default_source, ntype, net_name, mac, vcpus,
mem, const.default_mallocunits, None, grstype,
address, port_num, keymap, irstype, btype, vnc_passwd)