[PATCH] [TEST] Test macvtap patch
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1267471822 28800
# Node ID ee89554f681d3aad027dbaa166cbe26267472448
# Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493
[TEST] Test macvtap patch.
Verify that a vepa mode VM can be created.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 3655b03ada11 -r ee89554f681d suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py Mon Mar 01 11:30:22 2010 -0800
@@ -0,0 +1,152 @@
+#!/usr/bin/python
+#
+# Copyright 2010 IBM Corp.
+#
+# Authors:
+# Sharad Mishra <snmishra(a)us.ibm.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Purpose:
+# Verify provider's support for macvtap.
+#
+# Steps:
+# 1) Build RASD parameters, making sure to specify macvtap mode for network
+# interface
+# 2) Create guest
+# 3) Verify guest is defined properly
+#
+
+import sys
+from CimTest.Globals import logger
+from CimTest.ReturnCodes import FAIL, PASS, SKIP
+from XenKvmLib.classes import get_typed_class, inst_to_mof
+from XenKvmLib.rasd import get_default_rasds
+from XenKvmLib.const import do_main, get_provider_version
+from XenKvmLib.vxml import get_class
+from XenKvmLib.common_util import parse_instance_id
+from XenKvmLib.enumclass import EnumInstances
+
+sup_types = ['Xen', 'XenFV', 'KVM']
+test_dom = 'rstest_nic'
+
+target_dev_rev = 1029
+
+def get_rasd_list(ip, virt, target_dev, source_dev):
+ nrasd_cn = get_typed_class(virt, "NetResourceAllocationSettingData")
+
+ rasds = get_default_rasds(ip, virt)
+
+ rasd_list = {}
+
+ for rasd in rasds:
+ if rasd.classname == nrasd_cn and "Default" in rasd['InstanceID']:
+
+ rasd['NetworkMode'] = target_dev
+ rasd['NetworkType'] = "direct"
+ rasd['SourceDevice'] = source_dev
+
+ rasd_list[rasd.classname] = inst_to_mof(rasd)
+
+ return rasd_list
+
+def verify_net_rasd(ip, virt, target_dev, source_dev, guest_name):
+ inst = None
+
+ try:
+ nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData')
+ enum_list = EnumInstances(ip, nrasd_cn)
+
+ if enum_list < 1:
+ raise Exception("No %s instances returned" % nrasd_cn)
+
+ for rasd in enum_list:
+ guest, dev, status = parse_instance_id(rasd.InstanceID)
+ if status != PASS:
+ raise Exception("Unable to parse InstanceID: %s" % \
+ rasd.InstanceID)
+
+ if guest == guest_name:
+ inst = rasd
+ break
+
+ if inst is None:
+ raise Exception("%s instance for %s not found" % (nrasd_cn,
+ guest_name))
+
+ if inst.NetworkMode != target_dev:
+ raise Exception("Expected NetworkMode to be %s" % target_dev)
+
+ if inst.SourceDevice != source_dev:
+ raise Exception("Expected SourceDevice to be %s" % source_dev)
+
+ except Exception, details:
+ logger.error(details)
+ return FAIL
+
+ return PASS
+
+@do_main(sup_types)
+def main():
+ options = main.options
+
+ status = FAIL
+
+ curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
+ if curr_cim_rev < target_dev_rev:
+ logger.error("Network interface target device support is available" \
+ " in rev >= %s", target_dev_rev)
+ return SKIP
+
+ cxml = get_class(options.virt)(test_dom)
+
+ target_dev = "vepa"
+ source_dev = "eth1"
+
+ guest_defined = False
+
+ try:
+ rasd_list = get_rasd_list(options.ip, options.virt, target_dev, source_dev)
+ if len(rasd_list) < 1:
+ raise Exception("Unable to get template RASDs for %s" % test_dom)
+
+ cxml.set_res_settings(rasd_list)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ raise Exception("Unable to define %s" % test_dom)
+
+ guest_defined = True
+
+ status = cxml.cim_start(options.ip)
+ if status != PASS:
+ raise Exception("Unable to start %s" % test_dom)
+
+ status = verify_net_rasd(options.ip, options.virt, target_dev,
+ source_dev, test_dom)
+ if status != PASS:
+ raise Exception("Failed to net interface for %s" % test_dom)
+
+ except Exception, details:
+ logger.error(details)
+ status = FAIL
+
+ if guest_defined == True:
+ cxml.undefine(options.ip)
+
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
+
14 years, 4 months
[PATCH] [TEST] Updating rasd.py to include floppy changes and direct net type changes
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
# Date 1268658975 14400
# Node ID 888ca94fdbc69076a8ab2f7dd805d314b3dbb27d
# Parent a576cb1c855a8f507d7ec38c49467bfb018b46b7
[TEST] Updating rasd.py to include floppy changes and direct net type changes.
This test fixes the SettingsDefineCapabilities/01_forward.py and
HostSystem -t 03_hs_to_settdefcap.py.
The test has been verified with KVM and Xen on current Libvirt-CIM Sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r a576cb1c855a -r 888ca94fdbc6 suites/libvirt-cim/lib/XenKvmLib/rasd.py
--- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py Tue Feb 02 12:30:20 2010 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py Mon Mar 15 09:16:15 2010 -0400
@@ -324,6 +324,8 @@
libvirt_rasd_template_changes = 707
libvirt_rasd_new_changes = 805
libvirt_rasd_dpool_changes = 839
+ libvirt_rasd_floppy_changes = 1023
+ libvirt_rasd_stvol_unit_changes = 1025
libvirt_ver = virsh_version(ip, virt)
@@ -334,6 +336,13 @@
# StoragePoolRASD record 1 for each of Min, Max, Default, and Incr
exp_storagevol_rasd = 4
exp_len = exp_base_num
+
+ # StoragePoolRASD record with AllocationUnits=G 1 for each \
+ # of Min, Max, Default, Incr
+ exp_storagevol_unit_changes = 4
+
+ # Floppy record 1 for each of Min, Max, Default, and Incr
+ exp_floppy = 4
if id == "DiskPool/0":
pool_types = 7
@@ -350,7 +359,11 @@
elif rev >= libvirt_rasd_dpool_changes and libvirt_ver >= '0.4.1':
volumes = enum_volumes(virt, ip)
- exp_len = ((volumes * exp_base_num) + exp_cdrom) * xen_multi
+ if rev >= libvirt_rasd_floppy_changes:
+ exp_len = ((volumes * exp_base_num) + \
+ exp_cdrom + exp_floppy) * xen_multi
+ else:
+ exp_len = ((volumes * exp_base_num) + exp_cdrom) * xen_multi
else:
exp_len = (exp_base_num + exp_cdrom) * xen_multi
@@ -363,16 +376,28 @@
elif rev >= libvirt_rasd_dpool_changes:
id = parse_instance_id(id)
volumes = enum_volumes(virt, ip, id[1])
- exp_len = (volumes * exp_base_num) + exp_cdrom
- if rev >= libvirt_rasd_storagepool_changes and libvirt_ver >= '0.4.1' \
- and virt != 'LXC':
- exp_len += exp_storagevol_rasd
+ if rev >= libvirt_rasd_floppy_changes:
+ exp_len = (volumes * exp_base_num) + exp_cdrom + exp_floppy
+ else:
+ exp_len = (volumes * exp_base_num) + exp_cdrom
+
+
+ if virt != 'LXC' and libvirt_ver >= '0.4.1':
+ if rev >= libvirt_rasd_storagepool_changes:
+ exp_len += exp_storagevol_rasd
+
+ if rev >= libvirt_rasd_stvol_unit_changes:
+ exp_len += exp_storagevol_unit_changes
return exp_len
def get_exp_net_rasd_len(virt, rev, id):
net_rasd_template_changes = 861
+ net_rasd_direct_nettype_changes = 1029
+
+ # NetRASD record for Direct NetType 1 for each min, max, incr, default
+ exp_direct = 4
exp_base_num = 4
@@ -385,8 +410,12 @@
if rev >= net_rasd_template_changes:
dev_types = 2
net_types = 3
+ exp_base_num = exp_base_num * dev_types * net_types
- return exp_base_num * dev_types * net_types
+ if rev >= net_rasd_direct_nettype_changes:
+ exp_base_num += exp_direct
+
+ return exp_base_num
return exp_base_num
14 years, 6 months
[PATCH] (#2) Use libvirt to get StorageVolume Path to set SV InstanceID
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1269387101 25200
# Node ID 22a4721a2d978fe611cb75255a094a0cc23abe5c
# Parent 4ee7c4354bc550780bc02ef1f69fbda387b3fe13
(#2) Use libvirt to get StorageVolume Path to set SV InstanceID.
Updates:
Coding style and free path pointer.
InstanceID of a StorageVolume was set using the 'Path' field of StorageVolume RASD. If 'Path' was not set by the user, the InstanceID would be invalid. This patch fixed the issue by using libvirt to get the storage volume path. The path returned by libvirt is used to set the InstanceID.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 4ee7c4354bc5 -r 22a4721a2d97 libxkutil/pool_parsing.c
--- a/libxkutil/pool_parsing.c Tue Mar 02 15:23:45 2010 -0800
+++ b/libxkutil/pool_parsing.c Tue Mar 23 16:31:41 2010 -0700
@@ -353,12 +353,12 @@
}
#if VIR_USE_LIBVIRT_STORAGE
-int create_resource(virConnectPtr conn,
- const char *pname,
- const char *xml,
- int res_type)
+char *create_resource(virConnectPtr conn,
+ const char *pname,
+ const char *xml,
+ int res_type)
{
- int ret = 0;
+ char *path = NULL;
virStoragePoolPtr ptr = NULL;
virStorageVolPtr vptr = NULL;
@@ -376,14 +376,19 @@
goto out;
}
- ret = 1;
+ path = virStorageVolGetPath(vptr);
+ if (path == NULL) {
+ CU_DEBUG("Unable to get storage volume path");
+ goto out;
+ }
+
}
out:
virStoragePoolFree(ptr);
virStorageVolFree(vptr);
- return ret;
+ return path;
}
int delete_resource(virConnectPtr conn,
@@ -414,13 +419,13 @@
return ret;
}
#else
-int create_resource(virConnectPtr conn,
- const char *pname,
- const char *xml,
- int res_type)
+char *create_resource(virConnectPtr conn,
+ const char *pname,
+ const char *xml,
+ int res_type)
{
CU_DEBUG("Creating resources within libvirt pools not supported");
- return 0;
+ return NULL;
}
int delete_resource(virConnectPtr conn,
diff -r 4ee7c4354bc5 -r 22a4721a2d97 libxkutil/pool_parsing.h
--- a/libxkutil/pool_parsing.h Tue Mar 02 15:23:45 2010 -0800
+++ b/libxkutil/pool_parsing.h Tue Mar 23 16:31:41 2010 -0700
@@ -90,8 +90,8 @@
int define_pool(virConnectPtr conn, const char *xml, int res_type);
int destroy_pool(virConnectPtr conn, const char *name, int res_type);
-int create_resource(virConnectPtr conn, const char *pname,
- const char *xml, int res_type);
+char *create_resource(virConnectPtr conn, const char *pname,
+ const char *xml, int res_type);
int delete_resource(virConnectPtr conn, const char *rname, int res_type);
diff -r 4ee7c4354bc5 -r 22a4721a2d97 src/Virt_ResourcePoolConfigurationService.c
--- a/src/Virt_ResourcePoolConfigurationService.c Tue Mar 02 15:23:45 2010 -0800
+++ b/src/Virt_ResourcePoolConfigurationService.c Tue Mar 23 16:31:41 2010 -0700
@@ -832,6 +832,7 @@
{
virConnectPtr conn;
CMPIInstance *inst = NULL;
+ char *path = NULL;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
if (conn == NULL) {
@@ -839,7 +840,8 @@
return NULL;
}
- if (create_resource(conn, res->pool_id, xml, res->type) == 0) {
+ path = create_resource(conn, res->pool_id, xml, res->type);
+ if (path == NULL) {
virt_set_status(_BROKER, s,
CMPI_RC_ERR_FAILED,
conn,
@@ -855,7 +857,10 @@
"Failed to lookup resulting resource");
}
+ CMSetProperty(inst, "InstanceID", (CMPIValue *)path, CMPI_chars);
+
out:
+ free(path);
virConnectClose(conn);
return inst;
14 years, 6 months
[PATCH] Use libvirt to get StorageVolume Path to set SV InstanceID
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1268096483 28800
# Node ID fa15816439a7ef1e9ff212cf1833cafa7b1fd704
# Parent 4ee7c4354bc550780bc02ef1f69fbda387b3fe13
Use libvirt to get StorageVolume Path to set SV InstanceID.
InstanceID of a StorageVolume was set using the 'Path' field of StorageVolume RASD. If 'Path' was not set by the user, the InstanceID would be invalid. This patch fixed the issue by using libvirt to get the storage volume path. The path returned by libvirt is used to set the InstanceID.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.c
--- a/libxkutil/pool_parsing.c Tue Mar 02 15:23:45 2010 -0800
+++ b/libxkutil/pool_parsing.c Mon Mar 08 17:01:23 2010 -0800
@@ -353,12 +353,12 @@
}
#if VIR_USE_LIBVIRT_STORAGE
-int create_resource(virConnectPtr conn,
+char *create_resource(virConnectPtr conn,
const char *pname,
const char *xml,
int res_type)
{
- int ret = 0;
+ char *path = NULL;
virStoragePoolPtr ptr = NULL;
virStorageVolPtr vptr = NULL;
@@ -376,14 +376,19 @@
goto out;
}
- ret = 1;
+ path = virStorageVolGetPath(vptr);
+ if (path == NULL) {
+ CU_DEBUG("Unable to get storage volume path");
+ goto out;
+ }
+
}
out:
virStoragePoolFree(ptr);
virStorageVolFree(vptr);
- return ret;
+ return path;
}
int delete_resource(virConnectPtr conn,
@@ -414,13 +419,13 @@
return ret;
}
#else
-int create_resource(virConnectPtr conn,
+char *create_resource(virConnectPtr conn,
const char *pname,
const char *xml,
int res_type)
{
CU_DEBUG("Creating resources within libvirt pools not supported");
- return 0;
+ return NULL;
}
int delete_resource(virConnectPtr conn,
diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.h
--- a/libxkutil/pool_parsing.h Tue Mar 02 15:23:45 2010 -0800
+++ b/libxkutil/pool_parsing.h Mon Mar 08 17:01:23 2010 -0800
@@ -90,7 +90,7 @@
int define_pool(virConnectPtr conn, const char *xml, int res_type);
int destroy_pool(virConnectPtr conn, const char *name, int res_type);
-int create_resource(virConnectPtr conn, const char *pname,
+char *create_resource(virConnectPtr conn, const char *pname,
const char *xml, int res_type);
int delete_resource(virConnectPtr conn, const char *rname, int res_type);
diff -r 4ee7c4354bc5 -r fa15816439a7 src/Virt_ResourcePoolConfigurationService.c
--- a/src/Virt_ResourcePoolConfigurationService.c Tue Mar 02 15:23:45 2010 -0800
+++ b/src/Virt_ResourcePoolConfigurationService.c Mon Mar 08 17:01:23 2010 -0800
@@ -832,6 +832,7 @@
{
virConnectPtr conn;
CMPIInstance *inst = NULL;
+ char *path = NULL;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
if (conn == NULL) {
@@ -839,7 +840,8 @@
return NULL;
}
- if (create_resource(conn, res->pool_id, xml, res->type) == 0) {
+ path = create_resource(conn, res->pool_id, xml, res->type);
+ if (path == NULL) {
virt_set_status(_BROKER, s,
CMPI_RC_ERR_FAILED,
conn,
@@ -855,6 +857,8 @@
"Failed to lookup resulting resource");
}
+ CMSetProperty(inst, "InstanceID", (CMPIValue *)path, CMPI_chars);
+
out:
virConnectClose(conn);
14 years, 6 months
[PATCH] [TEST] #3 Add check to verify StorageVolume InstanceID
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1268952745 25200
# Node ID f3604141cbff1e1ccc2ec97d5594c5d54f965516
# Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493
[TEST] #3 Add check to verify StorageVolume InstanceID.
Updates:
Moved InstanceID check immediately after call to CreateResourceInPool.
Added exception on failure.
This test verifies that the InstanceID of StorageVolume is not dependent on the pool path in RASD. Rather it is set by virStorageVolGetPath.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 3655b03ada11 -r f3604141cbff suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Thu Jan 28 14:00:59 2010 -0800
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Thu Mar 18 15:52:25 2010 -0700
@@ -231,6 +231,11 @@
if res[0] != PASS:
raise Exception("Failed to create the Vol %s" % vol_name)
+ if res[1]['Resource']['InstanceID'] != exp_vol_path:
+ raise Exception("Incorrect InstanceID")
+ else:
+ status = PASS
+
found = verify_vol(server, virt, pool_name, exp_vol_path, found)
stovol_status = verify_template_rasd_exists(virt, server,
dp_inst_id,
@@ -239,7 +244,8 @@
ret = cleanup_pool_vol(server, virt, pool_name,
clean_pool, exp_vol_path)
if res[0] == PASS and found == 1 and \
- ret == PASS and stovol_status == PASS:
+ ret == PASS and stovol_status == PASS and \
+ status == PASS:
status = PASS
else:
return FAIL
14 years, 6 months
[PATCH] [TEST] #2 Add check to verify StorageVolume InstanceID
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1268864289 25200
# Node ID 2a7a2ab9e729227b40a40d67f6dec9e2555e7bb7
# Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493
[TEST] #2 Add check to verify StorageVolume InstanceID.
Updates:
Moved InstanceID check immediately after call to CreateResourceInPool.
This test verifies that the InstanceID of StorageVolume is not dependent on the pool path in RASD. Rather it is set by virStorageVolGetPath.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 3655b03ada11 -r 2a7a2ab9e729 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Thu Jan 28 14:00:59 2010 -0800
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Wed Mar 17 15:18:09 2010 -0700
@@ -231,6 +231,11 @@
if res[0] != PASS:
raise Exception("Failed to create the Vol %s" % vol_name)
+ if res[1]['Resource']['InstanceID'] != exp_vol_path:
+ status = FAIL
+ else:
+ status = PASS
+
found = verify_vol(server, virt, pool_name, exp_vol_path, found)
stovol_status = verify_template_rasd_exists(virt, server,
dp_inst_id,
@@ -239,7 +244,8 @@
ret = cleanup_pool_vol(server, virt, pool_name,
clean_pool, exp_vol_path)
if res[0] == PASS and found == 1 and \
- ret == PASS and stovol_status == PASS:
+ ret == PASS and stovol_status == PASS and \
+ status == PASS:
status = PASS
else:
return FAIL
14 years, 6 months
[PATCH] [TEST] Fixing the syntax err in VSMS/26_definesystem_nic_dev.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
# Date 1268816098 14400
# Node ID 930746e12eb08c3e5a262f70391ad312ba31fab0
# Parent a576cb1c855a8f507d7ec38c49467bfb018b46b7
[TEST] Fixing the syntax err in VSMS/26_definesystem_nic_dev.py
Tested has been verified with KVM Libvirt-CIM Sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r a576cb1c855a -r 930746e12eb0 suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py Tue Feb 02 12:30:20 2010 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py Wed Mar 17 04:54:58 2010 -0400
@@ -95,7 +95,7 @@
return PASS
- do_main(sup_types)
+@do_main(sup_types)
def main():
options = main.options
14 years, 6 months
[PATCH] [TEST] Add check to verify StorageVolume InstanceID
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1268161766 28800
# Node ID 12a2efa271d73ef7ed8d88bb27b39cce2505716a
# Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493
[TEST] Add check to verify StorageVolume InstanceID.
This test verifies that the InstanceID of StorageVolume is not dependent on the pool path in RASD. Rather it is set by virStorageVolGetPath.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 3655b03ada11 -r 12a2efa271d7 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Thu Jan 28 14:00:59 2010 -0800
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Tue Mar 09 11:09:26 2010 -0800
@@ -236,10 +236,15 @@
dp_inst_id,
exp_vol_path)
+ if res[1]['Resource']['InstanceID'] != exp_vol_path:
+ status = FAIL
+ else:
+ status = PASS
ret = cleanup_pool_vol(server, virt, pool_name,
clean_pool, exp_vol_path)
if res[0] == PASS and found == 1 and \
- ret == PASS and stovol_status == PASS:
+ ret == PASS and stovol_status == PASS and \
+ status == PASS:
status = PASS
else:
return FAIL
14 years, 6 months
[PATCH] [TEST] #2 Verify that user can specify target dev for network interfaces
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1265142620 28800
# Node ID f74f985dfa2a4427ebbde3ab117b2b37463dd762
# Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493
[TEST] #2 Verify that user can specify target dev for network interfaces
Updates:
-Fix typo is error message
-Start guest after defining it
-Generate a random number to use in the NIC target device name. This will
help ensure the device name is unique.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 3655b03ada11 -r f74f985dfa2a suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py Tue Feb 02 12:30:20 2010 -0800
@@ -0,0 +1,147 @@
+#!/usr/bin/python
+#
+# Copyright 2010 IBM Corp.
+#
+# Authors:
+# Kaitlin Rupert <karupert(a)us.ibm.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Purpose:
+# Verify provider's support for specifying the target device for vNICs
+#
+# Steps:
+# 1) Build RASD parameters, making sure to specify target device for network
+# interface
+# 2) Create guest
+# 3) Verify guest is defined properly
+#
+
+import sys
+from random import randint
+from CimTest.Globals import logger
+from CimTest.ReturnCodes import FAIL, PASS, SKIP
+from XenKvmLib.classes import get_typed_class, inst_to_mof
+from XenKvmLib.rasd import get_default_rasds
+from XenKvmLib.const import do_main, get_provider_version
+from XenKvmLib.vxml import get_class
+from XenKvmLib.common_util import parse_instance_id
+from XenKvmLib.enumclass import EnumInstances
+from XenKvmLib.xm_virt_util import active_domain_list, domain_list
+
+sup_types = ['Xen', 'XenFV', 'KVM']
+test_dom = 'rstest_nic'
+
+target_dev_rev = 1028
+
+def get_rasd_list(ip, virt, target_dev):
+ nrasd_cn = get_typed_class(virt, "NetResourceAllocationSettingData")
+
+ rasds = get_default_rasds(ip, virt)
+
+ rasd_list = {}
+
+ for rasd in rasds:
+ if rasd.classname == nrasd_cn and "Default" in rasd['InstanceID']:
+
+ rasd['VirtualDevice'] = target_dev
+
+ rasd_list[rasd.classname] = inst_to_mof(rasd)
+
+ return rasd_list
+
+def verify_net_rasd(ip, virt, target_dev, guest_name):
+ inst = None
+
+ try:
+ nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData')
+ enum_list = EnumInstances(ip, nrasd_cn)
+
+ if enum_list < 1:
+ raise Exception("No %s instances returned" % nrasd_cn)
+
+ for rasd in enum_list:
+ guest, dev, status = parse_instance_id(rasd.InstanceID)
+ if status != PASS:
+ raise Exception("Unable to parse InstanceID: %s" % \
+ rasd.InstanceID)
+
+ if guest == guest_name:
+ inst = rasd
+ break
+
+ if inst is None:
+ raise Exception("%s instance for %s not found" % (nrasd_cn,
+ guest_name))
+
+ if inst.VirtualDevice != target_dev:
+ raise Exception("Expected VirtualDevice to be %s" % target_dev)
+
+ except Exception, details:
+ logger.error(details)
+ return FAIL
+
+ return PASS
+
+@do_main(sup_types)
+def main():
+ options = main.options
+
+ status = FAIL
+
+ curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
+ if curr_cim_rev < target_dev_rev:
+ logger.error("Network interface target device support is available" \
+ " in rev >= %s", target_dev_rev)
+ return SKIP
+
+ cxml = get_class(options.virt)(test_dom)
+
+ tap_num = randint(1, 100)
+ target_dev = "vtap%s" % tap_num
+
+ try:
+ rasd_list = get_rasd_list(options.ip, options.virt, target_dev)
+ if len(rasd_list) < 1:
+ raise Exception("Unable to get template RASDs for %s" % test_dom)
+
+ cxml.set_res_settings(rasd_list)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ raise Exception("Unable to define %s" % test_dom)
+
+ status = cxml.cim_start(options.ip)
+ if status != PASS:
+ raise Exception("Unable to start %s" % test_dom)
+
+ status = verify_net_rasd(options.ip, options.virt, target_dev, test_dom)
+ if status != PASS:
+ raise Exception("Failed to add net interface for %s" % test_dom)
+
+ except Exception, details:
+ logger.error(details)
+ status = FAIL
+
+ if test_dom in active_domain_list(options.ip, options.virt):
+ cxml.cim_destroy(options.ip)
+
+ if test_dom in domain_list(options.ip, options.virt):
+ cxml.undefine(options.ip)
+
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
+
14 years, 7 months
Tyrel Datwyler is out of the office.
by Tyrel Datwyler
I will be out of the office starting 03/09/2010 and will not return until
03/12/2010.
I will respond to your message when I return.
14 years, 7 months