# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1195244698 28800
# Node ID 86766ef3c2479a9a5f6146e1865d94d17768a5a8
# Parent f6c11dd07703ae3f398592143b4fd31fc78f3a5d
Changes to misc_utils.c for connect_by_classname()
Includes Heidi's change to not return an error on failed connect. I chose
to leave the failure in place if a proper URI could not be determined because
this really means we were called for a prefix we don't support, which /is/ a
problem. If we need to iterate over subclasses later down the road for
differing CIMOM behavior, we should do it before we get here.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r f6c11dd07703 -r 86766ef3c247 libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Fri Nov 16 12:24:53 2007 -0800
+++ b/libxkutil/misc_util.c Fri Nov 16 12:24:58 2007 -0800
@@ -56,6 +56,8 @@ virConnectPtr connect_by_classname(const
const char *uri;
virConnectPtr conn;
+ CMSetStatus(s, CMPI_RC_OK);
+
uri = cn_to_uri(classname);
if (!uri) {
CMSetStatusWithChars(broker, s,
@@ -64,11 +66,11 @@ virConnectPtr connect_by_classname(const
return NULL;
}
+ CU_DEBUG("Connecting to libvirt with uri `%s'", uri);
+
conn = virConnectOpen(uri);
if (!conn) {
- CMSetStatusWithChars(broker, s,
- CMPI_RC_ERR_FAILED,
- "Unable to connect to hypervisor");
+ CU_DEBUG("Unable to connect to `%s'", uri);
return NULL;
}
@@ -334,28 +336,21 @@ bool provider_is_responsible(const CMPIB
const CMPIObjectPath *reference,
CMPIStatus *status)
{
- const char *dft_pfx;
char *pfx;
- bool rc = false;
+ bool rc = true;
CMSetStatus(status, CMPI_RC_OK);
pfx = class_prefix_name(CLASSNAME(reference));
- if (STREQC(pfx, "CIM"))
+ if (STREQC(pfx, "CIM")) {
cu_statusf(broker, status,
CMPI_RC_ERR_FAILED,
"Please exactly specify the class (check CIMOM
behavior!): %s",
CLASSNAME(reference));
-
- dft_pfx = default_prefix();
- if (dft_pfx == NULL)
- goto out;
-
- if (STREQC(pfx, dft_pfx))
- rc = true;
-
- out:
+ rc = false;
+ }
+
free(pfx);
return rc;
}