[Libvirt-cim] [PATCH] [TEST] Add new tc to verify dir type diskpool creations using CreateChildResourcePool()

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Tue May 26 12:25:52 UTC 2009


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>
# Date 1243340705 25200
# Node ID 7329a4c6f1884c4be3e3f042a704f56410bea3fa
# Parent  b417a41ea09985ad7aaabc642496c86e25c5d404
[TEST] Add new tc to verify dir type diskpool creations using CreateChildResourcePool().

This test case should be applied on top of
"(#2) Return SKIP if the provider version doesn't support template pool RASDs"

Tested with KVM on F10 with current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik at linux.vnet.ibm.com>

diff -r b417a41ea099 -r 7329a4c6f188 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/08_CreateDiskResourcePool.py	Tue May 26 05:25:05 2009 -0700
@@ -0,0 +1,102 @@
+#!/usr/bin/python
+#
+# Copyright 2009 IBM Corp.
+#
+# Authors:
+#    Deepti B. Kalakeri<dkalaker at in.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
+#
+# This test case should test the  CreateChildResourcePool service 
+# supplied by the RPCS provider. 
+# Input 
+# -----
+# IN -- ElementName -- String -- The desired name of the resource pool
+# IN -- Settings    -- String -- A string representation of a
+#                                CIM_ResourceAllocationSettingData 
+#                                instance that represents the allocation 
+#                                assigned to this child pool
+# IN -- ParentPool  -- CIM_ResourcePool REF -- The parent pool from which 
+#                                              to create this pool
+# 
+# Output
+# ------
+# OUT -- Pool -- CIM_ResourcePool REF -- The resulting resource pool
+# OUT -- Job  -- CIM_ConcreteJob REF -- Returned job if started
+# OUT -- Error -- String  -- Encoded error instance if the operation 
+#                            failed and did not return a job
+#
+# Exception details before Revision 846
+# -----
+# Error code: CIM_ERR_NOT_SUPPORTED 
+#
+# After revision 846, the service is implemented
+#
+#                                                   -Date: 26.05.2009
+
+import sys
+from CimTest.Globals import logger
+from CimTest.ReturnCodes import FAIL, PASS
+from XenKvmLib.const import do_main, platform_sup
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.common_util import destroy_diskpool
+from XenKvmLib.pool import create_pool, verify_pool, undefine_diskpool
+
+test_pool = "diskpool"
+dp_types =  { "DISK_POOL_DIR" : 1 }
+               
+
+ at do_main(platform_sup)
+def main():
+    options = main.options
+    server = options.ip
+    virt = options.virt
+    pool_attr = { "Path" : "/tmp" }
+
+    # For now the test case support only the creation of 
+    # dir type disk pool, later change to fs and netfs etc 
+    for key, value in dp_types.iteritems():    
+        status = create_pool(server, virt, test_pool, pool_attr, 
+                             mode_type=value, pool_type= "DiskPool")
+        if status != PASS:
+            logger.error("Failed to create '%s' type diskpool '%s'", 
+                          key, test_pool)
+            return FAIL
+
+        status = verify_pool(server, virt, test_pool, pool_attr, 
+                             mode_type=value, pool_type="DiskPool")
+        if status != PASS:
+            logger.error("Error in diskpool verification")
+            destroy_diskpool(server, virt, test_pool)
+            undefine_diskpool(server, virt, test_pool)
+            return FAIL
+
+        status = destroy_diskpool(server, virt, test_pool)
+        if status != PASS:
+            logger.error("Unable to destroy diskpool '%s'", test_pool)
+            return FAIL
+
+        status = undefine_diskpool(server, virt, test_pool)
+        if status != PASS:
+            logger.error("Unable to undefine diskpool '%s'", test_pool)
+            return FAIL
+
+        status = PASS
+ 
+    return status
+
+if __name__ == "__main__":
+    sys.exit(main())
diff -r b417a41ea099 -r 7329a4c6f188 suites/libvirt-cim/lib/XenKvmLib/pool.py
--- a/suites/libvirt-cim/lib/XenKvmLib/pool.py	Tue May 26 00:10:35 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py	Tue May 26 05:25:05 2009 -0700
@@ -230,7 +230,7 @@
                    break
 
             pool_settings = inst_to_mof(n_d_pool_rasds[i])
-            
+
         try:
             rpcs_conn.CreateChildResourcePool(ElementName=test_pool, 
                                               Settings=[pool_settings])




More information about the Libvirt-cim mailing list