# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1195487994 28800
# Node ID ef1552498688b0892f2c8d65c238da1d4a765e9c
# Parent b9d3217689a1335a1a1c2eded1f52ad36f91e978
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 b9d3217689a1 -r ef1552498688 libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Mon Nov 19 07:59:52 2007 -0800
+++ b/libxkutil/misc_util.c Mon Nov 19 07:59:54 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;
}