[Libvirt-cim] [PATCH 2 of 3] Adoption of changes to RegisteredProfile

Heidi Eckhart heidieck at linux.vnet.ibm.com
Tue Nov 27 09:08:35 UTC 2007


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1196157587 -3600
# Node ID 690413b4aef454d03ce31003feea55a65fa5347b
# Parent  c3f590ec1553352439cbc6a884817ac13dc8eb40
Adoption of changes to RegisteredProfile
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r c3f590ec1553 -r 690413b4aef4 src/Virt_ElementConformsToProfile.c
--- a/src/Virt_ElementConformsToProfile.c	Tue Nov 27 10:43:39 2007 +0100
+++ b/src/Virt_ElementConformsToProfile.c	Tue Nov 27 10:59:47 2007 +0100
@@ -133,9 +133,14 @@ static CMPIStatus elem_to_prof(const CMP
 {
         CMPIStatus s = {CMPI_RC_OK, NULL};
         CMPIInstance *instance;
+        virConnectPtr conn = NULL;
         char *classname;
         struct reg_prof *candidate;
         int i;
+
+        conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
+        if (conn == NULL)
+                return s;
 
         classname = class_base_name(CLASSNAME(ref));
         if (classname == NULL) {
@@ -151,10 +156,12 @@ static CMPIStatus elem_to_prof(const CMP
 
                 instance = reg_prof_instance(_BROKER, 
                                              "/root/interop", 
-                                             NULL, 
+                                             NULL,
+                                             conn,
                                              candidate);
                 if (instance == NULL) {
-                        CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
+                        CMSetStatusWithChars(_BROKER, &s, 
+                                             CMPI_RC_ERR_FAILED,
                                              "Can't create profile instance.");
                         goto error;
                 }
@@ -165,6 +172,8 @@ static CMPIStatus elem_to_prof(const CMP
  error:                
         free(classname);
  out:
+        virConnectClose(conn);
+
         return s;
 }
 




More information about the Libvirt-cim mailing list