DK> + if len(assoc_info) < 3 :
DK> + logger.error("%s returned %i %s objects, expected atleast
3", an, len(assoc_info), qcn)
DK> + status = FAIL
DK> + except Exception, detail:
DK> + print_err(CIM_ERROR_ASSOCIATORNAMES, detail, an)
DK> + status = FAIL
DK> +
DK> + return status, assoc_info
As with the others, I think checking that it's >0 is sufficient for
validation (as long as you check that you get the expected instances
back as well) and is less prone to breakage.
DK> +def get_vsms_info():
DK> + status, host_name, classname = get_host_info(server, virt)
DK> + if status != PASS:
DK> + return status, []
DK> + status, service_assoc_info = get_assocnames_info(server, classname,
DK> + assoc_name, req_cn,
host_name)
DK> + if status != PASS or len(service_assoc_info) == 0:
DK> + return status, service_assoc_info
DK> + filter_name = {"key" : "Name"}
DK> + filter_value = 'MigrationService'
DK> + cn = 'VirtualSystemMigrationService'
DK> + status, vsms_list = get_inst_from_list(server, cn, service_assoc_info,
filter_name,
DK> +
filter_value)
As far as I can tell, get_inst_from_list() just uses the 'key' field
of filter_name directly. Please just pass the name instead of a dict.
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com