[PATCH] [TEST] Fix VirtualSystemManagementService/05_destroysystem_neg.py with provider's updates of error message
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1236912499 25200
# Node ID 6e1a1d69588b34117d087a3f8c9e8dbc50618f9b
# Parent 676a8b05baa09b69052d519c7b438b301bea849c
[TEST] Fix VirtualSystemManagementService/05_destroysystem_neg.py with provider's updates of error message
Tested for KVM with current sources and rpm
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 676a8b05baa0 -r 6e1a1d69588b suites/libvirt-cim/cimtest/VirtualSystemManagementService/05_destroysystem_neg.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/05_destroysystem_neg.py Tue Mar 10 22:27:59 2009 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/05_destroysystem_neg.py Thu Mar 12 19:48:19 2009 -0700
@@ -29,16 +29,18 @@
from XenKvmLib.classes import get_typed_class
from XenKvmLib.test_doms import undefine_test_domain
from CimTest.Globals import logger
-from XenKvmLib.const import do_main
+from XenKvmLib.const import do_main, get_provider_version
from CimTest.ReturnCodes import FAIL, PASS, SKIP
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
vsms_status_version = 534
+vsms_err_message = 814
def destroysystem_fail(tc, options):
service = vsms.get_vsms_class(options.virt)(options.ip)
classname = get_typed_class(options.virt, 'ComputerSystem')
+ curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
if tc == 'noname':
cs_ref = CIMInstanceName(classname,
@@ -47,6 +49,10 @@
exp_value = { 'rc' : pywbem.CIM_ERR_FAILED,
'desc' : 'Unable to retrieve domain name.'
}
+ if curr_cim_rev >= vsms_err_message:
+ exp_value = { 'rc' : pywbem.CIM_ERR_NOT_FOUND,
+ 'desc' : 'Unable to retrieve domain name: Error 0'
+ }
elif tc == 'nonexistent':
cs_ref = CIMInstanceName(classname,keybindings = {
@@ -56,6 +62,10 @@
exp_value = { 'rc' : pywbem.CIM_ERR_FAILED,
'desc' : 'Failed to find domain'
}
+ if curr_cim_rev >= vsms_err_message:
+ exp_value = { 'rc' : pywbem.CIM_ERR_NOT_FOUND,
+ 'desc' : "Referenced domain `##@@!!cimtest_domain'" \
+ " does not exist: Domain not found"}
else:
return SKIP
@@ -68,7 +78,7 @@
err_no = details[0]
err_desc = details[1]
if err_no == exp_value['rc'] and err_desc.find(exp_value['desc']) >= 0:
- logger.error("For Invalid Scenario '%s'", tc)
+ logger.info("For Invalid Scenario '%s'", tc)
logger.info('Got expected error no: %s', err_no)
logger.info('Got expected error desc: %s',err_desc)
return PASS
@@ -82,7 +92,7 @@
options = main.options
rc1 = destroysystem_fail('noname', options)
rc2 = destroysystem_fail('nonexistent', options)
-
+
status = FAIL
if rc1 == PASS and rc2 == PASS:
status = PASS
15 years, 9 months
[PATCH] [TEST] In cim_state_change(), return FAIL since status isn't set yet
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1236890998 25200
# Node ID 0529bffff3f4a6f739e2589e42f5406cc1296b51
# Parent ab10caadc452bc5413f7776a978214241b6ae2f9
[TEST] In cim_state_change(), return FAIL since status isn't set yet.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r ab10caadc452 -r 0529bffff3f4 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Thu Mar 12 13:45:00 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Thu Mar 12 13:49:58 2009 -0700
@@ -610,7 +610,7 @@
keys = { 'Name' : self.domain_name, 'CreationClassName' : cs_class }
cs = GetInstance(server, cs_class, keys)
if cs is None or cs.Name != self.domain_name:
- return status
+ return FAIL
try:
req_state_change = pywbem.cim_types.Uint16(req_state)
15 years, 9 months
Re: [Fwd: Re: [Libvirt-cim] Test Run Summary (Mar 09 2009): KVM on Fedora release 10 (Cambridge) with sfcb]
by Guo Lian Yun
Kaitlin Rupert <kaitlin(a)linux.vnet.ibm.com> wrote on 2009-03-12 11:08:30:
> Just in case you missed it on the list..
>
> These messages you're seeing are expected failures. The test case is
> trying to destroy a guest that no longer exists. So you would expect to
> see errors in the provider debug, right?
I debug the provider and get the error message. This failure because of
the error message updates in VSMS provider. I send a patch with fix.
Thanks for all your help =)
Now, all the test failures are fixed for KVM. I will continue to cook up
the new test cases to verify VSMS.RemoveResourceSettings(). On the next,
I will start to fix failures for Xen/XenFV.
> --
> Kaitlin Rupert
> IBM Linux Technology Center
> kaitlin(a)linux.vnet.ibm.com
>
> ----- Message from Deepti B Kalakeri <deeptik(a)linux.vnet.ibm.com> on
> Mon, 09 Mar 2009 19:51:17 +0530 -----
>
> To:
>
> List for discussion and development of libvirt CIM
<libvirt-cim(a)redhat.com>
>
> Subject:
>
> Re: [Libvirt-cim] Test Run Summary (Mar 09 2009): KVM on Fedora
> release 10 (Cambridge) with sfcb
>
>
>
> Guo Lian Yun wrote:
> >
> > libvirt-cim-bounces(a)redhat.com wrote on 2009-03-09 10:45:59:
> >
> > >
> > > libvirt-cim-bounces(a)redhat.com wrote on 2009-03-09 09:45:08:
> > >
> > > >
> > > >
> > > > =================================================
> > > > Test Run Summary (Mar 09 2009): KVM on Fedora release 10
> > > (Cambridge)with sfcb
> > > > =================================================
> > > > Distro: Fedora release 10 (Cambridge)
> > > > Kernel: 2.6.27.15-170.2.24.fc10.x86_64
> > > > libvirt: 0.4.5
> > > > Hypervisor: QEMU 0.9.1
> > > > CIMOM: sfcb sfcbd 1.3.3preview
> > > > Libvirt-cim revision: 829
> > > > Libvirt-cim changeset: 1aff0d0e9bf4
> > > > Cimtest revision: 642
> > > > Cimtest changeset: 087aaba26589
> > > > =================================================
> > > > FAIL : 4
> > > > XFAIL : 3
> > > > SKIP : 5
> > > > PASS : 134
> > > > -----------------
> > > > Total : 146
> > > > =================================================
> > > > FAIL Test Summary:
> > > > ElementCapabilities - 03_forward_errs.py: FAIL
> > > I've sent a patch with fix.
> > >
> > > > ElementConforms - 01_forward.py: FAIL
> > > Same as above.
> > >
> > > > ElementConforms - 04_ectp_rev_errs.py: FAIL
> > > Same as above.
> > >
> > > > VirtualSystemManagementService - 05_destroysystem_neg.py: FAIL
> >
> > It seems this failure because that the provider has to free the
> > nonexistent domain in
> > invoking method DestroySystem.
> >
> > Here is the debugger error in sfcb:
> > libvir: Domain error : invalid domain pointer in virDomainFree
> > libvir: QEMU error : Domain not found
> > libvir: Domain error : invalid domain pointer in virDomainFree
> Daisy,
>
> The test case is written to verify the DestroySystem() returns an error
> when trying to remove non-existing domain
> and also when an invalid domain name is passed.
> The error statements returned seems to have changed.
>
> For ex:
> The err desc for DestroySystem() when non-existing domain is passed was
> previously
> CIM_ERR_FAILED:Unable to retrieve domain name
>
> is now changed to CIM_ERR_NOT_FOUND: Unable to retrieve domain name:
> Error 0
>
> We need to change the way the error comparison is made.
> The comparison stmt like
>
> if err_desc.find(exp_value['desc']) >= 0: does not work, but
> if exp_value['desc'] in err_desc: works
>
> --
> Thanks and Regards,
> Deepti B. Kalakeri
> IBM Linux Technology Center
> deeptik(a)linux.vnet.ibm.com
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim(a)redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
15 years, 9 months
[PATCH] [TEST] Make sure network pool is created with a random IP
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1236818181 25200
# Node ID abe81a5626e7959f17e51c52a29003aa31ff6e41
# Parent 5c33dc7241b63d77428d7f5e852df69d48c2cb50
[TEST] Make sure network pool is created with a random IP.
This will help prevent overlap with existing networks. However, this won't
completely prevent the issue. We'd need to do test to see if the IP address
is already used by a different network. If the network is in use, then another
IP address should be used.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 5c33dc7241b6 -r abe81a5626e7 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Thu Dec 18 14:10:33 2008 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Mar 11 17:36:21 2009 -0700
@@ -32,6 +32,7 @@
# shared by XenXML & KVMXML.
import os
import sys
+import random
import platform
import tempfile
from time import sleep
@@ -182,7 +183,6 @@
def get_valid_bridge_name(server):
bridge_list = live.available_bridges(server)
if bridgename in bridge_list:
- import random
vbr = bridgename + str(random.randint(1, 100))
if vbr in bridge_list:
logger.error('Need to give different bridge name '
@@ -210,10 +210,14 @@
subnet = '192.168.122.'
self.add_sub_node(network, 'bridge', name=self.vbr, stp='on',
forwardDelay='0')
- ip = self.add_sub_node(network, 'ip', address=subnet+'1',
+ ip_base = random.randint(1, 100)
+ addr = address=subnet+'%d' % ip_base
+
+ ip = self.add_sub_node(network, 'ip', address=address,
netmask='255.255.255.0')
dhcp = self.add_sub_node(ip, 'dhcp')
- self.add_sub_node(dhcp, 'range', start=subnet+'2',
+ range_addr = subnet+'%d' % (ip_base + 1)
+ self.add_sub_node(dhcp, 'range', start=range_addr,
end=subnet+'254')
def create_vnet(self):
15 years, 9 months
[PATCH] [TEST]#4 Fix ElementCapabilities/03_forward_errs.py with provider's updated err message
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1236749279 25200
# Node ID 676a8b05baa09b69052d519c7b438b301bea849c
# Parent a78b6f23ebaa8a38fa591e420d742aa03cd9e515
[TEST]#4 Fix ElementCapabilities/03_forward_errs.py with provider's updated err message
Updates from 3 to 4:
Define exp_desc and exp_rc inside of main()
Updates from 2 to 3:
Get correct CS Name instead of hard code of "Xen_ComputerSystem"
Updates from 1 to 2:
Use a variable to assign revision value to be calculated for comparison
Also fix the line to meet 80 length
Tested for KVM/LXC with current sources and rpm
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r a78b6f23ebaa -r 676a8b05baa0 suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Mon Mar 09 00:27:12 2009 -0700
+++ b/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Tue Mar 10 22:27:59 2009 -0700
@@ -27,13 +27,11 @@
from XenKvmLib import enumclass
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS
-from XenKvmLib.const import do_main
+from XenKvmLib.const import do_main, get_provider_version
from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
-
-exp_rc = 6 #CIM_ERR_NOT_FOUND
-exp_desc = "No such instance"
+libvirt_ec_changes = 815
def try_assoc(ref, ref_class, exp_rc, exp_desc, options):
conn = assoc.myWBEMConnection('http://%s' % options.ip,
@@ -42,23 +40,24 @@
status = FAIL
rc = -1
names = []
-
+ ec = get_typed_class(options.virt, "ElementCapabilities")
try:
- names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities"))
+ names = conn.AssociatorNames(ref, AssocClass = ec)
rc = 0
except pywbem.CIMError, (rc, desc):
if rc == exp_rc and desc.find(exp_desc) >= 0:
logger.info("Got expected rc code and error string")
status = PASS
else:
- logger.error("Unexpected rc code %s and description %s\n", rc, desc)
+ logger.error("Unexpected rc code %s and description %s\n", rc,
+ desc)
except Exception, details:
logger.error("Unknown exception happened")
logger.error(details)
if rc == 0:
- logger.error("ElementCapabilities associator should NOT return excepted \
- result with a wrong key name and value of %s input", ref_class)
+ logger.error("ElementCapabilities associator should NOT" \
+ " return records with a wrong key name and value")
status = FAIL
return status
@@ -66,6 +65,9 @@
@do_main(sup_types)
def main():
+ exp_rc = 6 #CIM_ERR_NOT_FOUND
+ exp_desc = "No such instance"
+
options = main.options
rc = PASS
@@ -73,7 +75,8 @@
cs = get_typed_class(options.virt, "ComputerSystem")
instanceref = CIMInstanceName(hs,
- keybindings = {"Name" : "wrong", "CreationClassName" : "wrong"})
+ keybindings = {"Name" : "wrong",
+ "CreationClassName" : "wrong"})
rc = try_assoc(instanceref, hs, exp_rc, exp_desc, options)
if rc != PASS:
@@ -81,7 +84,13 @@
return status
instance_cs = CIMInstanceName(cs,
- keybindings = {"Name" : "wrong", "CreationClassName" : "Xen_ComputerSystem"})
+ keybindings = {"Name" : "wrong",
+ "CreationClassName" : cs})
+
+ curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
+ if curr_cim_rev >= libvirt_ec_changes:
+ exp_desc = "Referenced domain `wrong' does not exist:" \
+ " Domain not found"
rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
if rc != PASS:
status = FAIL
15 years, 9 months
[PATCH]
by Richard Maciel
# HG changeset patch
# User Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
# Date 1236119796 10800
# Node ID 98c21125d5e24022750fa1adf12289bbbbb5a9df
# Parent 1aff0d0e9bf49e738827b7157c0df407b814ae7d
#2 Changed the output of AllocationCapability association when using DiskPool as input
This patch fix the results of a 'association instances' query when passing a disk pool AllocationCapabilities reference as input. Before this patch, this query returned RASD templates for the disk pools, but now it returns the RASD templates for each of the volumes which composes the disk pool passed as input.
2:
- Changed code style based on feedback
- When emulation_type = 1 (cdrom device), the VirtualQuantity property of the template is not set
- Changed ID of cdrom device
- LXC is handled in a special way, because it doesn't have volumes
To test:
- Create a domain containing a diskpool and some volumes
- Execute query: wbemcli ein 'http://localhost:5988/root/virt:CIM_AllocationCapabilities'
- Select the reference to a diskpool and use in an association query like the one below:
wbemcli ai -nl -ac KVM_SettingsDefineCapabilities 'http://@localhost:5988/root/virt:KVM_AllocationCapabilities.InstanceID="DiskPool/default"'
- There must be four templates for each volume in the diskpool (MINIMUM, MAXIMUM, DEFAULT, INCREMENT) and their address must correspond to the address of the volume
Signed-off-by: Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
diff -r 1aff0d0e9bf4 -r 98c21125d5e2 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Wed Mar 04 15:25:33 2009 -0800
+++ b/src/Virt_SettingsDefineCapabilities.c Tue Mar 03 19:36:36 2009 -0300
@@ -562,71 +562,23 @@
return s;
}
-static int get_disk_freespace(const CMPIObjectPath *ref,
- CMPIStatus *s,
- uint64_t *free_space)
-{
- bool ret = false;
- const char *inst_id;
- CMPIrc prop_ret;
- virConnectPtr conn;
- CMPIInstance *pool_inst;
-
- if (cu_get_str_path(ref, "InstanceID", &inst_id) != CMPI_RC_OK) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Could not get InstanceID");
- goto out;
- }
-
- conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
- if (s->rc != CMPI_RC_OK) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Could not get connection");
- goto out;
- }
-
- /* Getting the relevant resource pool directly finds the free space
- * for us. It is in the Capacity field. */
- *s = get_pool_by_name(_BROKER, ref, inst_id, &pool_inst);
- if (s->rc != CMPI_RC_OK)
- goto out;
-
- prop_ret = cu_get_u64_prop(pool_inst, "Capacity", free_space);
- if (prop_ret != CMPI_RC_OK) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Could not get capacity from instance");
- goto out;
- }
-
- CU_DEBUG("Got capacity from pool_inst: %lld", *free_space);
- ret = true;
-
- out:
- return ret;
-}
-
static CMPIStatus set_disk_props(int type,
const CMPIObjectPath *ref,
const char *id,
+ const char *disk_path,
uint64_t disk_size,
uint16_t emu_type,
struct inst_list *list)
{
- const char *addr;
const char *dev;
CMPIInstance *inst;
CMPIStatus s = {CMPI_RC_OK, NULL};
if (type == DOMAIN_LXC) {
- addr = "/tmp";
dev = "/lxc_mnt/tmp";
}
else {
dev = "hda";
- addr = "/dev/null";
}
inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_DISK);
@@ -636,13 +588,15 @@
CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
CMSetProperty(inst, "AllocationQuantity",
(CMPIValue *)"MegaBytes", CMPI_chars);
- CMSetProperty(inst, "VirtualQuantity",
- (CMPIValue *)&disk_size, CMPI_uint64);
- CMSetProperty(inst, "Address", (CMPIValue *)addr, CMPI_chars);
+ CMSetProperty(inst, "Address", (CMPIValue *)disk_path, CMPI_chars);
if (type == DOMAIN_LXC)
CMSetProperty(inst, "MountPoint", (CMPIValue *)dev, CMPI_chars);
else {
+ if (emu_type == 0)
+ CMSetProperty(inst, "VirtualQuantity",
+ (CMPIValue *)&disk_size, CMPI_uint64);
+
if (type == DOMAIN_XENPV) {
dev = "xvda";
CMSetProperty(inst, "Caption",
@@ -664,34 +618,116 @@
return s;
}
-static CMPIStatus disk_template(const CMPIObjectPath *ref,
- int template_type,
- struct inst_list *list)
+static CMPIStatus cdrom_template(const CMPIObjectPath *ref,
+ int template_type,
+ struct inst_list *list)
{
- bool ret;
char *pfx;
const char *id;
- uint64_t disk_size;
- uint16_t emu_type = 0;
+ char *vol_path;
+ uint64_t vol_size = 0;
CMPIStatus s = {CMPI_RC_OK, NULL};
+ uint16_t emu_type = 1;
switch(template_type) {
case SDC_RASD_MIN:
- disk_size = SDC_DISK_MIN;
+ id = "Minimum CDROM";
+ break;
+ case SDC_RASD_MAX:
+ id = "Maximum CDROM";
+ break;
+ case SDC_RASD_INC:
+ id = "Increment CDROM";
+ break;
+ case SDC_RASD_DEF:
+ id = "Default CDROM";
+ break;
+ default:
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unsupported sdc_rasd type");
+ goto out;
+ }
+
+ vol_path = "/dev/null";
+
+ pfx = class_prefix_name(CLASSNAME(ref));
+
+ if (STREQ(pfx, "Xen")) {
+ int xen_type[2] = {DOMAIN_XENFV, DOMAIN_XENPV};
+ int i = 0;
+
+ for (; i < 2; i++) {
+ s = set_disk_props(xen_type[i],
+ ref,
+ id,
+ vol_path,
+ vol_size,
+ emu_type,
+ list);
+ }
+ } else if (STREQ(pfx, "KVM")) {
+ s = set_disk_props(DOMAIN_KVM,
+ ref,
+ id,
+ vol_path,
+ vol_size,
+ emu_type,
+ list);
+
+ } else if (!STREQ(pfx, "LXC")){
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unsupported virtualization type");
+ }
+
+ out:
+ return s;
+
+}
+
+
+static CMPIStatus volume_template(const CMPIObjectPath *ref,
+ int template_type,
+ virStorageVolPtr volume_ptr,
+ struct inst_list *list)
+{
+ char *pfx;
+ const char *id;
+ char *vol_path;
+ uint64_t vol_size;
+ virStorageVolInfo vol_info;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ int ret;
+ uint16_t emu_type = 0;
+
+ ret = virStorageVolGetInfo(volume_ptr, &vol_info);
+ if (ret == -1) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ virStorageVolGetConnect(volume_ptr),
+ "Unable to get volume information");
+ goto out;
+ }
+
+ switch(template_type) {
+ case SDC_RASD_MIN:
+ if (SDC_DISK_MIN > (uint64_t)vol_info.capacity)
+ vol_size = (uint64_t)vol_info.capacity;
+ else
+ vol_size = SDC_DISK_MIN;
id = "Minimum";
break;
case SDC_RASD_MAX:
- ret = get_disk_freespace(ref, &s, &disk_size);
- if (!ret)
- goto out;
+ vol_size = (uint64_t)vol_info.capacity;
id = "Maximum";
break;
case SDC_RASD_INC:
- disk_size = SDC_DISK_INC;
+ vol_size = SDC_DISK_INC;
id = "Increment";
break;
case SDC_RASD_DEF:
- disk_size = SDC_DISK_DEF;
+ vol_size = (uint64_t)vol_info.allocation;
id = "Default";
break;
default:
@@ -701,6 +737,15 @@
goto out;
}
+ vol_path = virStorageVolGetPath(volume_ptr);
+ if (vol_path == NULL) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ virStorageVolGetConnect(volume_ptr),
+ "Unable to get volume path");
+ goto out;
+ }
+
pfx = class_prefix_name(CLASSNAME(ref));
if (STREQ(pfx, "Xen")) {
@@ -708,48 +753,20 @@
int i = 0;
for (; i < 2; i++) {
- emu_type = 0;
s = set_disk_props(xen_type[i],
ref,
- id,
- disk_size,
+ id,
+ vol_path,
+ vol_size,
emu_type,
list);
- if (s.rc != CMPI_RC_OK)
- goto out;
-
- emu_type = 1;
- s = set_disk_props(xen_type[i],
- ref,
- id,
- disk_size,
- emu_type,
- list);
- if (s.rc != CMPI_RC_OK)
- goto out;
}
} else if (STREQ(pfx, "KVM")) {
s = set_disk_props(DOMAIN_KVM,
ref,
- id,
- disk_size,
- emu_type,
- list);
- if (s.rc != CMPI_RC_OK)
- goto out;
-
- emu_type = 1;
- s = set_disk_props(DOMAIN_KVM,
- ref,
- id,
- disk_size,
- emu_type,
- list);
- } else if (STREQ(pfx, "LXC")) {
- s = set_disk_props(DOMAIN_LXC,
- ref,
- id,
- disk_size,
+ id,
+ vol_path,
+ vol_size,
emu_type,
list);
} else {
@@ -762,6 +779,157 @@
return s;
}
+static CMPIStatus lxc_template(const CMPIObjectPath *ref,
+ int template_type,
+ struct inst_list *list)
+{
+ uint64_t vol_size = 0;
+ int emu_type = 0;
+ char *vol_path = "/tmp";
+ const char *id;
+
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+
+ switch(template_type) {
+ case SDC_RASD_MIN:
+ id = "Minimum";
+ break;
+ case SDC_RASD_MAX:
+ id = "Maximum";
+ break;
+ case SDC_RASD_INC:
+ id = "Increment";
+ break;
+ case SDC_RASD_DEF:
+ id = "Default";
+ break;
+ default:
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unsupported sdc_rasd type");
+ goto out;
+ }
+
+ s = set_disk_props(DOMAIN_LXC,
+ ref,
+ id,
+ vol_path,
+ vol_size,
+ emu_type,
+ list);
+
+ out:
+ return s;
+
+}
+
+static CMPIStatus disk_template(const CMPIObjectPath *ref,
+ int template_type,
+ struct inst_list *list)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ virConnectPtr conn = NULL;
+ virStoragePoolPtr poolptr = NULL;
+ virStorageVolPtr volptr = NULL;
+ const char *instid = NULL;
+ char *host = NULL;
+ const char *poolname = NULL;
+ char **volnames = NULL;
+ int numvols = 0;
+ int numvolsret = 0;
+ int i;
+ char *pfx = NULL;
+
+ pfx = class_prefix_name(CLASSNAME(ref));
+ if (STREQ(pfx, "LXC")) {
+ s = lxc_template(ref, template_type, list);
+ goto out;
+ }
+
+ conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
+
+ if (cu_get_str_path(ref, "InstanceID", &instid) != CMPI_RC_OK) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to get InstanceID for disk device");
+ goto out;
+ }
+
+ if (parse_fq_devid(instid, &host, (char **)&poolname) != 1) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to get pool device id");
+ goto out;
+ }
+
+ if ((poolptr = virStoragePoolLookupByName(conn, poolname)) == NULL) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Storage pool `%s' not found",
+ poolname);
+ goto out;
+ }
+
+ if ((numvols = virStoragePoolNumOfVolumes(poolptr)) == -1) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ conn,
+ "Unable to get the number of volumes \
+ of storage pool `%s'",
+ poolname);
+ goto out;
+ }
+
+ volnames = (char **)malloc(sizeof(char *) * numvols);
+ if (volnames == NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Could not allocate space for list of volumes \
+ of storage pool `%s'",
+ poolname);
+ goto out;
+ }
+
+ numvolsret = virStoragePoolListVolumes(poolptr, volnames, numvols);
+
+ if (numvolsret == -1) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ conn,
+ "Unable to get a pointer to volumes \
+ of storage pool `%s'",
+ poolname);
+ goto out;
+ }
+
+ for (i = 0; i < numvolsret; i++) {
+ volptr = virStorageVolLookupByName(poolptr, volnames[i]);
+ if (volptr == NULL) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Storage Volume `%s' not found",
+ volnames[i]);
+ goto out;
+ }
+
+ s = volume_template(ref, template_type, volptr, list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+ }
+
+ s = cdrom_template(ref, template_type, list);
+
+ out:
+ free(volnames);
+ virStorageVolFree(volptr);
+ virStoragePoolFree(poolptr);
+ virConnectClose(conn);
+
+ return s;
+}
+
static CMPIStatus graphics_template(const CMPIObjectPath *ref,
int template_type,
struct inst_list *list)
15 years, 9 months
Test Run Summary (Mar 09 2009): KVM on Fedora release 10 (Cambridge) with sfcb
by Guo Lian Yun
=================================================
Test Run Summary (Mar 09 2009): KVM on Fedora release 10 (Cambridge) with
sfcb
=================================================
Distro: Fedora release 10 (Cambridge)
Kernel: 2.6.27.15-170.2.24.fc10.x86_64
libvirt: 0.4.5
Hypervisor: QEMU 0.9.1
CIMOM: sfcb sfcbd 1.3.3preview
Libvirt-cim revision: 829
Libvirt-cim changeset: 1aff0d0e9bf4
Cimtest revision: 642
Cimtest changeset: 087aaba26589
=================================================
FAIL : 4
XFAIL : 3
SKIP : 5
PASS : 134
-----------------
Total : 146
=================================================
FAIL Test Summary:
ElementCapabilities - 03_forward_errs.py: FAIL
ElementConforms - 01_forward.py: FAIL
ElementConforms - 04_ectp_rev_errs.py: FAIL
VirtualSystemManagementService - 05_destroysystem_neg.py: FAIL
=================================================
XFAIL Test Summary:
ComputerSystem - 32_start_reboot.py: XFAIL
ComputerSystem - 33_suspend_reboot.py: XFAIL
VirtualSystemManagementService - 09_procrasd_persist.py: XFAIL
=================================================
SKIP Test Summary:
VSSD - 02_bootldr.py: SKIP
VirtualSystemManagementService - 06_addresource.py: SKIP
VirtualSystemMigrationService - 01_migratable_host.py: SKIP
VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP
VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP
=================================================
Full report:
--------------------------------------------------------------------
AllocationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
AllocationCapabilities - 02_alloccap_gi_errs.py: PASS
--------------------------------------------------------------------
ComputerSystem - 01_enum.py: PASS
--------------------------------------------------------------------
ComputerSystem - 02_nosystems.py: PASS
--------------------------------------------------------------------
ComputerSystem - 03_defineVS.py: PASS
--------------------------------------------------------------------
ComputerSystem - 04_defineStartVS.py: PASS
--------------------------------------------------------------------
ComputerSystem - 05_activate_defined_start.py: PASS
--------------------------------------------------------------------
ComputerSystem - 06_paused_active_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 22_define_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 23_pause_pause.py: PASS
--------------------------------------------------------------------
ComputerSystem - 27_define_pause_errs.py: PASS
--------------------------------------------------------------------
ComputerSystem - 32_start_reboot.py: XFAIL
ERROR - Got CIM error Unable to reboot domain: this function is
not supported by the hypervisor: virDomainReboot with return code 1
ERROR - Exception: Unable reboot dom 'cs_test_domain'
InvokeMethod(RequestStateChange): Unable to reboot domain: this function
is not supported by the hypervisor: virDomainReboot
Bug:<00005>
--------------------------------------------------------------------
ComputerSystem - 33_suspend_reboot.py: XFAIL
ERROR - Got CIM error State not supported with return code 7
ERROR - Exception: Unable Suspend dom 'test_domain'
InvokeMethod(RequestStateChange): State not supported
Bug:<00012>
--------------------------------------------------------------------
ComputerSystem - 35_start_reset.py: PASS
--------------------------------------------------------------------
ComputerSystem - 40_RSC_start.py: PASS
--------------------------------------------------------------------
ComputerSystem - 41_cs_to_settingdefinestate.py: PASS
--------------------------------------------------------------------
ComputerSystem - 42_cs_gi_errs.py: PASS
--------------------------------------------------------------------
ComputerSystemIndication - 01_created_indication.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 01_forward.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 03_reverse_errs.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 04_forward_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 01_forward.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 03_forward_errs.py: FAIL
ERROR - Unexpected rc code 6 and description Referenced domain
`wrong' does not exist: Domain not found
--------------------------------------------------------------------
ElementCapabilities - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 05_hostsystem_cap.py: PASS
--------------------------------------------------------------------
ElementConforms - 01_forward.py: FAIL
ERROR - verify_fields() exception:
u'KVM_AllocationCapabilities'
ERROR - Exception: Failed to verify instance
Class not found
--------------------------------------------------------------------
ElementConforms - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementConforms - 03_ectp_fwd_errs.py: PASS
--------------------------------------------------------------------
ElementConforms - 04_ectp_rev_errs.py: FAIL
ERROR - Unexpected rc code 6 and description Referenced domain
`INVALID_Name_Keyvalue' does not exist: Domain not found
ERROR - ------ FAILED: INVALID_Name_Keyvalue------
--------------------------------------------------------------------
ElementSettingData - 01_forward.py: PASS
--------------------------------------------------------------------
ElementSettingData - 03_esd_assoc_with_rasd_errs.py: PASS
--------------------------------------------------------------------
EnabledLogicalElementCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
EnabledLogicalElementCapabilities - 02_elecap_gi_errs.py: PASS
--------------------------------------------------------------------
HostSystem - 01_enum.py: PASS
--------------------------------------------------------------------
HostSystem - 02_hostsystem_to_rasd.py: PASS
--------------------------------------------------------------------
HostSystem - 03_hs_to_settdefcap.py: PASS
--------------------------------------------------------------------
HostSystem - 04_hs_to_EAPF.py: PASS
--------------------------------------------------------------------
HostSystem - 05_hs_gi_errs.py: PASS
--------------------------------------------------------------------
HostSystem - 06_hs_to_vsms.py: PASS
--------------------------------------------------------------------
HostedAccessPoint - 01_forward.py: PASS
--------------------------------------------------------------------
HostedAccessPoint - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedDependency - 01_forward.py: PASS
--------------------------------------------------------------------
HostedDependency - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedDependency - 03_enabledstate.py: PASS
--------------------------------------------------------------------
HostedDependency - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 01_forward.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 03_forward_errs.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
HostedService - 01_forward.py: PASS
--------------------------------------------------------------------
HostedService - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedService - 03_forward_errs.py: PASS
--------------------------------------------------------------------
HostedService - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
KVMRedirectionSAP - 01_enum_KVMredSAP.py: PASS
--------------------------------------------------------------------
LogicalDisk - 01_disk.py: PASS
--------------------------------------------------------------------
LogicalDisk - 02_nodevs.py: PASS
--------------------------------------------------------------------
LogicalDisk - 03_ld_gi_errs.py: PASS
--------------------------------------------------------------------
Memory - 01_memory.py: PASS
--------------------------------------------------------------------
Memory - 02_defgetmem.py: PASS
--------------------------------------------------------------------
Memory - 03_mem_gi_errs.py: PASS
--------------------------------------------------------------------
NetworkPort - 01_netport.py: PASS
--------------------------------------------------------------------
NetworkPort - 02_np_gi_errors.py: PASS
--------------------------------------------------------------------
NetworkPort - 03_user_netport.py: PASS
--------------------------------------------------------------------
Processor - 01_processor.py: PASS
--------------------------------------------------------------------
Processor - 02_definesys_get_procs.py: PASS
--------------------------------------------------------------------
Processor - 03_proc_gi_errs.py: PASS
--------------------------------------------------------------------
Profile - 01_enum.py: PASS
--------------------------------------------------------------------
Profile - 02_profile_to_elec.py: PASS
--------------------------------------------------------------------
Profile - 03_rprofile_gi_errs.py: PASS
--------------------------------------------------------------------
RASD - 01_verify_rasd_fields.py: PASS
--------------------------------------------------------------------
RASD - 02_enum.py: PASS
--------------------------------------------------------------------
RASD - 03_rasd_errs.py: PASS
--------------------------------------------------------------------
RASD - 04_disk_rasd_size.py: PASS
--------------------------------------------------------------------
RASD - 05_disk_rasd_emu_type.py: PASS
--------------------------------------------------------------------
RedirectionService - 01_enum_crs.py: PASS
--------------------------------------------------------------------
RedirectionService - 02_enum_crscap.py: PASS
--------------------------------------------------------------------
RedirectionService - 03_RedirectionSAP_errs.py: PASS
--------------------------------------------------------------------
ReferencedProfile - 01_verify_refprof.py: PASS
--------------------------------------------------------------------
ReferencedProfile - 02_refprofile_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 01_forward.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 02_reverse.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 03_forward_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 05_RAPF_err.py: PASS
--------------------------------------------------------------------
ResourcePool - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePool - 02_rp_gi_errors.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationCapabilities - 02_rpcc_gi_errs.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 02_rcps_gi_errors.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 03_CreateResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 04_CreateChildResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 05_AddResourcesToResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 06_RemoveResourcesFromResourcePool.py:
PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 07_DeleteResourcePool.py: PASS
--------------------------------------------------------------------
ServiceAccessBySAP - 01_forward.py: PASS
--------------------------------------------------------------------
ServiceAccessBySAP - 02_reverse.py: PASS
--------------------------------------------------------------------
SettingsDefine - 01_forward.py: PASS
--------------------------------------------------------------------
SettingsDefine - 02_reverse.py: PASS
--------------------------------------------------------------------
SettingsDefine - 03_sds_fwd_errs.py: PASS
--------------------------------------------------------------------
SettingsDefine - 04_sds_rev_errs.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 01_forward.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 03_forward_errs.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 04_forward_vsmsdata.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 05_reverse_vsmcap.py: PASS
--------------------------------------------------------------------
SystemDevice - 01_forward.py: PASS
--------------------------------------------------------------------
SystemDevice - 02_reverse.py: PASS
--------------------------------------------------------------------
SystemDevice - 03_fwderrs.py: PASS
--------------------------------------------------------------------
VSSD - 01_enum.py: PASS
--------------------------------------------------------------------
VSSD - 02_bootldr.py: SKIP
--------------------------------------------------------------------
VSSD - 03_vssd_gi_errs.py: PASS
--------------------------------------------------------------------
VSSD - 04_vssd_to_rasd.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementCapabilities - 02_vsmcap_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 01_definesystem_name.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 02_destroysystem.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 03_definesystem_ess.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 04_definesystem_ers.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 05_destroysystem_neg.py: FAIL
ERROR - destroy_fail>> noname: Error executing DestroySystem
ERROR - (6, u'Unable to retrieve domain name: Error 0')
ERROR - destroy_fail>> nonexistent: Error executing
DestroySystem
ERROR - (6, u"Referenced domain `##@@!!cimtest_domain' does not
exist: Domain not found")
InvokeMethod(DestroySystem): Unable to retrieve domain name: Error 0
InvokeMethod(DestroySystem): Referenced domain `##@@!!cimtest_domain' does
not exist: Domain not found
--------------------------------------------------------------------
VirtualSystemManagementService - 06_addresource.py: SKIP
ERROR - Need to give different bridge name since it already
exists
--------------------------------------------------------------------
VirtualSystemManagementService - 07_addresource_neg.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 08_modifyresource.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 09_procrasd_persist.py: XFAIL
--------------------------------------------------------------------
VirtualSystemManagementService - 10_hv_version.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 11_define_memrasdunits.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 12_referenced_config.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 13_refconfig_additional_devs.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 14_define_sys_disk.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 15_mod_system_settings.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationCapabilities - 02_vsmc_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationService - 01_migratable_host.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationSettingData - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationSettingData - 02_vsmsd_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 01_forward.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 02_reverse.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 03_vssdc_fwd_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 04_vssdc_rev_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotService - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotService - 02_vs_sservice_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotServiceCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotServiceCapabilities - 02_vs_sservicecap_gi_errs.py:
PASS
--------------------------------------------------------------------
15 years, 9 months
[PATCH] [TEST] #3 Fix ElementCapabilities/03_forward_errs.py with provider's updated err message
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1236567513 25200
# Node ID e601bc0ba234dae371ec38b8289b5827d12f2910
# Parent 087aaba2658940bbc8718aa55cbcd6150f7cac23
[TEST] #3 Fix ElementCapabilities/03_forward_errs.py with provider's updated err message
Updates from 2 to 3:
Get correct CS Name instead of hard code of "Xen_ComputerSystem"
Updates from 1 to 2:
Use a variable to assign revision value to be calculated for comparison
Also fix the line to meet 80 length
Tested for KVM/LXC with current sources and rpm
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 087aaba26589 -r e601bc0ba234 suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Thu Mar 05 22:04:39 2009 -0800
+++ b/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Sun Mar 08 19:58:33 2009 -0700
@@ -27,10 +27,11 @@
from XenKvmLib import enumclass
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS
-from XenKvmLib.const import do_main
+from XenKvmLib.const import do_main, get_provider_version
from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
+libvirt_ec_changes = 815
exp_rc = 6 #CIM_ERR_NOT_FOUND
exp_desc = "No such instance"
@@ -42,23 +43,24 @@
status = FAIL
rc = -1
names = []
-
+ ec = get_typed_class(options.virt, "ElementCapabilities")
try:
- names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities"))
+ names = conn.AssociatorNames(ref, AssocClass = ec)
rc = 0
except pywbem.CIMError, (rc, desc):
if rc == exp_rc and desc.find(exp_desc) >= 0:
logger.info("Got expected rc code and error string")
status = PASS
else:
- logger.error("Unexpected rc code %s and description %s\n", rc, desc)
+ logger.error("Unexpected rc code %s and description %s\n", rc,
+ desc)
except Exception, details:
logger.error("Unknown exception happened")
logger.error(details)
if rc == 0:
- logger.error("ElementCapabilities associator should NOT return excepted \
- result with a wrong key name and value of %s input", ref_class)
+ logger.error("ElementCapabilities associator should NOT" + \
+ " return records with a wrong key name and value")
status = FAIL
return status
@@ -73,7 +75,8 @@
cs = get_typed_class(options.virt, "ComputerSystem")
instanceref = CIMInstanceName(hs,
- keybindings = {"Name" : "wrong", "CreationClassName" : "wrong"})
+ keybindings = {"Name" : "wrong",
+ "CreationClassName" : "wrong"})
rc = try_assoc(instanceref, hs, exp_rc, exp_desc, options)
if rc != PASS:
@@ -81,8 +84,16 @@
return status
instance_cs = CIMInstanceName(cs,
- keybindings = {"Name" : "wrong", "CreationClassName" : "Xen_ComputerSystem"})
- rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
+ keybindings = {"Name" : "wrong",
+ "CreationClassName" : cs})
+
+ curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
+ if curr_cim_rev >= libvirt_ec_changes:
+ cs_exp_desc = "Referenced domain `wrong' does not exist:" + \
+ " Domain not found"
+ try_assoc(instance_cs, cs, exp_rc, cs_exp_desc, options)
+ else:
+ rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
if rc != PASS:
status = FAIL
return status
15 years, 9 months
[PATCH] [TEST]#2 Fix ElementCapabilities/03_forward_errs.py with provider's updated err message
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1236309447 28800
# Node ID 7e6e1318706b1b4e6b39d703b663c70a0972b778
# Parent c6f7256013b97dc57a31312897e45eb3cd8604a7
[TEST]#2 Fix ElementCapabilities/03_forward_errs.py with provider's updated err message
Updates form 1 to 2:
Use a variable to assign revision value to be calculated for comparison
Also fix the line to meet 80 length
Tested for KVM/LXC with current sources and rpm
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r c6f7256013b9 -r 7e6e1318706b suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Tue Mar 03 08:47:40 2009 -0800
+++ b/suites/libvirt-cim/cimtest/ElementCapabilities/03_forward_errs.py Thu Mar 05 19:17:27 2009 -0800
@@ -27,10 +27,11 @@
from XenKvmLib import enumclass
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS
-from XenKvmLib.const import do_main
+from XenKvmLib.const import do_main, get_provider_version
from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
+libvirt_ec_changes = 815
exp_rc = 6 #CIM_ERR_NOT_FOUND
exp_desc = "No such instance"
@@ -42,23 +43,24 @@
status = FAIL
rc = -1
names = []
-
+ ec = get_typed_class(options.virt, "ElementCapabilities")
try:
- names = conn.AssociatorNames(ref, AssocClass = get_typed_class(options.virt, "ElementCapabilities"))
+ names = conn.AssociatorNames(ref, AssocClass = ec)
rc = 0
except pywbem.CIMError, (rc, desc):
if rc == exp_rc and desc.find(exp_desc) >= 0:
logger.info("Got expected rc code and error string")
status = PASS
else:
- logger.error("Unexpected rc code %s and description %s\n", rc, desc)
+ logger.error("Unexpected rc code %s and description %s\n", rc,
+ desc)
except Exception, details:
logger.error("Unknown exception happened")
logger.error(details)
if rc == 0:
- logger.error("ElementCapabilities associator should NOT return excepted \
- result with a wrong key name and value of %s input", ref_class)
+ logger.error("ElementCapabilities associator should NOT" + \
+ " return records with a wrong key name and value")
status = FAIL
return status
@@ -73,7 +75,8 @@
cs = get_typed_class(options.virt, "ComputerSystem")
instanceref = CIMInstanceName(hs,
- keybindings = {"Name" : "wrong", "CreationClassName" : "wrong"})
+ keybindings = {"Name" : "wrong",
+ "CreationClassName" : "wrong"})
rc = try_assoc(instanceref, hs, exp_rc, exp_desc, options)
if rc != PASS:
@@ -81,8 +84,16 @@
return status
instance_cs = CIMInstanceName(cs,
- keybindings = {"Name" : "wrong", "CreationClassName" : "Xen_ComputerSystem"})
- rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
+ keybindings = {"Name" : "wrong",
+ "CreationClassName" : "Xen_ComputerSystem"})
+
+ curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
+ if curr_cim_rev >= libvirt_ec_changes:
+ cs_exp_desc = "Referenced domain `wrong' does not exist:" + \
+ " Domain not found"
+ try_assoc(instance_cs, cs, exp_rc, cs_exp_desc, options)
+ else:
+ rc = try_assoc(instance_cs, cs, exp_rc, exp_desc, options)
if rc != PASS:
status = FAIL
return status
15 years, 9 months
[PATCH] Changed the output of AllocationCapability association when using DiskPool as input
by Richard Maciel
# HG changeset patch
# User Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
# Date 1236119796 10800
# Node ID d2d4d7e48f871111f655398e6900bc534231a55d
# Parent 1aff0d0e9bf49e738827b7157c0df407b814ae7d
Changed the output of AllocationCapability association when using DiskPool as input
This patch fix the results of a 'association instances' query when passing a disk pool AllocationCapabilities reference as input. Before this patch, this query returned RASD templates for the disk pools, but now it returns the RASD templates for each of the volumes which composes the disk pool passed as input.
To test:
- Create a domain containing a diskpool and some volumes
- Execute query: wbemcli ein 'http://localhost:5988/root/virt:CIM_AllocationCapabilities'
- Select the reference to a diskpool and use in an association query like the one below:
wbemcli ai -nl -ac KVM_SettingsDefineCapabilities 'http://@localhost:5988/root/virt:KVM_AllocationCapabilities.InstanceID="DiskPool/default"'
- There must be four templates for each volume in the diskpool (MINIMUM, MAXIMUM, DEFAULT, INCREMENT) and their address must correspond to the address of the volume
Signed-off-by: Richard Maciel <rmaciel(a)linux.vnet.ibm.com>
diff -r 1aff0d0e9bf4 -r d2d4d7e48f87 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Wed Mar 04 15:25:33 2009 -0800
+++ b/src/Virt_SettingsDefineCapabilities.c Tue Mar 03 19:36:36 2009 -0300
@@ -562,71 +562,23 @@
return s;
}
-static int get_disk_freespace(const CMPIObjectPath *ref,
- CMPIStatus *s,
- uint64_t *free_space)
-{
- bool ret = false;
- const char *inst_id;
- CMPIrc prop_ret;
- virConnectPtr conn;
- CMPIInstance *pool_inst;
-
- if (cu_get_str_path(ref, "InstanceID", &inst_id) != CMPI_RC_OK) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Could not get InstanceID");
- goto out;
- }
-
- conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
- if (s->rc != CMPI_RC_OK) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Could not get connection");
- goto out;
- }
-
- /* Getting the relevant resource pool directly finds the free space
- * for us. It is in the Capacity field. */
- *s = get_pool_by_name(_BROKER, ref, inst_id, &pool_inst);
- if (s->rc != CMPI_RC_OK)
- goto out;
-
- prop_ret = cu_get_u64_prop(pool_inst, "Capacity", free_space);
- if (prop_ret != CMPI_RC_OK) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Could not get capacity from instance");
- goto out;
- }
-
- CU_DEBUG("Got capacity from pool_inst: %lld", *free_space);
- ret = true;
-
- out:
- return ret;
-}
-
static CMPIStatus set_disk_props(int type,
const CMPIObjectPath *ref,
const char *id,
+ const char *disk_path,
uint64_t disk_size,
uint16_t emu_type,
struct inst_list *list)
{
- const char *addr;
const char *dev;
CMPIInstance *inst;
CMPIStatus s = {CMPI_RC_OK, NULL};
if (type == DOMAIN_LXC) {
- addr = "/tmp";
dev = "/lxc_mnt/tmp";
}
else {
dev = "hda";
- addr = "/dev/null";
}
inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_DISK);
@@ -638,7 +590,7 @@
(CMPIValue *)"MegaBytes", CMPI_chars);
CMSetProperty(inst, "VirtualQuantity",
(CMPIValue *)&disk_size, CMPI_uint64);
- CMSetProperty(inst, "Address", (CMPIValue *)addr, CMPI_chars);
+ CMSetProperty(inst, "Address", (CMPIValue *)disk_path, CMPI_chars);
if (type == DOMAIN_LXC)
CMSetProperty(inst, "MountPoint", (CMPIValue *)dev, CMPI_chars);
@@ -664,34 +616,28 @@
return s;
}
-static CMPIStatus disk_template(const CMPIObjectPath *ref,
- int template_type,
- struct inst_list *list)
+static CMPIStatus cdrom_template(const CMPIObjectPath *ref,
+ int template_type,
+ struct inst_list *list)
{
- bool ret;
char *pfx;
const char *id;
- uint64_t disk_size;
- uint16_t emu_type = 0;
+ char *vol_path;
+ uint64_t vol_size = 0;
CMPIStatus s = {CMPI_RC_OK, NULL};
+ uint16_t emu_type = 1;
switch(template_type) {
case SDC_RASD_MIN:
- disk_size = SDC_DISK_MIN;
id = "Minimum";
break;
case SDC_RASD_MAX:
- ret = get_disk_freespace(ref, &s, &disk_size);
- if (!ret)
- goto out;
id = "Maximum";
break;
case SDC_RASD_INC:
- disk_size = SDC_DISK_INC;
id = "Increment";
break;
case SDC_RASD_DEF:
- disk_size = SDC_DISK_DEF;
id = "Default";
break;
default:
@@ -701,6 +647,8 @@
goto out;
}
+ vol_path = "/dev/null";
+
pfx = class_prefix_name(CLASSNAME(ref));
if (STREQ(pfx, "Xen")) {
@@ -708,48 +656,120 @@
int i = 0;
for (; i < 2; i++) {
- emu_type = 0;
s = set_disk_props(xen_type[i],
ref,
- id,
- disk_size,
+ id,
+ vol_path,
+ vol_size,
emu_type,
list);
- if (s.rc != CMPI_RC_OK)
- goto out;
-
- emu_type = 1;
- s = set_disk_props(xen_type[i],
- ref,
- id,
- disk_size,
- emu_type,
- list);
- if (s.rc != CMPI_RC_OK)
- goto out;
}
} else if (STREQ(pfx, "KVM")) {
s = set_disk_props(DOMAIN_KVM,
ref,
- id,
- disk_size,
+ id,
+ vol_path,
+ vol_size,
emu_type,
list);
- if (s.rc != CMPI_RC_OK)
- goto out;
- emu_type = 1;
+ } else if (!STREQ(pfx, "LXC")){
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unsupported virtualization type");
+ }
+
+ out:
+ return s;
+
+}
+
+
+static CMPIStatus volume_template(const CMPIObjectPath *ref,
+ int template_type,
+ virStorageVolPtr volume_ptr,
+ struct inst_list *list)
+{
+ char *pfx;
+ const char *id;
+ char *vol_path;
+ uint64_t vol_size;
+ virStorageVolInfo vol_info;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ int retval;
+ uint16_t emu_type = 0;
+
+ retval = virStorageVolGetInfo(volume_ptr, &vol_info);
+ if (retval == -1) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ virStorageVolGetConnect(volume_ptr),
+ "Unable to get volume information");
+ goto out;
+ }
+
+ switch(template_type) {
+ case SDC_RASD_MIN:
+ vol_size = SDC_DISK_MIN;
+ id = "Minimum";
+ break;
+ case SDC_RASD_MAX:
+ vol_size = (uint64_t)vol_info.capacity;
+ id = "Maximum";
+ break;
+ case SDC_RASD_INC:
+ vol_size = SDC_DISK_INC;
+ id = "Increment";
+ break;
+ case SDC_RASD_DEF:
+ vol_size = (uint64_t)vol_info.allocation;
+ id = "Default";
+ break;
+ default:
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unsupported sdc_rasd type");
+ goto out;
+ }
+
+ vol_path = virStorageVolGetPath(volume_ptr);
+ if (vol_path == NULL) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ virStorageVolGetConnect(volume_ptr),
+ "Unable to get volume path");
+ goto out;
+ }
+
+ pfx = class_prefix_name(CLASSNAME(ref));
+
+ if (STREQ(pfx, "Xen")) {
+ int xen_type[2] = {DOMAIN_XENFV, DOMAIN_XENPV};
+ int i = 0;
+
+ for (; i < 2; i++) {
+ s = set_disk_props(xen_type[i],
+ ref,
+ id,
+ vol_path,
+ vol_size,
+ emu_type,
+ list);
+ }
+ } else if (STREQ(pfx, "KVM")) {
s = set_disk_props(DOMAIN_KVM,
ref,
- id,
- disk_size,
+ id,
+ vol_path,
+ vol_size,
emu_type,
list);
} else if (STREQ(pfx, "LXC")) {
s = set_disk_props(DOMAIN_LXC,
ref,
id,
- disk_size,
+ vol_path,
+ vol_size,
emu_type,
list);
} else {
@@ -762,6 +782,109 @@
return s;
}
+static CMPIStatus disk_template(const CMPIObjectPath *ref,
+ int template_type,
+ struct inst_list *list)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ virConnectPtr conn = NULL;
+ virStoragePoolPtr poolptr = NULL;
+ virStorageVolPtr volptr = NULL;
+ const char *instid = NULL;
+ char *host = NULL;
+ const char *poolname = NULL;
+ char **volnames = NULL;
+ int numvols, numvolsret = 0;
+ int i;
+
+
+ conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
+
+ if (cu_get_str_path(ref, "InstanceID", &instid) != CMPI_RC_OK) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to get InstanceID for disk device");
+ goto out;
+ }
+
+ if (parse_fq_devid(instid, &host, (char **)&poolname) != 1) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to get pool device id");
+ goto out;
+ }
+
+ if ((poolptr = virStoragePoolLookupByName(conn, poolname)) == NULL) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Storage pool `%s' not found",
+ poolname);
+ goto out;
+ }
+
+ if ((numvols = virStoragePoolNumOfVolumes(poolptr)) == -1) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ conn,
+ "Unable to get the number of volumes \
+ of storage pool `%s'",
+ poolname);
+ goto out;
+ }
+
+
+ volnames = (char **)malloc(sizeof(char *) * numvols);
+
+ numvolsret = virStoragePoolListVolumes(poolptr,
+ volnames,
+ numvols);
+
+ if (numvolsret == -1) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ conn,
+ "Unable to get a pointer to volumes \
+ of storage pool `%s'",
+ poolname);
+ goto out;
+ }
+
+ for (i = 0; i < numvolsret; i++) {
+
+ volptr = virStorageVolLookupByName(poolptr, volnames[i]);
+ if (volptr == NULL) {
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Storage Volume `%s' not found",
+ volnames[i]);
+ goto out;
+ }
+
+ s = volume_template(ref,
+ template_type,
+ volptr,
+ list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+ }
+
+ s = cdrom_template(ref,
+ template_type,
+ list);
+
+ out:
+ if(volnames != NULL)
+ free(volnames);
+
+ virStorageVolFree(volptr);
+ virStoragePoolFree(poolptr);
+ virConnectClose(conn);
+
+ return s;
+}
+
static CMPIStatus graphics_template(const CMPIObjectPath *ref,
int template_type,
struct inst_list *list)
15 years, 9 months