# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1243504352 25200
# Node ID 9b503078f05e7ff90f203f1b8075cec655118b0d
# Parent 8eda9601bbace5fe53e4df54d6528d4fd3edf809
[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(a)linux.vnet.ibm.com>
diff -r 8eda9601bbac -r 9b503078f05e
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 Thu
May 28 02:52:32 2009 -0700
@@ -0,0 +1,102 @@
+#!/usr/bin/python
+#
+# Copyright 2009 IBM Corp.
+#
+# Authors:
+# Deepti B. Kalakeri<dkalaker(a)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 }
+
+
+@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())