
# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1205144841 -3600 # Node ID 44dbfd6d4a6577815fb8522a3a874e0149aaaff1 # Parent e44c304b5c6c81e82b55841988ffbe31d9e643b9 SD: adopt Device interface changes - update resource type to CIM_RES_TYPE_foo Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r e44c304b5c6c -r 44dbfd6d4a65 src/Virt_SystemDevice.c --- a/src/Virt_SystemDevice.c Mon Mar 10 11:26:42 2008 +0100 +++ b/src/Virt_SystemDevice.c Mon Mar 10 11:27:21 2008 +0100 @@ -48,55 +48,6 @@ const static CMPIBroker *_BROKER; -#define DEV_TYPE_COUNT 4 -const static int device_types[DEV_TYPE_COUNT] = - {VIRT_DEV_NET, - VIRT_DEV_DISK, - VIRT_DEV_MEM, - VIRT_DEV_VCPU, - }; - -static int get_dom_devices(const char *name, - struct inst_list *list, - int type, - const char *host_cn, - const char *ns) -{ - virConnectPtr conn = NULL; - virDomainPtr dom = NULL; - CMPIStatus s; - int ret = 0; - - conn = connect_by_classname(_BROKER, host_cn, &s); - if (conn == NULL) - goto out; - - dom = virDomainLookupByName(conn, name); - if (dom == NULL) - goto out; - - ret = dom_devices(_BROKER, dom, ns, type, list); - - virDomainFree(dom); - out: - virConnectClose(conn); - - return ret; -} - -static int get_all_devices(const char *name, - struct inst_list *list, - const char *host_cn, - const char *ns) -{ - int i; - - for (i = 0; i < DEV_TYPE_COUNT; i++) - get_dom_devices(name, list, device_types[i], host_cn, ns); - - return i; -} - static CMPIStatus sys_to_dev(const CMPIObjectPath *ref, struct std_assoc_info *info, struct inst_list *list) @@ -104,7 +55,6 @@ static CMPIStatus sys_to_dev(const CMPIO const char *host = NULL; CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; - int ret; if (!match_hypervisor_prefix(ref, info)) return s; @@ -120,20 +70,7 @@ static CMPIStatus sys_to_dev(const CMPIO goto out; } - ret = get_all_devices(host, - list, - CLASSNAME(ref), - NAMESPACE(ref)); - - if (ret >= 0) { - cu_statusf(_BROKER, &s, - CMPI_RC_OK, - ""); - } else { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Unable to get devices"); - } + s = enum_devices(_BROKER, ref, host, CIM_RES_TYPE_ALL, list); out: return s;