> try:
> addr = make_long_disk_path(options.ip)
> if addr is None:
> raise Exception("Unable to create large disk image")
>
You can immediately return from here instead of raising an Exception.
Also if you raise an exception then calling
cxml.undefine(options.ip) is not needed as we would have not defined the
guest.
> - define_params = get_vssd_rasd(options.ip, options.virt, addr,
> disk_cap)
> - if len(define_params) != 2:
> - raise Exception("Unable to get VSSD and RASDs for %s" %
> test_dom)
> + rasd_list = get_rasd_list(options.ip, options.virt, addr,
> disk_cap)
> + if len(rasd_list) < 1:
> + raise Exception("Unable to get template RASDs for %s" %
> test_dom)
>
> - status = create_using_definesystem(test_dom, options.ip,
> - params=define_params,
> ref_config="",
> - virt=options.virt)
> - if status != PASS:
> + cxml.set_res_settings(rasd_list)
> + ret = cxml.cim_define(options.ip)
> + if not ret:
> raise Exception("Unable to define %s" % test_dom)
>
same here.
Instead of returning immediately, I've added a flag to indicate whether
the guest should be undefined or not.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com