[PATCH 0 of 2] #2 - Check for matching hypervisor prefixes
by Heidi Eckhart
- renamed helper function to match_hypervisor_prefix to become clearer on the intent
- updated ECTP to make use of match_hypervisor_prefix() function
If this approach is ok, I can coop up a patch set for all association classes.
16 years, 9 months
[PATCH 00 of 17] #2 Updates for libcmpiutil API change
by Dan Smith
Fixed ElementCapabilities after Kaitlin's recent fix patch.
Fixed the STREQ check that was accidentally removed in the last version.
This refactors all of the necessary functions in libvirt-cim for the new
API. Things only got cleaner, I think. I also found a substantial number
of memory leaks in the process, which are fundamentally fixed by the new
API which I think is a validation of it as "the right thing to do". All
required changes should have been easily spotted by the compiler, but some
testing would be good.
16 years, 9 months
Re: [Libvirt-cim] [PATCH 06 of 18] Fixes to VSMS for libcmpiutil API change
by Kaitlin Rupert
Kaitlin Rupert wrote:
> Dan Smith wrote:
>> No, that case is still handled. For full context:
>>
>> + if (cu_get_str_prop(inst, "NetworkType", &val) !=
>> CMPI_RC_OK)
>> + val = "bridge";
>> +
>> free(dev->dev.net.type);
>> - cu_get_str_prop(inst, "NetworkType",
>> &dev->dev.net.type);
>> - if (dev->dev.net.type == NULL)
>> - dev->dev.net.type = strdup("bridge");
>> + dev->dev.net.type = strdup(val);
>>
>> I moved the "not set" (NULL) case above, and set val to "bridge", so
>> that below, I can assume it is a valid const string and strdup it
>> directly. So val either gets the actual type, or "bridge" by the time
>> I get to the strdup.
>>
>> I did the same reordering in disk with the Address field, making
>> "/dev/null" the default if unspecified.
Oops.. thanks for the clarification. I caught the Address part, but I
missed it for the NetworkType part. Looks good then. =)
--
Kaitlin Rupert
IBM Linux Technology Center
karupert(a)us.ibm.com
16 years, 9 months
[PATCH 00 of 18] Updates for libcmpiutil API change
by Dan Smith
This refactors all of the necessary functions in libvirt-cim for the new
API. Things only got cleaner, I think. I also found a substantial number
of memory leaks in the process, which are fundamentally fixed by the new
API which I think is a validation of it as "the right thing to do". All
required changes should have been easily spotted by the compiler, but some
testing would be good.
Tip: To find the leaks, note every time we convert a variable from
char * to const char * and don't remove a subsequent free() call :)
16 years, 9 months
Best practices for patchsets
by Jay Gagnon
Lately we've been having more groups of patches than single patches,
which I believe to be a good thing because it also means we've been
getting less 500 line patches entitled "Fix everything." :) However,
it's also increasing our opportunity for confusion, as we have more
opportunity for patchset fragmentation. I have a couple of suggestions
for how we should handle patchsets, along with a few things that have
been floating around my head for a while about patches in general, so
I'm laying them out here. I'd like to know what everybody thinks, and
eventually get the final version somewhere on the website as well.
Patches in general:
1. When you add a patch to the queue you have an idea of where you're
going with it, and the commit message should reflect that. Be
specific. We have a tendency to say something like "Various fixes to
AllocationCapabilities" (I'm a huge offender here), when we really
should be saying what was actually fixed, like "add EnumInstances
support" or "eliminate duplicate instances."
2. Stay on task with a patch. If you notice other problems while you
are working on patch, and they are not most definitely specific to your
patch, they should be another patch.
3. This will sound a lot like "Stay on task," but resist the temptation
to nitpick with a patch. I have a peculiar desire to have all declares
at the beginning of the function, sorted according to length in
ascending order. We all have our own idea on how best to name a
variable or format a function call. Often, the change is in fact
worthwhile, and is welcome, but lots of little changes that don't
directly relate to a fix can really make that patch hard to read. They
should be another patch.
4. Before you type, "hg email," you should always type, "hg export,"
first. Review your patch. Does it have any typos in the comments? Did
you accidentally include an irrelevant change? Is your commit message
still accurate and useful?
Patchsets:
1. When you send a group of patches, Mercurial's email extension will
create a "header" email. Make the subject and body of that email
meaningful, so we know how the patches relate. It's easy to say, "Each
patch has a commit message, it's obvious how they work together," but
the rest of the list usually won't agree with that. If the commit
messages for each patch are good, you shouldn't need more than a
sentence or two to tie them all together, but you do need it.
2. If any of your patches are rejected and you rework them, resend the
entire set. This prevents things like, "So use patch 1 of 4 from the
set I sent yesterday, 2 and 3 of 4 from the patch I sent an hour later,
and patch 4 of 4 from today."
3. If you resend a patchset, and the "Patch [0 of 3]" subject line was,
"AllocationCapabilities fix," then the new subject line should be,
"AllocationCapabilities fix, version 2." This will make it easier for
email clients to thread things correctly, and for human readers to know
they are looking at the most current revision of your set.
I think that's everything for now. Additions, comments, suggestions are
welcome.
--
-Jay
16 years, 9 months
[PATCH] Convert CMSetStatusWithChars calls to cu_statusf, clean up
by Jay Gagnon
# HG changeset patch
# User Jay Gagnon <grendel(a)linux.vnet.ibm.com>
# Date 1196197789 18000
# Node ID d798c4c8a940eeb6d24cdb89eb0bf7141c928e19
# Parent c1c0c6a064474701ec5e743d32819f179553c540
Convert CMSetStatusWithChars calls to cu_statusf, clean up.
We use cu_statusf everywhere already, the minimum call syntax is the same (plus printf style formatting for free) and the name is about sixty characters shorter.
Also make sure the calls are formatted correctly.
Signed-off-by: Jay Gagnon <grendel(a)linux.vnet.ibm.com>
diff -r c1c0c6a06447 -r d798c4c8a940 libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Mon Nov 26 10:32:08 2007 -0800
+++ b/libxkutil/misc_util.c Tue Nov 27 16:09:49 2007 -0500
@@ -60,9 +60,9 @@ virConnectPtr connect_by_classname(const
uri = cn_to_uri(classname);
if (!uri) {
- CMSetStatusWithChars(broker, s,
- CMPI_RC_ERR_FAILED,
- "Unable to generate URI from classname");
+ cu_statusf(broker, s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to generate URI from classname");
return NULL;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_AllocationCapabilities.c
--- a/src/Virt_AllocationCapabilities.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_AllocationCapabilities.c Tue Nov 27 16:09:49 2007 -0500
@@ -51,15 +51,17 @@ CMPIStatus get_alloc_cap(const CMPIBroke
NAMESPACE(ref));
if (rasd_type_from_classname(CLASSNAME(ref), &type) != CMPI_RC_OK) {
- CMSetStatusWithChars(broker, &s, CMPI_RC_ERR_FAILED,
- "Could not get ResourceType.");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Could not get ResourceType.");
goto out;
}
ret = asprintf(&inst_id, "%hi/%s", type, "0");
if (ret == -1) {
- CMSetStatusWithChars(broker, &s, CMPI_RC_ERR_FAILED,
- "Could not get InstanceID.");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Could not get InstanceID.");
goto out;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_ComputerSystem.c Tue Nov 27 16:09:49 2007 -0500
@@ -446,9 +446,9 @@ static CMPIStatus GetInstance(CMPIInstan
if (name == NULL) {
CMPIStatus s;
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "No domain name specified");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "No domain name specified");
return s;
}
@@ -492,15 +492,15 @@ static CMPIStatus state_change_enable(vi
break;
default:
printf("Cannot go to enabled state from %i\n", info->state);
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Invalid state transition");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Invalid state transition");
};
if (ret != 0)
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Domain Operation Failed");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Domain Operation Failed");
return s;
}
@@ -517,15 +517,15 @@ static CMPIStatus state_change_disable(v
break;
default:
printf("Cannot go to disabled state from %i\n", info->state);
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Invalid state transition");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Invalid state transition");
};
if (ret != 0)
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Domain Operation Failed");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Domain Operation Failed");
return s;
}
@@ -541,15 +541,15 @@ static CMPIStatus state_change_pause(vir
ret = virDomainSuspend(dom);
break;
default:
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Domain not running");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Domain not running");
};
if (ret != 0)
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Domain Operation Failed");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Domain Operation Failed");
return s;
}
@@ -565,15 +565,15 @@ static CMPIStatus state_change_reboot(vi
ret = virDomainReboot(dom, 0);
break;
default:
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Domain not running");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Domain not running");
};
if (ret != 0)
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Domain Operation Failed");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Domain Operation Failed");
return s;
}
@@ -589,15 +589,15 @@ static CMPIStatus state_change_reset(vir
ret = domain_reset(dom);
break;
default:
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Domain not running");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Domain not running");
};
if (ret != 0)
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Domain Operation Failed");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Domain Operation Failed");
return s;
}
@@ -617,16 +617,16 @@ static CMPIStatus __state_change(char *n
dom = virDomainLookupByName(conn, name);
if (dom == NULL) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Domain not found");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Domain not found");
goto out;
}
if (virDomainGetInfo(dom, &info) != 0) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Unable to get current state");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to get current state");
goto out;
}
@@ -670,9 +670,9 @@ static CMPIStatus state_change(CMPIMetho
name = cu_get_str_path(reference, "Name");
if (name == NULL) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Name key not specified");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Name key not specified");
goto out;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_Device.c
--- a/src/Virt_Device.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_Device.c Tue Nov 27 16:09:49 2007 -0500
@@ -371,9 +371,9 @@ static CMPIStatus enum_devices(const CMP
return s;
if (!dom_list_devices(conn, reference, &list)) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Failed to list domains");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to list domains");
return s;
}
@@ -492,9 +492,9 @@ static CMPIStatus get_device(const CMPIO
CMReturnInstance(results, inst);
CMSetStatus(&s, CMPI_RC_OK);
} else {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Unable to get device instance");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to get device instance");
}
virConnectClose(conn);
@@ -531,9 +531,9 @@ static CMPIStatus GetInstance(CMPIInstan
if (devid == NULL) {
CMPIStatus s;
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "No DeviceID specified");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "No DeviceID specified");
return s;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_ElementCapabilities.c
--- a/src/Virt_ElementCapabilities.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_ElementCapabilities.c Tue Nov 27 16:09:49 2007 -0500
@@ -67,7 +67,8 @@ static CMPIStatus sys_to_cap(const CMPIO
sys_name = cu_get_str_path(ref, "Name");
if (!STREQ(sys_name, host_name)) {
- cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED,
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
"System '%s' is not a host system.", sys_name);
goto out;
}
@@ -203,8 +204,9 @@ static CMPIStatus pool_to_alloc(const CM
inst_id = cu_get_str_path(ref, "InstanceID");
if (inst_id == NULL) {
- CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
- "Could not get InstanceID.");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Could not get InstanceID.");
goto out;
}
@@ -216,8 +218,9 @@ static CMPIStatus pool_to_alloc(const CM
ret = cu_get_u16_path(ref, "ResourceType", &type);
if (ret != 1) {
- CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
- "Could not get ResourceType.");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Could not get ResourceType.");
goto out;
}
CMSetProperty(inst, "ResourceType", &type, CMPI_uint16);
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_ElementConformsToProfile.c
--- a/src/Virt_ElementConformsToProfile.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_ElementConformsToProfile.c Tue Nov 27 16:09:49 2007 -0500
@@ -60,9 +60,9 @@ static CMPIStatus elem_instances(const C
classname = get_typed_class("Xen", profile->provider_name);
if (classname == NULL) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Can't assemble classname." );
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Can't assemble classname." );
goto out;
}
@@ -72,18 +72,18 @@ static CMPIStatus elem_instances(const C
en = CBEnumInstances(_BROKER, info->context , op, NULL, &s);
if (en == NULL) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Upcall enumInstances to target class failed.");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Upcall enumInstances to target class failed.");
goto error;
}
while (CMHasNext(en, &s)) {
data = CMGetNext(en, &s);
if (CMIsNullObject(data.value.inst)) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Failed to retrieve enumeration entry.");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to retrieve enumeration entry.");
goto error;
}
@@ -106,9 +106,9 @@ static CMPIStatus prof_to_elem(const CMP
id = cu_get_str_path(ref, "InstanceID");
if (id == NULL) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "No InstanceID specified");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "No InstanceID specified");
goto out;
}
@@ -139,8 +139,9 @@ static CMPIStatus elem_to_prof(const CMP
classname = class_base_name(CLASSNAME(ref));
if (classname == NULL) {
- CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
- "Can't get class name.");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Can't get class name.");
goto out;
}
@@ -154,8 +155,9 @@ static CMPIStatus elem_to_prof(const CMP
NULL,
candidate);
if (instance == NULL) {
- CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
- "Can't create profile instance.");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Can't create profile instance.");
goto error;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_EnabledLogicalElementCapabilities.c
--- a/src/Virt_EnabledLogicalElementCapabilities.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_EnabledLogicalElementCapabilities.c Tue Nov 27 16:09:49 2007 -0500
@@ -64,8 +64,9 @@ static CMPIStatus set_inst_properties(co
devid = get_fq_devid((char *)sys_name, "0");
if (devid == NULL) {
- CMSetStatusWithChars(broker, &s, CMPI_RC_ERR_FAILED,
- "Could not get full ID.");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Could not get full ID.");
goto error1;
}
@@ -112,34 +113,34 @@ CMPIStatus get_ele_cap(const CMPIBroker
sys_name = cu_get_str_path(ref, "Name");
if (sys_name == NULL) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Missing key: Name");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Missing key: Name");
goto out;
}
classname = get_typed_class(CLASSNAME(ref),
"EnabledLogicalElementCapabilities");
if (classname == NULL) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Invalid class");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Invalid class");
goto out;
}
op = CMNewObjectPath(broker, NAMESPACE(ref), classname, &s);
if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Cannot get object path for ELECapabilities");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Cannot get object path for ELECapabilities");
goto out;
}
*inst = CMNewInstance(broker, op, &s);
if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(*inst))) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Failed to instantiate HostSystem");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to instantiate HostSystem");
goto out;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_HostSystem.c
--- a/src/Virt_HostSystem.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_HostSystem.c Tue Nov 27 16:09:49 2007 -0500
@@ -67,25 +67,25 @@ CMPIStatus get_host_cs(const CMPIBroker
classname = get_typed_class(CLASSNAME(reference), "HostSystem");
if (classname == NULL) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Invalid class");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Invalid class");
goto out;
}
op = CMNewObjectPath(broker, ns, classname, &s);
if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Cannot get object path for HostSystem");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Cannot get object path for HostSystem");
goto out;
}
inst = CMNewInstance(broker, op, &s);
if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(op))) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Failed to instantiate HostSystem");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to instantiate HostSystem");
goto out;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_HostedDependency.c
--- a/src/Virt_HostedDependency.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_HostedDependency.c Tue Nov 27 16:09:49 2007 -0500
@@ -66,9 +66,9 @@ static CMPIStatus host_to_vs(const CMPIO
if (ret) {
CMSetStatus(&s, CMPI_RC_OK);
} else {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Failed to get domain list");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to get domain list");
}
CMSetStatus(&s, CMPI_RC_OK);
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_HostedResourcePool.c
--- a/src/Virt_HostedResourcePool.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_HostedResourcePool.c Tue Nov 27 16:09:49 2007 -0500
@@ -71,8 +71,7 @@ static CMPIStatus sys_to_pool(const CMPI
if (prop != NULL) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_NOT_FOUND,
- "No such HostSystem instance (%s)",
- prop);
+ "No such HostSystem instance (%s)", prop);
return s;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_RegisteredProfile.c
--- a/src/Virt_RegisteredProfile.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_RegisteredProfile.c Tue Nov 27 16:09:49 2007 -0500
@@ -103,8 +103,9 @@ static CMPIStatus enum_profs(const CMPIO
properties,
profiles[i]);
if (instance == NULL) {
- CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
- "Can't create profile instance.");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Can't create profile instance.");
goto out;
}
@@ -129,9 +130,9 @@ static CMPIStatus get_prof(const CMPIObj
id = cu_get_str_path(ref, "InstanceID");
if (id == NULL) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "No InstanceID specified");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "No InstanceID specified");
return s;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_SettingsDefineCapabilities.c Tue Nov 27 16:09:49 2007 -0500
@@ -697,8 +697,9 @@ static CMPIInstance *sdc_rasd_inst(const
range = SDC_RANGE_POINT;
break;
default:
- CMSetStatusWithChars(broker, s, CMPI_RC_ERR_FAILED,
- "Unsupported sdc_rasd type.");
+ cu_statusf(broker, s,
+ CMPI_RC_ERR_FAILED,
+ "Unsupported sdc_rasd type.");
goto out;
}
@@ -765,8 +766,9 @@ static CMPIStatus sdc_rasds_for_type(con
} else {
CU_DEBUG("Unsupported type.");
- CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
- "Unsupported device type.");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unsupported device type.");
}
out:
@@ -785,8 +787,9 @@ static CMPIStatus alloc_cap_to_rasd(cons
ret = cu_get_u16_path(ref, "ResourceType", &type);
if (ret != 1) {
- CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
- "Could not get ResourceType.");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Could not get ResourceType.");
goto out;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_VSSD.c
--- a/src/Virt_VSSD.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_VSSD.c Tue Nov 27 16:09:49 2007 -0500
@@ -143,9 +143,9 @@ static CMPIStatus enum_vssd(const CMPIOb
count = get_domain_list(conn, &list);
if (count < 0) {
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Failed to enumerate domains");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to enumerate domains");
goto out;
} else if (count == 0) {
CMSetStatus(&s, CMPI_RC_OK);
@@ -229,7 +229,7 @@ static CMPIStatus GetInstance(CMPIInstan
if (!parse_instanceid(reference, NULL, &locid)) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
- "Invalid InstanceID specified");
+ "Invalid InstanceID specified");
return s;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_VirtualSystemManagementCapabilities.c
--- a/src/Virt_VirtualSystemManagementCapabilities.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_VirtualSystemManagementCapabilities.c Tue Nov 27 16:09:49 2007 -0500
@@ -60,8 +60,9 @@ static CMPIStatus set_inst_properties(co
devid = get_fq_devid((char *)sys_name, "0");
if (devid == NULL) {
- CMSetStatusWithChars(broker, &s, CMPI_RC_ERR_FAILED,
- "Could not get full ID.");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Could not get full ID.");
goto out;
}
CMSetProperty(inst, "InstanceID", (CMPIValue *)devid, CMPI_chars);
@@ -99,34 +100,34 @@ CMPIStatus get_vsm_cap(const CMPIBroker
sys_name = cu_get_str_path(ref, "Name");
if (sys_name == NULL) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Missing key: Name");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Missing key: Name");
goto out;
}
classname = get_typed_class(CLASSNAME(ref),
"VirtualSystemManagementCapabilities");
if (classname == NULL) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Invalid class");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Invalid class");
goto out;
}
op = CMNewObjectPath(broker, NAMESPACE(ref), classname, &s);
if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Cannot get object path for VSMCapabilities");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Cannot get object path for VSMCapabilities");
goto out;
}
*inst = CMNewInstance(broker, op, &s);
if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(*inst))) {
- CMSetStatusWithChars(broker, &s,
- CMPI_RC_ERR_FAILED,
- "Failed to instantiate HostSystem");
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to instantiate HostSystem");
goto out;
}
diff -r c1c0c6a06447 -r d798c4c8a940 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Mon Nov 26 10:32:08 2007 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Tue Nov 27 16:09:49 2007 -0500
@@ -108,9 +108,9 @@ static CMPIStatus define_system_parse_ar
sys);
if (ret) {
CU_DEBUG("Unable to parse SystemSettings instance");
- CMSetStatusWithChars(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "SystemSettings parse error");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "SystemSettings parse error");
goto out;
}
@@ -287,9 +287,9 @@ static CMPIInstance *connect_and_create(
dom = virDomainDefineXML(conn, xml);
if (dom == NULL) {
CU_DEBUG("Failed to define domain from XML");
- CMSetStatusWithChars(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Failed to create domain");
+ cu_statusf(_BROKER, s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to create domain");
return NULL;
}
@@ -297,9 +297,9 @@ static CMPIInstance *connect_and_create(
inst = instance_from_name(_BROKER, conn, (char *)name, ref);
if (inst == NULL) {
CU_DEBUG("Failed to get new instance");
- CMSetStatusWithChars(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Failed to lookup resulting system");
+ cu_statusf(_BROKER, s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to lookup resulting system");
}
virConnectClose(conn);
@@ -636,8 +636,7 @@ static CMPIStatus _resource_dynamic(stru
if (func(dom, dev) == 0) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
- "Unable to change (%i) device",
- action);
+ "Unable to change (%i) device", action);
} else {
CMSetStatus(&s, CMPI_RC_OK);
}
@@ -670,8 +669,7 @@ static CMPIStatus resource_del(struct do
else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
- "Cannot delete resources of type %" PRIu16,
- type);
+ "Cannot delete resources of type %" PRIu16, type);
goto out;
}
@@ -716,8 +714,7 @@ static CMPIStatus resource_add(struct do
if ((type == CIM_RASD_TYPE_MEM) || (_list == NULL)) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
- "Cannot add resources of type %" PRIu16,
- type);
+ "Cannot add resources of type %" PRIu16, type);
goto out;
}
@@ -727,8 +724,7 @@ static CMPIStatus resource_add(struct do
*/
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
- "[TEMP] Cannot add resources of type %" PRIu16,
- type);
+ "[TEMP] Cannot add resources of type %" PRIu16, type);
goto out;
}
@@ -781,8 +777,7 @@ static CMPIStatus resource_mod(struct do
else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
- "Cannot modify resources of type %" PRIu16,
- type);
+ "Cannot modify resources of type %" PRIu16, type);
goto out;
}
16 years, 9 months
[PATCH] [CU] Convert to cu_statusf
by Jay Gagnon
# HG changeset patch
# User Jay Gagnon <grendel(a)linux.vnet.ibm.com>
# Date 1196198953 18000
# Node ID 7b6ed8beebcf7c15cc28f9492baa0d4ebdfb76f8
# Parent c57cd3b49b6109110331ee64ea3a629c16ff4423
[CU] Convert to cu_statusf.
Signed-off-by: Jay Gagnon <grendel(a)linux.vnet.ibm.com>
diff -r c57cd3b49b61 -r 7b6ed8beebcf std_invokemethod.c
--- a/std_invokemethod.c Tue Nov 27 12:20:06 2007 -0800
+++ b/std_invokemethod.c Tue Nov 27 16:29:13 2007 -0500
@@ -100,9 +100,9 @@ CMPIStatus _std_invokemethod(CMPIMethodM
}
if (h == NULL) {
- CMSetStatusWithChars(ctx->broker, &s,
- CMPI_RC_ERR_FAILED,
- "Unknown Method");
+ cu_statusf(ctx->broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unknown Method");
goto exit;
}
16 years, 9 months