[Libvirt-cim] [PATCH 4 of 4] VSSDC: adopt interface changes in VSSD

Heidi Eckhart heidieck at linux.vnet.ibm.com
Fri Feb 22 09:30:23 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1203672204 -3600
# Node ID 4ff6b2e7bf752cdb4d60841e62815740a3deee05
# Parent  bef4df9bf1109545c067010d83af3b12782632d0
VSSDC: adopt interface changes in VSSD
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r bef4df9bf110 -r 4ff6b2e7bf75 src/Virt_VSSDComponent.c
--- a/src/Virt_VSSDComponent.c	Fri Feb 22 09:59:01 2008 +0100
+++ b/src/Virt_VSSDComponent.c	Fri Feb 22 10:23:24 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);




More information about the Libvirt-cim mailing list