Kaitlin Rupert wrote:
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1224123190 25200
# Node ID 16ed883b2d333bfe73059c319b011e5fe6153ae8
# Parent 31fca7629bd7f394c3a900c9f20c5573bcedc1f7
[TEST] #2 Add VirtualSystemManagementService - 14_define_sys_disk.py
This test defines a guest with a very large disk image. This test can be updated in the
future to include other disk specific DefineSystem() tests.
Updates:
-Remove call to default_vssd_rasd_str(); replace with call to get_vssd_mof()
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 31fca7629bd7 -r 16ed883b2d33
suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py Wed
Oct 15 19:13:10 2008 -0700
@@ -0,0 +1,99 @@
+#!/usr/bin/python
+#
+# Copyright 2008 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
+#
+
+import sys
+import os
+from VirtLib.utils import run_remote
+from CimTest.Globals import logger
+from CimTest.ReturnCodes import FAIL, PASS
+from XenKvmLib.const import do_main, _image_dir
+from XenKvmLib.common_util import create_using_definesystem
+from XenKvmLib.test_doms import destroy_and_undefine_domain
+from XenKvmLib.classes import get_typed_class, inst_to_mof
+from XenKvmLib.rasd import get_default_rasds
+from XenKvmLib.vsms import get_vssd_mof
+
+sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
+test_dom = 'rstest_disk_domain'
+
+def make_long_disk_path(ip):
+ path = os.path.join(_image_dir, 'cimtest_large_image')
+
+ cmd = "dd if=/dev/zero of=%s bs=1M count=1 seek=8192" % path
+
+ rc, out = run_remote(ip, cmd)
+ if rc != 0:
+ logger.error("Unable to create large disk image")
+ logger.error(out)
+ return None
+
+ return path
+
+def get_vssd_rasd(ip, virt, addr):
+ vssd = get_vssd_mof(virt, test_dom)
+
+ rasds = get_default_rasds(ip, virt)
+
+ for i in range(0, len(rasds)):
I think we had discussed this to be "for i in range(len(rasds))" :)
For now we can leave this as it is.
+ if rasds[i]['PoolID'].find('DiskPool') >=
0:
This can be "if 'DiskPool' in rasds[i]['PoolID']" as
an alternative.
But the above what you have also serves our purpose.
+1 for me for the changes.
+ rasds[i]['Address'] = addr
+ rasds[i] = inst_to_mof(rasds[i])
+
+ params = { 'vssd' : vssd,
+ 'rasd' : rasds
+ }
+
+ return params
+
+@do_main(sup_types)
+def main():
+ options = main.options
+
+ try:
+ addr = make_long_disk_path(options.ip)
+ if addr is None:
+ raise Exception("Unable to create large disk image")
+
+ define_params = get_vssd_rasd(options.ip, options.virt, addr)
+ if len(define_params) != 2:
+ raise Exception("Unable to get VSSD and RASDs for %s" %
test_dom)
+
+ status = create_using_definesystem(test_dom, options.ip,
+ params=define_params,
ref_config="",
+ virt=options.virt)
+ if status != PASS:
+ raise Exception("Unable to define %s" % test_dom)
+
+ except Exception, details:
+ logger.error(details)
+ status = FAIL
+
+ if os.path.exists(addr):
+ os.remove(addr)
+
+ destroy_and_undefine_domain(test_dom, options.ip, options.virt)
+
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
+
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim