+def try_define(options, service, vssd, units, value):
The service param isn't used in this function.
+@do_main(sup_types)
+def main():
+ options = main.options
+
+ vssd_class = vsms.get_vssd_class(options.virt)
+ vssd = vssd_class(name=default_dom, virt=options.virt)
+
+ try:
+ service = vsms.enumerate_instances(options.ip, options.virt)[0]
+ except Exception, e:
+ logger.error("Did not find VSMS instance: %s" % e)
+ return FAIL
This block can be removed since it's not being used.
+
+ status = PASS
+
+ for units, shift in values:
+ value = mem_bytes >> shift
+
+ if not try_define(options, service, vssd, units, value):
+ status = FAIL
+ break
+
+ if not check_value(options):
+ status = FAIL
+ break
+
+ undefine_test_domain(default_dom, options.ip, virt=options.virt)
+
+ try:
+ undefine_test_domain(default_dom, options.ip, virt=options.virt)
+ except Exception, e:
+ pass
Why put the second call to undefine_test_domain() in a try / catch
block? The first call isn't in a try/catch block. Even if the guest has
already been undefined, this shouldn't thrown an exception. The virsh
undefine call should fail.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com