# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1224563169 25200
# Node ID 749adf090de64e8fb7932d71cf16f268b22b2bec
# Parent c41bd7c3175a970f7c674931ee27ef2a88b63b61
Add cu_validate_ref() to get_alloc_cap_by_id(), fix alloc_cap_to_rasd()...
To call get_alloc_cap_by_id().
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r c41bd7c3175a -r 749adf090de6 src/Makefile.am
--- a/src/Makefile.am Mon Oct 20 18:40:45 2008 -0700
+++ b/src/Makefile.am Mon Oct 20 21:26:09 2008 -0700
@@ -120,7 +120,7 @@
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_VirtualSystemManagementService.la libVirt_VSMigrationService.la
libVirt_DevicePool.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_DevicePool.la libVirt_AllocationCapabilities.la
libVirt_ElementCapabilities_la_SOURCES = Virt_ElementCapabilities.c
libVirt_ElementCapabilities_la_LIBADD = -lVirt_VirtualSystemManagementCapabilities \
-lVirt_EnabledLogicalElementCapabilities \
@@ -132,12 +132,13 @@
-lVirt_VSMigrationService \
-lVirt_DevicePool
-libVirt_SettingsDefineCapabilities_la_DEPENDENCIES = libVirt_RASD.la
libVirt_DevicePool.la libVirt_VSMigrationCapabilities.la
libVirt_VSMigrationSettingData.la
+libVirt_SettingsDefineCapabilities_la_DEPENDENCIES = libVirt_RASD.la
libVirt_DevicePool.la libVirt_VSMigrationCapabilities.la libVirt_VSMigrationSettingData.la
libVirt_AllocationCapabilities.la
libVirt_SettingsDefineCapabilities_la_SOURCES = Virt_SettingsDefineCapabilities.c
libVirt_SettingsDefineCapabilities_la_LIBADD = -lVirt_RASD \
-lVirt_DevicePool \
-lVirt_VSMigrationCapabilities \
- -lVirt_VSMigrationSettingData
+ -lVirt_VSMigrationSettingData \
+ -lVirt_AllocationCapabilities
libVirt_RegisteredProfile_la_SOURCES = Virt_RegisteredProfile.c
diff -r c41bd7c3175a -r 749adf090de6 src/Virt_AllocationCapabilities.c
--- a/src/Virt_AllocationCapabilities.c Mon Oct 20 18:40:45 2008 -0700
+++ b/src/Virt_AllocationCapabilities.c Mon Oct 20 21:26:09 2008 -0700
@@ -159,7 +159,11 @@
if ((pool == NULL) || (s.rc != CMPI_RC_OK))
return s;
- return ac_from_pool(broker, ref, pool, inst);
+ s = ac_from_pool(broker, ref, pool, inst);
+ if (s.rc != CMPI_RC_OK)
+ return s;
+
+ return cu_validate_ref(broker, ref, *inst);
}
static CMPIStatus return_alloc_cap_instances(const CMPIBroker *broker,
diff -r c41bd7c3175a -r 749adf090de6 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Mon Oct 20 18:40:45 2008 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c Mon Oct 20 21:26:09 2008 -0700
@@ -47,6 +47,7 @@
#include "Virt_VSMigrationCapabilities.h"
#include "Virt_VSMigrationSettingData.h"
#include "Virt_VirtualSystemManagementService.h"
+#include "Virt_AllocationCapabilities.h"
const static CMPIBroker *_BROKER;
@@ -730,6 +731,7 @@
struct inst_list *list)
{
CMPIStatus s = {CMPI_RC_OK};
+ CMPIInstance *inst;
uint16_t type;
const char *id = NULL;
int i;
@@ -743,6 +745,10 @@
"Missing InstanceID");
goto out;
}
+
+ s = get_alloc_cap_by_id(_BROKER, ref, id, &inst);
+ if ((inst == NULL) || (s.rc != CMPI_RC_OK))
+ goto out;
type = res_type_from_pool_id(id);