# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1195073495 28800
# Node ID 7798be3698b4a53c1301dc3e3f4a4bfd1bc9e37b
# Parent d2bcdde08df6080caa9ae8d152d516d232fb6345
Fix crash and/or error when diskpool.conf does not exist
Previously, a missing diskpool configuration file returned an error, which
prevented enumeration of all CIM_ResourcePool objects. This changes that
behavior to consider a lack of a diskpool.conf file to mean "no disk pools
have been defined", equivalent to how a lack of bridges indicates that no
network pools have been defined.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r d2bcdde08df6 -r 7798be3698b4 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c Tue Nov 13 14:18:17 2007 -0800
+++ b/src/Virt_DevicePool.c Wed Nov 14 12:51:35 2007 -0800
@@ -505,18 +505,14 @@ static CMPIStatus diskpool_instance(virC
const char *id,
const CMPIBroker *broker)
{
- CMPIStatus s;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
struct disk_pool *pools = NULL;
int count = 0;
int i;
count = get_diskpool_config(&pools);
- if ((id == NULL) && (count == 0)) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "No such pool `%s'", id);
- goto out;
- }
+ if ((id == NULL) && (count == 0))
+ return s;
for (i = 0; i < count; i++) {
CMPIInstance *pool;
@@ -533,8 +529,6 @@ static CMPIStatus diskpool_instance(virC
inst_list_add(list, pool);
}
- CMSetStatus(&s, CMPI_RC_OK);
- out:
free_diskpool(pools, count);
return s;