[PATCH] Fix association class name typo in SDS
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1212540052 25200
# Node ID 0d18506e1ede6669ecbd2f6cf54f496fc032e69f
# Parent 8fdff95eb25e04745c992a76a85f45039e5022a5
Fix association class name typo in SDS.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 8fdff95eb25e -r 0d18506e1ede src/Virt_SettingsDefineState.c
--- a/src/Virt_SettingsDefineState.c Tue Jun 03 17:40:49 2008 -0700
+++ b/src/Virt_SettingsDefineState.c Tue Jun 03 17:40:52 2008 -0700
@@ -370,7 +370,7 @@
static char* assoc_classname[] = {
"Xen_SettingsDefineState",
"KVM_SettingsDefineState",
- "LXC_VirtualSystemSettingData",
+ "LXC_SettingsDefineState",
NULL
};
16 years, 5 months
libvir Error .
by Deepti B Kalakeri
Hi ,
I have noticed error messages like the following in the test case logs:
libvir: Xen error : Domain not found: xenUnifiedDomainLookupByName
libvir: Domain error : invalid domain pointer in virDomainFree
Can you let me know if its a known problem ?
Thanks and Regards,
Deepti.
16 years, 5 months
[PATCH] [TEST] Resubmitting #2 Fixing 02_reverse.py of RAPF with desc in commit log
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1212524019 25200
# Node ID 577b765748f176681e6c5cff2f6734436714bc76
# Parent 79f0d0723ae6425b141bec84f83b2ef3c7dd4fc3
[TEST] Resubmitting #2 Fixing 02_reverse.py of RAPF with desc in commit log.
Changes:
>From 1 to 2 patch:
1) Used getInstance instead of enumerate for RASD info.
2) Used the changeset no to reflect the ProcRASD InstanceID changes.
Added the following extra steps:
1) Defining a domain.
2) creating diskpool, netpool.
Without the steps 1 and 2 the tc used to simply pass.
The tc will fail on KVM with old libvirt-cim rpm .
It will also fail for Xen on latest sources.
The tc will pass with XenFV/KVM with the latest source.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 79f0d0723ae6 -r 577b765748f1 suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py
--- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Tue Jun 03 13:20:46 2008 +0800
+++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Tue Jun 03 13:13:39 2008 -0700
@@ -6,6 +6,7 @@
# Guolian Yun <yunguol(a)cn.ibm.com>
# Kaitlin Rupert <karupert(a)us.ibm.com>
# Zhengang Li <lizg(a)cn.ibm.com>
+# Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
@@ -25,69 +26,164 @@ import sys
import sys
from VirtLib import utils
from XenKvmLib import assoc
-from XenKvmLib import devices
+from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.const import CIM_REV
from CimTest import Globals
from CimTest.Globals import logger, do_main
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL
+from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib import enumclass
+from XenKvmLib.common_util import cleanup_restore, create_diskpool_conf, \
+create_netpool_conf
+
sup_types = ['Xen', 'XenFV', 'KVM']
+test_dom = "RAFP_dom"
+test_vcpus = 1
+test_mem = 128
+test_mac = "00:11:22:33:44:aa"
+proc_instid_rev = 590
+
+def setup_env(server, virt):
+ destroy_and_undefine_all(server)
+ vsxml = None
+ if virt == "Xen":
+ test_disk = "xvda"
+ else:
+ test_disk = "hda"
+
+ virtxml = get_class(virt)
+ vsxml = virtxml(test_dom, mem=test_mem, vcpus = test_vcpus,
+ mac = test_mac, disk = test_disk)
+ try:
+ ret = vsxml.define(server)
+ if not ret:
+ logger.error("Failed to Define the domain: %s", test_dom)
+ return FAIL, vsxml, test_disk
+
+ except Exception, details:
+ logger.error("Exception : %s", details)
+ return FAIL, vsxml, test_disk
+
+ return PASS, vsxml, test_disk
+
+def init_list(test_disk, diskid, test_network):
+
+ if CIM_REV < proc_instid_rev:
+ procid = '%s/%s' % (test_dom, 0)
+ else:
+ procid = '%s/%s' % (test_dom, 'proc')
+
+ proc = { 'rasd_id' : procid,
+ 'pool_id' : 'ProcessorPool/0'
+ }
+
+ mem = { 'rasd_id' : '%s/%s' % (test_dom,'mem'),
+ 'pool_id' : 'MemoryPool/0'
+ }
+
+ net = {
+ 'rasd_id' : '%s/%s' % (test_dom, test_mac),
+ 'pool_id' : 'NetworkPool/%s' %test_network
+ }
+
+ disk = { 'rasd_id' : '%s/%s' % (test_dom, test_disk),
+ 'pool_id' : diskid
+ }
+
+ cn_id_list = {
+ 'MemResourceAllocationSettingData' : mem,
+ 'ProcResourceAllocationSettingData' : proc,
+ 'NetResourceAllocationSettingData' : net,
+ 'DiskResourceAllocationSettingData' : disk
+ }
+
+ return cn_id_list
+
+def get_rasd_instance(server, virt, key_list, cn):
+ inst = None
+ try:
+ inst = enumclass.getInstance(server, cn, key_list, virt)
+ except Exception, details:
+ logger.error(Globals.CIM_ERROR_GETINSTANCE, cn)
+ logger.error("Exception details: %s", details)
+ return inst, FAIL
+
+ return inst, PASS
+
+def verify_pool_from_RAFP(server, virt, inst, pool_id, cn):
+ pool = []
+ try:
+ pool = assoc.AssociatorNames(server, "ResourceAllocationFromPool",
+ cn, virt, InstanceID = inst.InstanceID)
+ except Exception:
+ logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES, inst.InstanceID)
+ return FAIL
+
+ if len(pool) != 1:
+ logger.error("No associated pool for %s", inst.InstanceID)
+ return FAIL
+
+ if pool[0]['InstanceID'] != pool_id:
+ logger.error("InstanceID Mismatch")
+ logger.error("Returned %s instead of %s", pool[0]['InstanceID'] ,
+ pool_id)
+ return FAIL
+
+ return PASS
+
+def get_rasdinst_verify_pool_from_RAFP(server, virt, vsxml, cn, id_info):
+ try:
+ key_list = { 'InstanceID' : id_info['rasd_id'] }
+ rasd_cn = get_typed_class(virt, cn)
+ rasdinst, status = get_rasd_instance(server, virt, key_list, rasd_cn)
+ if status != PASS or rasdinst.InstanceID == None:
+ vsxml.undefine(server)
+ return status
+
+ status = verify_pool_from_RAFP(server, virt, rasdinst,
+ id_info['pool_id'], cn)
+ except Exception, details:
+ logger.error("Exception in get_rasdinst_verify_pool_from_RAFP() fn")
+ logger.error("Exception Details %s", details)
+ status = FAIL
+
+ if status != PASS:
+ vsxml.undefine(server)
+
+ return status
+
@do_main(sup_types)
def main():
options = main.options
status = PASS
+ server = options.ip
+ virt = options.virt
+
+ status, vsxml, test_disk = setup_env(server, virt)
+ if status != PASS:
+ return status
- key_list = ["DeviceID", "CreationClassName", "SystemName",
- "SystemCreationClassName"]
- try:
- mem = devices.enumerate(options.ip, 'Memory', key_list, options.virt)
- except Exception:
- logger.error(Globals.CIM_ERROR_ENUMERATE % 'Memory')
- return FAIL
+ status, diskid = create_diskpool_conf(server, virt)
+ if status != PASS:
+ return status
- try:
- proc = devices.enumerate(options.ip, 'Processor', key_list, options.virt)
- except Exception:
- logger.error(Globals.CIM_ERROR_ENUMERATE % 'Processor')
- return FAIL
-
- for i in range(len(mem)):
- try:
- mempool = assoc.AssociatorNames(options.ip, "ResourceAllocationFromPool",
- "MemResourceAllocationSettingData",
- options.virt,
- InstanceID = mem[i].DeviceID)
- except Exception:
- logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % mem[i].DeviceID)
- status = FAIL
+ status, test_network = create_netpool_conf(server, virt)
+ if status != PASS:
+ return status
- if len(mempool) < 1:
- logger.error("No associated pool for %s" % mem[i].DeviceID)
- return FAIL
+ cn_id_list = init_list(test_disk, diskid, test_network)
- if mempool[0].keybindings['InstanceID'] != "MemoryPool/0":
- logger.error("MemResourceAllocationSettingData association error")
- return FAIL
-
- for j in range(len(proc)):
- try:
- procpool = assoc.AssociatorNames(options.ip, "ResourceAllocationFromPool",
- "ProcResourceAllocationSettingData",
- options.virt,
- InstanceID = proc[j].DeviceID)
- except Exception:
- logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % proc[j].DeviceID)
- return FAIL
-
- if len(procpool) < 1:
- logger.error("No associated pool for %s" % proc[j].DeviceID)
- return FAIL
+ for rasd_cn, id_info in cn_id_list.iteritems():
+ status = get_rasdinst_verify_pool_from_RAFP(server, virt, vsxml,
+ rasd_cn, id_info)
+ if status != PASS:
+ return status
- if procpool[0].keybindings['InstanceID'] != "ProcessorPool/0":
- logger.error("ProcResourceAllocationSettingData association failed")
- status = FAIL
-
+ cleanup_restore(server, virt)
+ vsxml.undefine(server)
return status
if __name__ == "__main__":
16 years, 5 months
[PATCH] (#2) Return an error for type processor in AddResource and RemoveResource
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1212518806 25200
# Node ID 4f7942780a4186e3526b0c6435b0b32c05385013
# Parent 0c8d4baf3ee1f6eb96f7d1d49276fa6cc44c4685
(#2) Return an error for type processor in AddResource and RemoveResource.
A user should use ModifyResource to change the number of processors.
Also fix a warning caused by this change.
Update:
-Fix copy and paste error.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 0c8d4baf3ee1 -r 4f7942780a41 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri May 30 06:57:03 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Tue Jun 03 11:46:46 2008 -0700
@@ -979,7 +979,7 @@
CMPIObjectPath *op;
struct virt_device **_list;
struct virt_device *list;
- int *count;
+ int *count = NULL;
int i;
op = CMGetObjectPath(rasd, &s);
@@ -987,7 +987,8 @@
goto out;
_list = find_list(dominfo, type, &count);
- if ((type == CIM_RES_TYPE_MEM) || (_list != NULL))
+ if ((type == CIM_RES_TYPE_MEM) || (type == CIM_RES_TYPE_PROC) ||
+ (_list != NULL))
list = *_list;
else {
cu_statusf(_BROKER, &s,
@@ -1028,14 +1029,15 @@
struct virt_device **_list;
struct virt_device *list;
struct virt_device *dev;
- int *count;
+ int *count = NULL;
op = CMGetObjectPath(rasd, &s);
if ((op == NULL) || (s.rc != CMPI_RC_OK))
goto out;
_list = find_list(dominfo, type, &count);
- if ((type == CIM_RES_TYPE_MEM) || (_list == NULL)) {
+ if ((type == CIM_RES_TYPE_MEM) || (type == CIM_RES_TYPE_PROC) ||
+ (_list == NULL)) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Cannot add resources of type %" PRIu16, type);
16 years, 5 months
[PATCH] Return an error for type processor in AddResource and RemoveResource
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1212516442 25200
# Node ID bad698c7ab90ec47167f078c4bbf96648351269e
# Parent 0c8d4baf3ee1f6eb96f7d1d49276fa6cc44c4685
Return an error for type processor in AddResource and RemoveResource.
A user should use ModifyResource to change the number of processors.
Also fix a warning caused by this change.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 0c8d4baf3ee1 -r bad698c7ab90 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri May 30 06:57:03 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Tue Jun 03 11:07:22 2008 -0700
@@ -979,7 +979,7 @@
CMPIObjectPath *op;
struct virt_device **_list;
struct virt_device *list;
- int *count;
+ int *count = NULL;
int i;
op = CMGetObjectPath(rasd, &s);
@@ -987,7 +987,8 @@
goto out;
_list = find_list(dominfo, type, &count);
- if ((type == CIM_RES_TYPE_MEM) || (_list != NULL))
+ if ((type == CIM_RES_TYPE_MEM) || (type == CIM_RES_TYPE_PROC) ||
+ (_list != NULL))
list = *_list;
else {
cu_statusf(_BROKER, &s,
@@ -1028,14 +1029,15 @@
struct virt_device **_list;
struct virt_device *list;
struct virt_device *dev;
- int *count;
+ int *count = NULL;
op = CMGetObjectPath(rasd, &s);
if ((op == NULL) || (s.rc != CMPI_RC_OK))
goto out;
_list = find_list(dominfo, type, &count);
- if ((type == CIM_RES_TYPE_MEM) || (_list == NULL)) {
+ if ((type == CIM_RES_TYPE_MEM) || (type == CIM_RES_TYPE_PROC) ||
+ (_list != NULL)) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Cannot add resources of type %" PRIu16, type);
16 years, 5 months
[PATCH] Fix VSMS resource_add so that and additional tag is not added for processor
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1212425931 25200
# Node ID 7cf0b0142edb638ce43cc8f3209eef12b2f5e04b
# Parent 0c8d4baf3ee1f6eb96f7d1d49276fa6cc44c4685
Fix VSMS resource_add so that and additional tag is not added for processor.
The same is also true for memory. Also, be sure not to increment the count for processor and memory since a guest will not have muultiple tags for these devices.
Remove check for memory after find_list(). We don't want to skip this becuase it's possible to update the memory of a defined guest. It is not possible to update the memory of a running guest, but this case is already handled by attach_device() in device_parsing.c
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 0c8d4baf3ee1 -r 7cf0b0142edb src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri May 30 06:57:03 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Mon Jun 02 09:58:51 2008 -0700
@@ -1035,7 +1035,7 @@
goto out;
_list = find_list(dominfo, type, &count);
- if ((type == CIM_RES_TYPE_MEM) || (_list == NULL)) {
+ if (_list == NULL) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Cannot add resources of type %" PRIu16, type);
@@ -1052,22 +1052,36 @@
goto out;
}
- list = realloc(*_list, ((*count)+1)*sizeof(struct virt_device));
- if (list == NULL) {
- /* No memory */
- cu_statusf(_BROKER, &s,
+ if ((type == CIM_RES_TYPE_PROC) || (type == CIM_RES_TYPE_MEM)) {
+ if (_list == NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Cannot modify resource: %" PRIu16, type);
+ goto out;
+ }
+ list = *_list;
+
+ dev = &list[0];
+ } else {
+ list = realloc(*_list, ((*count)+1)*sizeof(struct virt_device));
+ if (list == NULL) {
+ /* No memory */
+ cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Failed to allocate memory");
- goto out;
+ goto out;
+ }
+
+ *_list = list;
+ memset(&list[*count], 0, sizeof(list[*count]));
+
+ dev = &list[*count];
+ dev->type = type;
+ dev->id = strdup(devid);
}
-
- *_list = list;
- memset(&list[*count], 0, sizeof(list[*count]));
-
- dev = &list[*count];
-
dev->type = type;
dev->id = strdup(devid);
+
rasd_to_vdev(rasd, dominfo, dev, ns);
s = _resource_dynamic(dominfo, dev, RESOURCE_ADD, CLASSNAME(op));
@@ -1077,7 +1091,9 @@
cu_statusf(_BROKER, &s,
CMPI_RC_OK,
"");
- (*count)++;
+
+ if ((type != CIM_RES_TYPE_PROC) && (type != CIM_RES_TYPE_MEM))
+ (*count)++;
out:
return s;
16 years, 5 months
[PATCH] [TEST] #2 LXC support using DefineSystem & VSMS.01
by zli@linux.vnet.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1212133201 -28800
# Node ID ddb52ec53368860a18b7e3863b38ea31cb163069
# Parent 5c77329cb53e6340cd6ddbf9c044462fb994eb88
[TEST] #2 LXC support using DefineSystem & VSMS.01
Updates: add the missing address property
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r 5c77329cb53e -r ddb52ec53368 suites/libvirt-cim/cimtest/VirtualSystemManagementService/01_definesystem_name.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/01_definesystem_name.py Fri May 30 14:26:38 2008 +0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/01_definesystem_name.py Fri May 30 15:40:01 2008 +0800
@@ -30,7 +30,7 @@
from CimTest.Globals import do_main
from CimTest.Globals import logger
-SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV']
+SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV', 'LXC']
default_dom = 'test_domain'
@do_main(SUPPORTED_TYPES)
diff -r 5c77329cb53e -r ddb52ec53368 suites/libvirt-cim/lib/XenKvmLib/const.py
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py Fri May 30 14:26:38 2008 +0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Fri May 30 15:40:01 2008 +0800
@@ -85,3 +85,4 @@
#vxml.LXCXML
LXC_init_path = os.path.join(_image_dir, 'cimtest_lxc_init')
LXC_default_tty = '/dev/ptmx'
+LXC_default_mp = '/tmp'
diff -r 5c77329cb53e -r ddb52ec53368 suites/libvirt-cim/lib/XenKvmLib/vsms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Fri May 30 14:26:38 2008 +0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Fri May 30 15:40:01 2008 +0800
@@ -102,6 +102,8 @@
self.isFullVirt = (type == 'KVM' or virt == 'XenFV')
if self.isFullVirt:
self.BootDevice = 'hd'
+ elif type == 'LXC':
+ self.InitPath = const.LXC_init_path
else:
self.Bootloader = live.bootloader(Globals.CIM_IP, 0)
self.BootloaderArgs = ''
@@ -113,6 +115,9 @@
pass
class KVM_VirtualSystemSettingData(CIM_VirtualSystemSettingData):
+ pass
+
+class LXC_VirtualSystemSettingData(CIM_VirtualSystemSettingData):
pass
@eval_cls('VirtualSystemSettingData')
@@ -134,6 +139,12 @@
class KVM_DiskResourceAllocationSettingData(CIM_DiskResourceAllocationSettingData):
pass
+
+class LXC_DiskResourceAllocationSettingData(CIMClassMOF):
+ def __init__(self, mountpoint, source, name):
+ self.MountPoint = mountpoint
+ self.Address = source
+ self.InstanceID = '%s/%s' % (name, mountpoint)
@eval_cls('DiskResourceAllocationSettingData')
def get_dasd_class(virt):
@@ -157,6 +168,9 @@
class KVM_NetResourceAllocationSettingData(CIM_NetResourceAllocationSettingData):
pass
+class LXC_NetResourceAllocationSettingData(CIM_NetResourceAllocationSettingData):
+ pass
+
@eval_cls('NetResourceAllocationSettingData')
def get_nasd_class(virt):
pass
@@ -175,6 +189,9 @@
pass
class KVM_ProcResourceAllocationSettingData(CIM_ProcResourceAllocationSettingData):
+ pass
+
+class LXC_ProcResourceAllocationSettingData(CIM_ProcResourceAllocationSettingData):
pass
@eval_cls('ProcResourceAllocationSettingData')
@@ -197,6 +214,9 @@
class KVM_MemResourceAllocationSettingData(CIM_MemResourceAllocationSettingData):
pass
+class LXC_MemResourceAllocationSettingData(CIM_MemResourceAllocationSettingData):
+ pass
+
@eval_cls('MemResourceAllocationSettingData')
def get_masd_class(virt):
pass
@@ -212,17 +232,25 @@
class_vssd = get_vssd_class(virt)
vssd = class_vssd(name=dom_name, virt=virt)
- class_dasd = get_dasd_class(virt)
- if virt == 'KVM':
- disk_dev = 'hda'
- disk_source = const.KVM_disk_path
- elif virt == 'XenFV':
- disk_dev = 'hda'
- disk_source = const.XenFV_disk_path
- d = class_dasd(
- dev=disk_dev,
- source=disk_source,
- name=dom_name)
+ # LXC only takes disk and memory device for now.
+ # Only disk __init__ takes different params.
+ if virt == 'LXC':
+ d = LXC_DiskResourceAllocationSettingData(
+ mountpoint=const.LXC_default_mp,
+ source=const.LXC_default_mp, name=dom_name)
+ else:
+ class_dasd = get_dasd_class(virt)
+ if virt == 'KVM':
+ disk_dev = 'hda'
+ disk_source = const.KVM_disk_path
+ elif virt == 'XenFV':
+ disk_dev = 'hda'
+ disk_source = const.XenFV_disk_path
+ d = class_dasd(
+ dev=disk_dev,
+ source=disk_source,
+ name=dom_name)
+
class_nasd = get_nasd_class(virt)
if virt == 'KVM':
net_mac= const.KVM_default_mac
16 years, 5 months
[PATCH] [TEST] Adding set_interface_details() fn to the vxml.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1212493242 25200
# Node ID 05e8d5b17fd7e4d7eb3a6f1903fd834fcebcd311
# Parent 351d11163eaa0b0af28a9064177ad637aeeb2a8c
[TEST] Adding set_interface_details() fn to the vxml.py.
This function give choice to add different network types to
Xen/XenFV/KVM guest.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 351d11163eaa -r 05e8d5b17fd7 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Fri May 30 10:47:26 2008 +0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Jun 03 04:40:42 2008 -0700
@@ -300,6 +300,10 @@ class VirtXML(Virsh, XMLClass):
self.set_attributes('/domain/devices/interface/source',
bridge=bridgename)
+ def set_nettype(self, nettype):
+ self.set_attributes('/domain/devices/interface/type',
+ type=nettype)
+
def set_diskimg(self, diskimg):
self.set_attributes('/domain/devices/disk/source', file=diskimg)
@@ -437,6 +441,39 @@ class VirtXML(Virsh, XMLClass):
return vbr
+ def set_interface_details(self, devices, net_mac, net_type, req_net_type, virt_type):
+ if net_type != req_net_type:
+ interface = self.add_sub_node(devices, 'interface', type=req_net_type)
+ else:
+ interface = self.add_sub_node(devices, 'interface', type=net_type)
+ self.add_sub_node(interface, 'mac', address=net_mac)
+ if req_net_type == 'bridge':
+ self._set_vbridge(CIM_IP, virt_type)
+ elif req_net_type == 'network':
+ self.set_vnetwork(interface, virt_type)
+ elif req_net_type == 'ethernet':
+ pass
+ else:
+ logger.error("%s is not a valid network type", net_type)
+ sys.exit(1)
+
+ def set_vnetwork(self, interface, virt_type):
+ network_list = live.net_list(CIM_IP, virt_type)
+ if len(network_list) > 0:
+ nname = network_list[0]
+ else:
+ logger.info('No virutal network found')
+ logger.info('Trying to create one ......')
+ netxml = NetXML(CIM_IP, virt_type)
+ ret = netxml.create_vnet()
+ if not ret:
+ logger.error('Failed to create the virtual network "%s"',
+ netxml.net_name)
+ sys.exit(SKIP)
+ nname = netxml.xml_get_netpool_name()
+ self.add_sub_node(interface, 'source', network=nname)
+
+
class VirtCIM:
def __init__(self, virt, dom_name, disk_dev, disk_source,
@@ -497,7 +534,8 @@ class XenXML(VirtXML, VirtCIM):
vcpus=const.default_vcpus,
mac=const.Xen_default_mac,
disk_file_path=const.Xen_disk_path,
- disk=const.Xen_default_disk_dev):
+ disk=const.Xen_default_disk_dev,
+ req_nettype=const.Xen_default_net_type):
if not (os.path.exists(const.Xen_kernel_path) \
and os.path.exists(const.Xen_init_path)):
logger.error('ERROR: Either the kernel image '
@@ -505,7 +543,8 @@ class XenXML(VirtXML, VirtCIM):
sys.exit(1)
VirtXML.__init__(self, 'xen', test_dom, set_uuid(), mem, vcpus)
self._os(const.Xen_kernel_path, const.Xen_init_path)
- self._devices(disk_file_path, disk, const.Xen_default_net_type, mac)
+ self._devices(disk_file_path, disk, const.Xen_default_net_type, mac,
+ req_nettype)
VirtCIM.__init__(self, 'Xen', test_dom, disk, disk_file_path,
const.Xen_default_net_type, mac, vcpus, mem)
@@ -517,16 +556,15 @@ class XenXML(VirtXML, VirtCIM):
self.add_sub_node(os, 'initrd', os_initrd)
self.add_sub_node(os, 'cmdline', 'TERM=xterm')
- def _devices(self, disk_img, disk_dev, net_type, net_mac):
+ def _devices(self, disk_img, disk_dev, net_type, net_mac, req_nettype):
devices = self.get_node('/domain/devices')
disk = self.add_sub_node(devices, 'disk', type='file', device='disk')
self.add_sub_node(disk, 'driver', name='file')
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=net_type)
- self.add_sub_node(interface, 'mac', address=net_mac)
+ self.set_interface_details(devices, net_mac, net_type, req_nettype,
+ virt_type='Xen')
def set_bootloader(self, ip, gtype=0):
bldr = live.bootloader(ip, gtype)
@@ -552,19 +590,20 @@ class KVMXML(VirtXML):
vcpus=const.default_vcpus,
mac=const.KVM_default_mac,
disk_file_path=const.KVM_disk_path,
- disk=const.KVM_default_disk_dev):
+ disk=const.KVM_default_disk_dev,
+ req_nettype=const.KVM_default_net_type):
if not os.path.exists(disk_file_path):
logger.error('Error: Disk image does not exist')
sys.exit(1)
VirtXML.__init__(self, 'kvm', test_dom, set_uuid(), mem, vcpus)
self._os()
self._devices(const.KVM_default_emulator, const.KVM_default_net_type,
- disk_file_path, disk, mac)
+ disk_file_path, disk, mac, req_nettype)
def _os(self):
self.add_sub_node('/domain/os', 'type', 'hvm')
- def _devices(self, emu, net_type, disk_img, disk_dev, net_mac):
+ def _devices(self, emu, net_type, disk_img, disk_dev, net_mac, req_nettype):
devices = self.get_node('/domain/devices')
self.add_sub_node(devices, 'emulator', emu)
@@ -572,33 +611,9 @@ 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=net_type)
- self.add_sub_node(interface, 'mac', address=net_mac)
+ self.set_interface_details(devices, net_mac, net_type, req_nettype,
+ virt_type='KVM')
- if net_type == 'bridge':
- self.set_vbridge(CIM_IP)
- elif net_type == 'network':
- self.set_vnetwork(interface)
- else:
- logger.error("%s is not a valid network type", net_type)
- sys.exit(1)
-
- def set_vnetwork(self, interface):
- network_list = live.net_list(CIM_IP, virt='KVM')
- if len(network_list) > 0:
- nname = network_list[0]
- else:
- logger.info('No virutal network found')
- logger.info('Trying to create one ......')
- netxml = NetXML(CIM_IP, virt='KVM')
- ret = netxml.create_vnet()
- if not ret:
- logger.error('Failed to create the virtual network "%s"',
- netxml.net_name)
- sys.exit(SKIP)
- nname = netxml.xml_get_netpool_name()
- self.add_sub_node(interface, 'source', network=nname)
-
def set_emulator(self, emu):
return self._set_emulator(emu)
@@ -618,14 +633,16 @@ class XenFVXML(VirtXML):
vcpus=const.default_vcpus,
mac=const.XenFV_default_mac,
disk_file_path=const.XenFV_disk_path,
- disk=const.XenFV_default_disk_dev):
+ disk=const.XenFV_default_disk_dev,
+ req_nettype=const.XenFV_default_net_type):
if not os.path.exists(disk_file_path):
logger.error('Error: Disk image does not exist')
sys.exit(1)
VirtXML.__init__(self, 'xen', test_dom, set_uuid(), mem, vcpus)
self._os(const.XenFV_default_loader)
self._devices(const.XenFV_default_emulator,
- const.XenFV_default_net_type, mac, disk_file_path, disk)
+ const.XenFV_default_net_type, mac, disk_file_path,
+ disk, req_nettype)
def _os(self, os_loader):
os = self.get_node('/domain/os')
@@ -633,18 +650,16 @@ class XenFVXML(VirtXML):
self.add_sub_node(os, 'loader', os_loader)
self.add_sub_node(os, 'boot', dev='hd')
- def _devices(self, emu, net_type, net_mac, disk_img, disk_dev):
+ def _devices(self, emu, net_type, net_mac, disk_img, disk_dev,
+ req_nettype):
devices = self.get_node('/domain/devices')
self.add_sub_node(devices, 'emulator', emu)
-
- interface = self.add_sub_node(devices, 'interface', type=net_type)
- self.add_sub_node(interface, 'mac', address=net_mac)
- self.set_bridge(CIM_IP)
-
disk = self.add_sub_node(devices, 'disk', type='file')
self.add_sub_node(disk, 'source', file=disk_img)
self.add_sub_node(disk, 'target', dev=disk_dev)
+ self.set_interface_details(devices, net_mac, net_type, req_nettype,
+ virt_type='XenFV')
def set_emulator(self, emu):
return self._set_emulator(emu)
16 years, 5 months
[PATCH] [TEST] Update ResourcePoolConfigurationService.01&02 for LXC support
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1212478509 -28800
# Node ID 05b78b7632d59087df9076e09ffb10978d5f3bf4
# Parent 351d11163eaa0b0af28a9064177ad637aeeb2a8c
[TEST] Update ResourcePoolConfigurationService.01&02 for LXC support
diff -r 351d11163eaa -r 05b78b7632d5 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/01_enum.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/01_enum.py Fri May 30 10:47:26 2008 +0800
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/01_enum.py Tue Jun 03 15:35:09 2008 +0800
@@ -31,6 +31,7 @@
from CimTest.Globals import do_main, platform_sup
from XenKvmLib.classes import get_typed_class
+platform_sup = ['Xen', 'KVM', 'XenFV', 'LXC']
@do_main(platform_sup)
def main():
options = main.options
diff -r 351d11163eaa -r 05b78b7632d5 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/02_rcps_gi_errors.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/02_rcps_gi_errors.py Fri May 30 10:47:26 2008 +0800
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/02_rcps_gi_errors.py Tue Jun 03 15:35:09 2008 +0800
@@ -35,6 +35,7 @@
from XenKvmLib.classes import get_typed_class
+platform_sup = ['Xen', 'KVM', 'XenFV', 'LXC']
expr_values = {
"invalid_sysname" : { 'rc' : pywbem.CIM_ERR_NOT_FOUND, \
'desc' : 'No such instance (SystemName)' }, \
16 years, 5 months