# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1203672861 -3600
# Node ID b9cbac659a845feda6f170fe23663ea7f187bf21
# Parent 5b9393cbce63ab45b6d5be07e1c6d5a866248ca5
VSSDC: adopt interface changes in VSSD
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r 5b9393cbce63 -r b9cbac659a84 src/Virt_VSSDComponent.c
--- a/src/Virt_VSSDComponent.c Fri Feb 22 10:34:20 2008 +0100
+++ b/src/Virt_VSSDComponent.c Fri Feb 22 10:34:21 2008 +0100
@@ -41,6 +41,7 @@ static CMPIStatus vssd_to_rasd(const CMP
struct inst_list *list)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
char *name = NULL;
int i = 0;
int types[] = {
@@ -52,7 +53,11 @@ static CMPIStatus vssd_to_rasd(const CMP
};
if (!match_hypervisor_prefix(ref, info))
- return s;
+ goto out;
+
+ s = get_vssd_by_ref(_BROKER, ref, &inst);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
if (!parse_instanceid(ref, NULL, &name)) {
cu_statusf(_BROKER, &s,
@@ -69,48 +74,9 @@ static CMPIStatus vssd_to_rasd(const CMP
list);
}
- cu_statusf(_BROKER, &s,
- CMPI_RC_OK,
- "");
- out:
free(name);
- return s;
-}
-
-static CMPIStatus vssd_for_name(const char *host,
- const CMPIObjectPath *ref,
- CMPIInstance **inst)
-{
- virConnectPtr conn = NULL;
- virDomainPtr dom = NULL;
- CMPIStatus s;
-
- conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
- if (conn == NULL)
- goto out;
-
- dom = virDomainLookupByName(conn, host);
- if (dom == NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "No such system `%s'", host);
- goto out;
- }
-
- *inst = get_vssd_instance(dom, _BROKER, ref);
- if (*inst == NULL)
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Error getting VSSD for `%s'", host);
- else
- cu_statusf(_BROKER, &s,
- CMPI_RC_OK,
- "");
out:
- virDomainFree(dom);
- virConnectClose(conn);
-
return s;
}
@@ -143,9 +109,11 @@ static CMPIStatus rasd_to_vssd(const CMP
goto out;
}
- s = vssd_for_name(host, ref, &vssd);
- if (vssd)
- inst_list_add(list, vssd);
+ s = get_vssd_by_name(_BROKER, ref, host, &vssd);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ inst_list_add(list, vssd);
out:
free(host);