[PATCH] (#2) This changes any uses of CMSetStatus() to cu_statusf()
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1203088430 28800
# Node ID 72f9d41f72aaf7d0eb06191f4170efdb9f490d9d
# Parent ae2cfc5a6a853690af1fc6821b1767e383f0d24a
(#2) This changes any uses of CMSetStatus() to cu_statusf()
With new versions of GCC, the check for (s != NULL) in the macro sets off
the "Address of `s' will always be true" warning. We don't want to turn
that warning off, so this seems like the better choice
Changes:
- Fix broken error code
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_ComputerSystem.c Fri Feb 15 07:13:50 2008 -0800
@@ -440,7 +440,9 @@ static CMPIStatus return_enum_domains(co
inst_list_init(&list);
ret = enum_domains(_BROKER, conn, NAMESPACE(reference), &list);
if (!ret) {
- CMSetStatus(&s, CMPI_RC_ERR_FAILED);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to get domain list");
goto out;
}
@@ -449,8 +451,9 @@ static CMPIStatus return_enum_domains(co
else
cu_return_instances(results, &list);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
inst_list_free(&list);
@@ -734,7 +737,9 @@ static CMPIStatus __state_change(const c
else if (state == CIM_STATE_RESET)
s = state_change_reset(dom, &info);
else
- CMSetStatus(&s, CMPI_RC_ERR_NOT_SUPPORTED);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_SUPPORTED,
+ "State not supported");
out:
virDomainFree(dom);
@@ -757,7 +762,9 @@ static CMPIStatus state_change(CMPIMetho
ret = cu_get_u16_arg(argsin, "RequestedState", &state);
if (ret != CMPI_RC_OK) {
- CMSetStatus(&s, CMPI_RC_ERR_INVALID_PARAMETER);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_INVALID_PARAMETER,
+ "Invalid RequestedState");
goto out;
}
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_Device.c
--- a/src/Virt_Device.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_Device.c Fri Feb 15 07:13:50 2008 -0800
@@ -371,7 +371,9 @@ static CMPIStatus enum_devices(const CMP
inst_list_free(&list);
out:
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
virConnectClose(conn);
return s;
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_DevicePool.c Fri Feb 15 07:13:50 2008 -0800
@@ -795,7 +795,9 @@ static CMPIStatus return_pool(const CMPI
&list);
if (s.rc == CMPI_RC_OK) {
__return_pool(results, &list, name_only);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_ElementAllocatedFromPool.c
--- a/src/Virt_ElementAllocatedFromPool.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_ElementAllocatedFromPool.c Fri Feb 15 07:13:50 2008 -0800
@@ -102,7 +102,9 @@ static CMPIStatus vdev_to_pool(const CMP
pool = get_pool_by_id(_BROKER, conn, poolid, NAMESPACE(ref));
if (pool != NULL) {
inst_list_add(list, pool);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
@@ -220,8 +222,9 @@ static CMPIStatus pool_to_vdev(const CMP
devs_from_pool(type, ref, poolid, list);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
return s;
}
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_ElementCapabilities.c
--- a/src/Virt_ElementCapabilities.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_ElementCapabilities.c Fri Feb 15 07:13:50 2008 -0800
@@ -72,7 +72,9 @@ static CMPIStatus validate_caps_get_serv
s = get_migration_service(ref, &_inst, _BROKER);
} else
- CMSetStatus(&s, CMPI_RC_ERR_NOT_FOUND);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "Not found");
*inst = _inst;
out:
@@ -103,7 +105,9 @@ static CMPIStatus validate_service_get_c
s = get_migration_caps(ref, &_inst, _BROKER);
} else
- CMSetStatus(&s, CMPI_RC_ERR_NOT_FOUND);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "");
*inst = _inst;
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_HostedDependency.c
--- a/src/Virt_HostedDependency.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_HostedDependency.c Fri Feb 15 07:13:50 2008 -0800
@@ -70,14 +70,18 @@ static CMPIStatus host_to_vs(const CMPIO
ret = enum_domains(_BROKER, conn, NAMESPACE(ref), list);
if (ret) {
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Failed to get domain list");
}
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
return s;
}
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_HostedResourcePool.c
--- a/src/Virt_HostedResourcePool.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_HostedResourcePool.c Fri Feb 15 07:13:50 2008 -0800
@@ -87,7 +87,9 @@ static CMPIStatus sys_to_pool(const CMPI
NAMESPACE(ref),
list);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
return s;
}
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_RegisteredProfile.c
--- a/src/Virt_RegisteredProfile.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_RegisteredProfile.c Fri Feb 15 07:13:50 2008 -0800
@@ -162,7 +162,9 @@ static CMPIStatus get_prof(const CMPIObj
if(instance)
CMReturnInstance(results, instance);
else
- CMSetStatus(&s, CMPI_RC_ERR_NOT_FOUND);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "Profile instance not found");
out:
virConnectClose(conn);
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_ResourceAllocationFromPool.c Fri Feb 15 07:13:50 2008 -0800
@@ -112,7 +112,9 @@ static CMPIStatus rasd_to_pool(const CMP
NAMESPACE(ref));
if (pool != NULL) {
inst_list_add(list, pool);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
@@ -237,8 +239,9 @@ static CMPIStatus pool_to_rasd(const CMP
poolid,
list);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
return s;
}
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_SettingsDefineState.c
--- a/src/Virt_SettingsDefineState.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_SettingsDefineState.c Fri Feb 15 07:13:50 2008 -0800
@@ -104,8 +104,9 @@ static CMPIStatus dev_to_rasd(const CMPI
if (rasd != NULL)
inst_list_add(list, rasd);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
free(name);
free(devid);
@@ -184,8 +185,9 @@ static CMPIStatus rasd_to_dev(const CMPI
inst_list_add(list, dev);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
return s;
}
@@ -226,8 +228,9 @@ static CMPIStatus vs_to_vssd(const CMPIO
if (vssd != NULL)
inst_list_add(list, vssd);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
virDomainFree(dom);
virConnectClose(conn);
@@ -277,8 +280,9 @@ static CMPIStatus vssd_to_vs(const CMPIO
if (cs != NULL)
inst_list_add(list, cs);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
free(name);
free(pfx);
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_SystemDevice.c
--- a/src/Virt_SystemDevice.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_SystemDevice.c Fri Feb 15 07:13:50 2008 -0800
@@ -157,7 +157,9 @@ static CMPIStatus sys_to_dev(const CMPIO
NAMESPACE(ref));
if (ret >= 0) {
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
@@ -208,7 +210,9 @@ static CMPIStatus dev_to_sys(const CMPIO
"Unable to find DeviceID `%s'", devid);
else {
inst_list_add(list, sys);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
}
out:
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_VSMigrationCapabilities.c
--- a/src/Virt_VSMigrationCapabilities.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_VSMigrationCapabilities.c Fri Feb 15 07:13:50 2008 -0800
@@ -73,8 +73,9 @@ static CMPIStatus set_method_properties(
CMSetProperty(inst, "SynchronousMethodsSupported",
(CMPIValue *)&array, CMPI_uint16A);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
return s;
}
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_VSMigrationService.c Fri Feb 15 07:13:50 2008 -0800
@@ -114,7 +114,9 @@ static CMPIStatus check_hver(virConnectP
if (remote >= local) {
CU_DEBUG("Version check OK (%lu >= %lu)", remote, local);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
CU_DEBUG("Version check FAILED (%lu < %lu)", remote, local);
cu_statusf(_BROKER, &s,
@@ -123,8 +125,9 @@ static CMPIStatus check_hver(virConnectP
remote, local);
}
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
return s;
}
@@ -172,8 +175,9 @@ static CMPIStatus vs_migratable(const CM
goto out;
retcode = 0;
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
CMReturnData(results, (CMPIValue *)&retcode, CMPI_uint32);
@@ -432,8 +436,9 @@ static CMPIStatus migrate_vs(struct migr
}
CU_DEBUG("Migration succeeded");
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
free(uri);
virDomainFree(dom);
@@ -788,8 +793,10 @@ CMPIStatus get_migration_service(const C
CMSetProperty(inst, "SystemCreationClassName",
(CMPIValue *)ccname, CMPI_chars);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
+
*_inst = inst;
out:
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_VSMigrationSettingData.c
--- a/src/Virt_VSMigrationSettingData.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_VSMigrationSettingData.c Fri Feb 15 07:13:50 2008 -0800
@@ -47,7 +47,9 @@ static CMPIStatus set_properties(const C
(CMPIValue *)&priority, CMPI_uint16);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(broker, &s,
+ CMPI_RC_OK,
+ "");
return s;
}
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_VSSD.c
--- a/src/Virt_VSSD.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_VSSD.c Fri Feb 15 07:13:50 2008 -0800
@@ -182,7 +182,9 @@ static CMPIStatus enum_vssd(const CMPIOb
"Failed to enumerate domains");
goto out;
} else if (count == 0) {
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
goto out;
}
@@ -200,7 +202,9 @@ static CMPIStatus enum_vssd(const CMPIOb
CMReturnInstance(results, inst);
}
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
free(list);
@@ -271,7 +275,9 @@ static CMPIStatus GetInstance(CMPIInstan
if (inst)
CMReturnInstance(results, inst);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
free(locid);
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_VSSDComponent.c
--- a/src/Virt_VSSDComponent.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_VSSDComponent.c Fri Feb 15 07:13:50 2008 -0800
@@ -69,8 +69,9 @@ static CMPIStatus vssd_to_rasd(const CMP
list);
}
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
free(name);
@@ -103,8 +104,9 @@ static CMPIStatus vssd_for_name(const ch
CMPI_RC_ERR_FAILED,
"Error getting VSSD for `%s'", host);
else
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
virDomainFree(dom);
virConnectClose(conn);
diff -r ae2cfc5a6a85 -r 72f9d41f72aa src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Feb 13 08:16:37 2008 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Fri Feb 15 07:13:50 2008 -0800
@@ -75,8 +75,9 @@ static CMPIStatus define_system_parse_ar
goto out;
}
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
return s;
}
@@ -373,7 +374,9 @@ static CMPIInstance *create_system(CMPII
domain = calloc(1, sizeof(*domain));
if (domain == NULL) {
- CMSetStatus(s, CMPI_RC_ERR_FAILED);
+ cu_statusf(_BROKER, s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to allocate memory");
goto out;
}
@@ -492,7 +495,9 @@ static CMPIStatus destroy_system(CMPIMet
rc.uint32 = IM_RC_OK;
} else {
rc.uint32 = IM_RC_FAILED;
- CMSetStatus(&status, CMPI_RC_ERR_FAILED);
+ cu_statusf(_BROKER, &status,
+ CMPI_RC_ERR_FAILED,
+ "Domain already exists");
}
virDomainFree(dom);
trigger_indication(context,
@@ -665,7 +670,9 @@ static CMPIStatus _resource_dynamic(stru
if (!domain_online(dom)) {
CU_DEBUG("VS `%s' not online; skipping dynamic update",
dominfo->name);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
goto out;
}
@@ -676,7 +683,9 @@ static CMPIStatus _resource_dynamic(stru
CMPI_RC_ERR_FAILED,
"Unable to change (%i) device", action);
} else {
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
}
out:
virDomainFree(dom);
@@ -769,7 +778,9 @@ static CMPIStatus resource_add(struct do
list = realloc(*_list, ((*count)+1)*sizeof(struct virt_device));
if (list == NULL) {
/* No memory */
- CMSetStatus(&s, CMPI_RC_ERR_FAILED);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to allocate memory");
goto out;
}
@@ -786,7 +797,9 @@ static CMPIStatus resource_add(struct do
if (s.rc != CMPI_RC_OK)
goto out;
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
(*count)++;
out:
@@ -1038,7 +1051,9 @@ static CMPIStatus rasd_refs_to_insts(con
REF2STR(ref));
}
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
*ret_arr = tmp_arr;
return s;
@@ -1220,8 +1235,9 @@ CMPIStatus get_vsms(const CMPIObjectPath
goto out;
}
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
virConnectClose(conn);
*_inst = inst;
16 years, 10 months
[PATCH] This changes any uses of CMSetStatus() to cu_statusf()
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1202940826 28800
# Node ID 7e6bffb32e40c55323fe98f0ec0658cd6ea32a78
# Parent abb9ef8863c4cc27abaac3d98ac43dded5b9f19e
This changes any uses of CMSetStatus() to cu_statusf()
With new versions of GCC, the check for (s != NULL) in the macro sets off
the "Address of `s' will always be true" warning. We don't want to turn
that warning off, so this seems like the better choice
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_ComputerSystem.c Wed Feb 13 14:13:46 2008 -0800
@@ -440,7 +440,9 @@ static CMPIStatus return_enum_domains(co
inst_list_init(&list);
ret = enum_domains(_BROKER, conn, NAMESPACE(reference), &list);
if (!ret) {
- CMSetStatus(&s, CMPI_RC_ERR_FAILED);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to get domain list");
goto out;
}
@@ -449,8 +451,9 @@ static CMPIStatus return_enum_domains(co
else
cu_return_instances(results, &list);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
inst_list_free(&list);
@@ -734,7 +737,9 @@ static CMPIStatus __state_change(const c
else if (state == CIM_STATE_RESET)
s = state_change_reset(dom, &info);
else
- CMSetStatus(&s, CMPI_RC_ERR_NOT_SUPPORTED);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_SUPPORTED,
+ "State not supported");
out:
virDomainFree(dom);
@@ -757,7 +762,9 @@ static CMPIStatus state_change(CMPIMetho
ret = cu_get_u16_arg(argsin, "RequestedState", &state);
if (ret != CMPI_RC_OK) {
- CMSetStatus(&s, CMPI_RC_ERR_INVALID_PARAMETER);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Invalid RequestedState");
goto out;
}
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_Device.c
--- a/src/Virt_Device.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_Device.c Wed Feb 13 14:13:46 2008 -0800
@@ -371,7 +371,9 @@ static CMPIStatus enum_devices(const CMP
inst_list_free(&list);
out:
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
virConnectClose(conn);
return s;
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_DevicePool.c Wed Feb 13 14:13:46 2008 -0800
@@ -795,7 +795,9 @@ static CMPIStatus return_pool(const CMPI
&list);
if (s.rc == CMPI_RC_OK) {
__return_pool(results, &list, name_only);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_ElementAllocatedFromPool.c
--- a/src/Virt_ElementAllocatedFromPool.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_ElementAllocatedFromPool.c Wed Feb 13 14:13:46 2008 -0800
@@ -102,7 +102,9 @@ static CMPIStatus vdev_to_pool(const CMP
pool = get_pool_by_id(_BROKER, conn, poolid, NAMESPACE(ref));
if (pool != NULL) {
inst_list_add(list, pool);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
@@ -220,8 +222,9 @@ static CMPIStatus pool_to_vdev(const CMP
devs_from_pool(type, ref, poolid, list);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
return s;
}
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_ElementCapabilities.c
--- a/src/Virt_ElementCapabilities.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_ElementCapabilities.c Wed Feb 13 14:13:46 2008 -0800
@@ -72,7 +72,9 @@ static CMPIStatus validate_caps_get_serv
s = get_migration_service(ref, &_inst, _BROKER);
} else
- CMSetStatus(&s, CMPI_RC_ERR_NOT_FOUND);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "Not found");
*inst = _inst;
out:
@@ -103,7 +105,9 @@ static CMPIStatus validate_service_get_c
s = get_migration_caps(ref, &_inst, _BROKER);
} else
- CMSetStatus(&s, CMPI_RC_ERR_NOT_FOUND);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "");
*inst = _inst;
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_HostedDependency.c
--- a/src/Virt_HostedDependency.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_HostedDependency.c Wed Feb 13 14:13:46 2008 -0800
@@ -70,14 +70,18 @@ static CMPIStatus host_to_vs(const CMPIO
ret = enum_domains(_BROKER, conn, NAMESPACE(ref), list);
if (ret) {
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Failed to get domain list");
}
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
return s;
}
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_HostedResourcePool.c
--- a/src/Virt_HostedResourcePool.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_HostedResourcePool.c Wed Feb 13 14:13:46 2008 -0800
@@ -87,7 +87,9 @@ static CMPIStatus sys_to_pool(const CMPI
NAMESPACE(ref),
list);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
return s;
}
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_RegisteredProfile.c
--- a/src/Virt_RegisteredProfile.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_RegisteredProfile.c Wed Feb 13 14:13:46 2008 -0800
@@ -162,7 +162,9 @@ static CMPIStatus get_prof(const CMPIObj
if(instance)
CMReturnInstance(results, instance);
else
- CMSetStatus(&s, CMPI_RC_ERR_NOT_FOUND);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "Profile instance not found");
out:
virConnectClose(conn);
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_ResourceAllocationFromPool.c Wed Feb 13 14:13:46 2008 -0800
@@ -112,7 +112,9 @@ static CMPIStatus rasd_to_pool(const CMP
NAMESPACE(ref));
if (pool != NULL) {
inst_list_add(list, pool);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
@@ -237,8 +239,9 @@ static CMPIStatus pool_to_rasd(const CMP
poolid,
list);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
return s;
}
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_SettingsDefineState.c
--- a/src/Virt_SettingsDefineState.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_SettingsDefineState.c Wed Feb 13 14:13:46 2008 -0800
@@ -104,8 +104,9 @@ static CMPIStatus dev_to_rasd(const CMPI
if (rasd != NULL)
inst_list_add(list, rasd);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
free(name);
free(devid);
@@ -184,8 +185,9 @@ static CMPIStatus rasd_to_dev(const CMPI
inst_list_add(list, dev);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
return s;
}
@@ -226,8 +228,9 @@ static CMPIStatus vs_to_vssd(const CMPIO
if (vssd != NULL)
inst_list_add(list, vssd);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
virDomainFree(dom);
virConnectClose(conn);
@@ -277,8 +280,9 @@ static CMPIStatus vssd_to_vs(const CMPIO
if (cs != NULL)
inst_list_add(list, cs);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
free(name);
free(pfx);
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_SystemDevice.c
--- a/src/Virt_SystemDevice.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_SystemDevice.c Wed Feb 13 14:13:46 2008 -0800
@@ -157,7 +157,9 @@ static CMPIStatus sys_to_dev(const CMPIO
NAMESPACE(ref));
if (ret >= 0) {
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
@@ -208,7 +210,9 @@ static CMPIStatus dev_to_sys(const CMPIO
"Unable to find DeviceID `%s'", devid);
else {
inst_list_add(list, sys);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
}
out:
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_VSMigrationCapabilities.c
--- a/src/Virt_VSMigrationCapabilities.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_VSMigrationCapabilities.c Wed Feb 13 14:13:46 2008 -0800
@@ -73,8 +73,9 @@ static CMPIStatus set_method_properties(
CMSetProperty(inst, "SynchronousMethodsSupported",
(CMPIValue *)&array, CMPI_uint16A);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
return s;
}
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_VSMigrationService.c Wed Feb 13 14:13:46 2008 -0800
@@ -114,7 +114,9 @@ static CMPIStatus check_hver(virConnectP
if (remote >= local) {
CU_DEBUG("Version check OK (%lu >= %lu)", remote, local);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
} else {
CU_DEBUG("Version check FAILED (%lu < %lu)", remote, local);
cu_statusf(_BROKER, &s,
@@ -123,8 +125,9 @@ static CMPIStatus check_hver(virConnectP
remote, local);
}
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
return s;
}
@@ -172,8 +175,9 @@ static CMPIStatus vs_migratable(const CM
goto out;
retcode = 0;
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
CMReturnData(results, (CMPIValue *)&retcode, CMPI_uint32);
@@ -432,8 +436,9 @@ static CMPIStatus migrate_vs(struct migr
}
CU_DEBUG("Migration succeeded");
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
free(uri);
virDomainFree(dom);
@@ -788,8 +793,10 @@ CMPIStatus get_migration_service(const C
CMSetProperty(inst, "SystemCreationClassName",
(CMPIValue *)ccname, CMPI_chars);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
+
*_inst = inst;
out:
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_VSMigrationSettingData.c
--- a/src/Virt_VSMigrationSettingData.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_VSMigrationSettingData.c Wed Feb 13 14:13:46 2008 -0800
@@ -47,7 +47,9 @@ static CMPIStatus set_properties(const C
(CMPIValue *)&priority, CMPI_uint16);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(broker, &s,
+ CMPI_RC_OK,
+ "");
return s;
}
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_VSSD.c
--- a/src/Virt_VSSD.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_VSSD.c Wed Feb 13 14:13:46 2008 -0800
@@ -182,7 +182,9 @@ static CMPIStatus enum_vssd(const CMPIOb
"Failed to enumerate domains");
goto out;
} else if (count == 0) {
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
goto out;
}
@@ -200,7 +202,9 @@ static CMPIStatus enum_vssd(const CMPIOb
CMReturnInstance(results, inst);
}
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
free(list);
@@ -271,7 +275,9 @@ static CMPIStatus GetInstance(CMPIInstan
if (inst)
CMReturnInstance(results, inst);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
free(locid);
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_VSSDComponent.c
--- a/src/Virt_VSSDComponent.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_VSSDComponent.c Wed Feb 13 14:13:46 2008 -0800
@@ -69,8 +69,9 @@ static CMPIStatus vssd_to_rasd(const CMP
list);
}
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
free(name);
@@ -103,8 +104,9 @@ static CMPIStatus vssd_for_name(const ch
CMPI_RC_ERR_FAILED,
"Error getting VSSD for `%s'", host);
else
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
virDomainFree(dom);
virConnectClose(conn);
diff -r abb9ef8863c4 -r 7e6bffb32e40 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Feb 13 13:37:29 2008 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Wed Feb 13 14:13:46 2008 -0800
@@ -75,8 +75,9 @@ static CMPIStatus define_system_parse_ar
goto out;
}
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
return s;
}
@@ -373,7 +374,9 @@ static CMPIInstance *create_system(CMPII
domain = calloc(1, sizeof(*domain));
if (domain == NULL) {
- CMSetStatus(s, CMPI_RC_ERR_FAILED);
+ cu_statusf(_BROKER, s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to allocate memory");
goto out;
}
@@ -492,7 +495,9 @@ static CMPIStatus destroy_system(CMPIMet
rc.uint32 = IM_RC_OK;
} else {
rc.uint32 = IM_RC_FAILED;
- CMSetStatus(&status, CMPI_RC_ERR_FAILED);
+ cu_statusf(_BROKER, &status,
+ CMPI_RC_ERR_FAILED,
+ "Domain already exists");
}
virDomainFree(dom);
trigger_indication(context,
@@ -665,7 +670,9 @@ static CMPIStatus _resource_dynamic(stru
if (!domain_online(dom)) {
CU_DEBUG("VS `%s' not online; skipping dynamic update",
dominfo->name);
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
goto out;
}
@@ -676,7 +683,9 @@ static CMPIStatus _resource_dynamic(stru
CMPI_RC_ERR_FAILED,
"Unable to change (%i) device", action);
} else {
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
}
out:
virDomainFree(dom);
@@ -769,7 +778,9 @@ static CMPIStatus resource_add(struct do
list = realloc(*_list, ((*count)+1)*sizeof(struct virt_device));
if (list == NULL) {
/* No memory */
- CMSetStatus(&s, CMPI_RC_ERR_FAILED);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to allocate memory");
goto out;
}
@@ -786,7 +797,9 @@ static CMPIStatus resource_add(struct do
if (s.rc != CMPI_RC_OK)
goto out;
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
(*count)++;
out:
@@ -1038,7 +1051,9 @@ static CMPIStatus rasd_refs_to_insts(con
REF2STR(ref));
}
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
*ret_arr = tmp_arr;
return s;
@@ -1207,8 +1222,9 @@ CMPIStatus get_vsms(const CMPIObjectPath
CMSetProperty(inst, "SystemCreationClassName",
(CMPIValue *)ccname, CMPI_chars);
- CMSetStatus(&s, CMPI_RC_OK);
-
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
out:
virConnectClose(conn);
*_inst = inst;
@@ -1273,7 +1289,9 @@ static CMPIStatus GetInstance(CMPIInstan
CMPI_RC_ERR_NOT_FOUND,
"No such instance (%s)", prop);
} else {
- CMSetStatus(&s, CMPI_RC_OK);
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_OK,
+ "");
CMReturnInstance(results, inst);
}
16 years, 10 months
[PATCH] Fix missing Virt_AllocationCapabilities.h header inclusion in dist
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1202938649 28800
# Node ID abb9ef8863c4cc27abaac3d98ac43dded5b9f19e
# Parent 460476bb31d6d3d2e400396e3797cfc6697744fd
Fix missing Virt_AllocationCapabilities.h header inclusion in dist
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 460476bb31d6 -r abb9ef8863c4 src/Makefile.am
--- a/src/Makefile.am Wed Feb 13 09:27:52 2008 -0800
+++ b/src/Makefile.am Wed Feb 13 13:37:29 2008 -0800
@@ -16,7 +16,8 @@ noinst_HEADERS = profiles.h svpc_types.h
Virt_VirtualSystemManagementService.h \
Virt_VSSD.h \
Virt_VSMigrationCapabilities.h \
- Virt_VSMigrationService.h
+ Virt_VSMigrationService.h \
+ Virt_AllocationCapabilities.h
XKUADD = $(top_builddir)/libxkutil/libxkutil.la
16 years, 10 months
[PATCH] Fix misplaced const
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1202923672 28800
# Node ID 460476bb31d6d3d2e400396e3797cfc6697744fd
# Parent be18b4c2084a6b2b1f1c3a1cdae25a98034d7d54
Fix misplaced const
This causes a warning on some versions of GCC because we're passing in
the inst to be modified, which means it can't be const. Not sure why
more GCC versions aren't catching this, but it needs to be fixed.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r be18b4c2084a -r 460476bb31d6 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Tue Feb 12 15:39:52 2008 -0800
+++ b/src/Virt_VSMigrationService.c Wed Feb 13 09:27:52 2008 -0800
@@ -269,7 +269,7 @@ static bool raise_indication(const CMPIC
const char *base_type,
const char *ns,
CMPIInstance *inst,
- const CMPIInstance *ind)
+ CMPIInstance *ind)
{
char *type;
CMPIStatus s;
16 years, 10 months
[PATCH] [CU] Make the spec require libxml2-devel for build
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1202917532 28800
# Node ID bd9472d3aa5f9f91553813e25731ae90c2555917
# Parent 6043289449b78acf6c96f79053ef5c1c43e3e285
[CU] Make the spec require libxml2-devel for build
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 6043289449b7 -r bd9472d3aa5f libcmpiutil.spec.in
--- a/libcmpiutil.spec.in Tue Feb 12 12:19:31 2008 -0800
+++ b/libcmpiutil.spec.in Wed Feb 13 07:45:32 2008 -0800
@@ -12,6 +12,7 @@ BuildRequires: tog-pegasus-devel
BuildRequires: tog-pegasus-devel
BuildRequires: flex
BuildRequires: bison
+BuildRequires: libxml2-devel
BuildConflicts: sblim-cmpi-devel
%description
16 years, 10 months
[PATCH] [CU] Fix warning in cu_dup_instance() that breaks build
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1202917533 28800
# Node ID c19e321766902af6dba29025be964d8d45537c51
# Parent bd9472d3aa5f9f91553813e25731ae90c2555917
[CU] Fix warning in cu_dup_instance() that breaks build
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r bd9472d3aa5f -r c19e32176690 instance_util.c
--- a/instance_util.c Wed Feb 13 07:45:32 2008 -0800
+++ b/instance_util.c Wed Feb 13 07:45:33 2008 -0800
@@ -234,7 +234,7 @@ CMPIInstance *cu_dup_instance(const CMPI
for (i = 0; i < prop_count; i++) {
CMPIString *prop;
- char *prop_name;
+ const char *prop_name;
data = CMGetPropertyAt(src, i, &prop, s);
prop_name = CMGetCharPtr(prop);
16 years, 10 months
[PATCH] Remove added leading slash to namespace in .spec
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1202849741 28800
# Node ID e8db1c1626222a38f02e5c43b9c8c403d3a07154
# Parent 388ec19f6b4a0230002b2ef096a8ed7cdb5783cb
Remove added leading slash to namespace in .spec
This was reported to cause a problem with some versions of Pegasus
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 388ec19f6b4a -r e8db1c162622 libvirt-cim.spec.in
--- a/libvirt-cim.spec.in Tue Feb 12 12:42:55 2008 -0800
+++ b/libvirt-cim.spec.in Tue Feb 12 12:55:41 2008 -0800
@@ -52,7 +52,7 @@ rm -fr $RPM_BUILD_ROOT
%define SCHEMA %{_datadir}/%{name}/*.mof
%{_datadir}/%{name}/provider-register.sh -d -t pegasus \
- -n /@CIM_VIRT_NS@ \
+ -n @CIM_VIRT_NS@ \
-r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
%post
@@ -63,12 +63,12 @@ rm -fr $RPM_BUILD_ROOT
/etc/init.d/tog-pegasus restart
%{_datadir}/%{name}/provider-register.sh -t pegasus \
- -n /@CIM_VIRT_NS@ \
+ -n @CIM_VIRT_NS@ \
-r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
%preun
%{_datadir}/%{name}/provider-register.sh -d -t pegasus \
- -n /@CIM_VIRT_NS@ \
+ -n @CIM_VIRT_NS@ \
-r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
%postun -p /sbin/ldconfig
16 years, 10 months
[PATCH] (#2) Update EC to add support for VSMS to VSMC association
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1202859592 28800
# Node ID 182035ee85c375cf9ff908014f64513ad42cb418
# Parent 15c8041aa453df5eebd50d4dd17a2170bc9c1f86
(#2) Update EC to add support for VSMS to VSMC association.
Updates - fixed whitespace issue with validate_service_get_caps() call.
Removed the instance property validation. The get_vsms() (etc) calls will need to be updated to handle the reference validation.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 15c8041aa453 -r 182035ee85c3 src/Makefile.am
--- a/src/Makefile.am Mon Feb 11 15:54:17 2008 -0800
+++ b/src/Makefile.am Tue Feb 12 15:39:52 2008 -0800
@@ -99,14 +99,16 @@ libVirt_AllocationCapabilities_la_SOURCE
libVirt_AllocationCapabilities_la_SOURCES = Virt_AllocationCapabilities.c
libVirt_AllocationCapabilities_la_LIBADD = -lVirt_DevicePool
-libVirt_ElementCapabilities_la_DEPENDENCIES = libVirt_VirtualSystemManagementCapabilities.la libVirt_EnabledLogicalElementCapabilities.la libVirt_ComputerSystem.la libVirt_HostSystem.la libVirt_VSMigrationCapabilities.la
+libVirt_ElementCapabilities_la_DEPENDENCIES = libVirt_VirtualSystemManagementCapabilities.la libVirt_EnabledLogicalElementCapabilities.la libVirt_ComputerSystem.la libVirt_HostSystem.la libVirt_VSMigrationCapabilities.la libVirt_VirtualSystemManagementService.la libVirt_VSMigrationService.la
libVirt_ElementCapabilities_la_SOURCES = Virt_ElementCapabilities.c
libVirt_ElementCapabilities_la_LIBADD = -lVirt_VirtualSystemManagementCapabilities \
-lVirt_EnabledLogicalElementCapabilities \
-lVirt_ComputerSystem \
-lVirt_HostSystem \
-lVirt_VSMigrationCapabilities \
- -lVirt_AllocationCapabilities
+ -lVirt_AllocationCapabilities \
+ -lVirt_VirtualSystemManagementService \
+ -lVirt_VSMigrationService
libVirt_SettingsDefineCapabilities_la_DEPENDENCIES = libVirt_RASD.la libVirt_DevicePool.la
libVirt_SettingsDefineCapabilities_la_SOURCES = Virt_SettingsDefineCapabilities.c
diff -r 15c8041aa453 -r 182035ee85c3 src/Virt_ElementCapabilities.c
--- a/src/Virt_ElementCapabilities.c Mon Feb 11 15:54:17 2008 -0800
+++ b/src/Virt_ElementCapabilities.c Tue Feb 12 15:39:52 2008 -0800
@@ -33,6 +33,8 @@
#include <libcmpiutil/std_association.h>
#include "Virt_VirtualSystemManagementCapabilities.h"
+#include "Virt_VirtualSystemManagementService.h"
+#include "Virt_VSMigrationService.h"
#include "Virt_EnabledLogicalElementCapabilities.h"
#include "Virt_ComputerSystem.h"
#include "Virt_HostSystem.h"
@@ -48,31 +50,63 @@
const static CMPIBroker *_BROKER;
-static CMPIStatus validate_host_caps_ref(const CMPIObjectPath *ref)
-{
- CMPIStatus s = {CMPI_RC_OK, NULL};
- CMPIInstance *inst;
- const char *prop;
- char* classname;
-
+static CMPIStatus validate_caps_get_service(const CMPIObjectPath *ref,
+ CMPIInstance **inst)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *_inst;
+ char* classname;
+
classname = class_base_name(CLASSNAME(ref));
if (STREQC(classname, "VirtualSystemManagementCapabilities")) {
- s = get_vsm_cap(_BROKER, ref, &inst);
+ s = get_vsm_cap(_BROKER, ref, &_inst);
+ if ((s.rc != CMPI_RC_OK) || (_inst == NULL))
+ goto out;
+
+ s = get_vsms(ref, &_inst, _BROKER);
} else if (STREQC(classname, "VirtualSystemMigrationCapabilities")) {
- s = get_migration_caps(ref, &inst, _BROKER);
- }
-
- if (s.rc != CMPI_RC_OK)
- goto out;
-
- prop = cu_compare_ref(ref, inst);
- if (prop != NULL) {
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_NOT_FOUND,
- "No such instance (%s)", prop);
- }
-
+ s = get_migration_caps(ref, &_inst, _BROKER);
+ if ((s.rc != CMPI_RC_OK) || (_inst == NULL))
+ goto out;
+
+ s = get_migration_service(ref, &_inst, _BROKER);
+ } else
+ CMSetStatus(&s, CMPI_RC_ERR_NOT_FOUND);
+
+ *inst = _inst;
+ out:
+ free(classname);
+
+ return s;
+}
+
+static CMPIStatus validate_service_get_caps(const CMPIObjectPath *ref,
+ CMPIInstance **inst)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *_inst;
+ char* classname;
+
+ classname = class_base_name(CLASSNAME(ref));
+
+ if (STREQC(classname, "VirtualSystemManagementService")) {
+ s = get_vsms(ref, &_inst, _BROKER);
+ if ((s.rc != CMPI_RC_OK) || (_inst == NULL))
+ goto out;
+
+ s = get_vsm_cap(_BROKER, ref, &_inst);
+ } else if (STREQC(classname, "VirtualSystemMigrationService")) {
+ s = get_migration_service(ref, &_inst, _BROKER);
+ if ((s.rc != CMPI_RC_OK) || (_inst == NULL))
+ goto out;
+
+ s = get_migration_caps(ref, &_inst, _BROKER);
+ } else
+ CMSetStatus(&s, CMPI_RC_ERR_NOT_FOUND);
+
+ *inst = _inst;
+
out:
free(classname);
@@ -105,19 +139,22 @@ static CMPIStatus sys_to_cap(const CMPIO
return s;
}
-static CMPIStatus cap_to_sys(const CMPIObjectPath *ref,
- struct std_assoc_info *info,
- struct inst_list *list)
-{
- CMPIInstance *inst;
- CMPIStatus s = {CMPI_RC_OK, NULL};
-
- if (!match_hypervisor_prefix(ref, info))
- goto out;
-
- s = validate_host_caps_ref(ref);
- if (s.rc != CMPI_RC_OK)
- goto out;
+static CMPIStatus cap_to_sys_or_service(const CMPIObjectPath *ref,
+ struct std_assoc_info *info,
+ struct inst_list *list)
+{
+ CMPIInstance *inst = NULL;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+
+ if (!match_hypervisor_prefix(ref, info))
+ goto out;
+
+ s = validate_caps_get_service(ref, &inst);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ if (inst != NULL)
+ inst_list_add(list, inst);
s = get_host_cs(_BROKER, ref, &inst);
if (s.rc != CMPI_RC_OK)
@@ -125,6 +162,26 @@ static CMPIStatus cap_to_sys(const CMPIO
inst_list_add(list, inst);
+ out:
+ return s;
+}
+
+static CMPIStatus service_to_cap(const CMPIObjectPath *ref,
+ struct std_assoc_info *info,
+ struct inst_list *list)
+{
+ CMPIInstance *inst = NULL;
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+
+ if (!match_hypervisor_prefix(ref, info))
+ goto out;
+
+ s = validate_service_get_caps(ref, &inst);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ if (inst != NULL)
+ inst_list_add(list, inst);
out:
return s;
}
@@ -245,6 +302,16 @@ static char* host_system[] = {
NULL
};
+static char* host_sys_and_service[] = {
+ "Xen_HostSystem",
+ "KVM_HostSystem",
+ "Xen_VirtualSystemManagementService",
+ "KVM_VirtualSystemManagementService",
+ "Xen_VirtualSystemMigrationService",
+ "KVM_VirtualSystemMigrationService",
+ NULL
+};
+
static char* virtual_system_management_capabilities[] = {
"Xen_VirtualSystemManagementCapabilities",
"Xen_VirtualSystemMigrationCapabilities",
@@ -266,16 +333,37 @@ static struct std_assoc system_to_vsm_ca
.make_ref = make_ref
};
-static struct std_assoc vsm_cap_to_system = {
+static struct std_assoc vsm_cap_to_sys_or_service = {
.source_class = (char**)&virtual_system_management_capabilities,
.source_prop = "Capabilities",
- .target_class = (char**)&host_system,
+ .target_class = (char**)&host_sys_and_service,
.target_prop = "ManagedElement",
.assoc_class = (char**)&assoc_classname,
- .handler = cap_to_sys,
+ .handler = cap_to_sys_or_service,
+ .make_ref = make_ref
+};
+
+static char* service[] = {
+ "Xen_VirtualSystemManagementService",
+ "KVM_VirtualSystemManagementService",
+ "Xen_VirtualSystemMigrationService",
+ "KVM_VirtualSystemMigrationService",
+ NULL
+};
+
+static struct std_assoc _service_to_cap = {
+ .source_class = (char**)&service,
+ .source_prop = "ManagedElement",
+
+ .target_class = (char**)&virtual_system_management_capabilities,
+ .target_prop = "Capabilities",
+
+ .assoc_class = (char**)&assoc_classname,
+
+ .handler = service_to_cap,
.make_ref = make_ref
};
@@ -363,7 +451,8 @@ static struct std_assoc resource_pool_to
static struct std_assoc *assoc_handlers[] = {
&system_to_vsm_cap,
- &vsm_cap_to_system,
+ &vsm_cap_to_sys_or_service,
+ &_service_to_cap,
&ele_cap_to_cs,
&cs_to_ele_cap,
&alloc_cap_to_resource_pool,
16 years, 10 months