# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1204720826 -3600
# Node ID d7dd02fed84faa2d851640208da564c4593c8ddb
# Parent e486d9c03b54fb4bf491f7d94e02845279bec775
SD: adopt Device interface changes
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r e486d9c03b54 -r d7dd02fed84f src/Virt_SystemDevice.c
--- a/src/Virt_SystemDevice.c Wed Mar 05 13:40:23 2008 +0100
+++ b/src/Virt_SystemDevice.c Wed Mar 05 13:40:26 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_TYPE_ALL, list);
out:
return s;