[Libvirt-cim] [PATCH 2 of 2] Add the HostSystem-to-AC link with EC
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Thu Apr 24 20:22:25 UTC 2008
Dan Smith wrote:
> # HG changeset patch
> # User Dan Smith <danms at us.ibm.com>
> # Date 1209053161 25200
> # Node ID b0cbe4e6fd7d1b2f072d2a3b3c3e3ee99b45ef0f
> # Parent c84430202e2e416c183f186a37a0c80d2fcb4896
> Add the HostSystem-to-AC link with EC
>
> This happens as part of the existing HostSystem->*Capabilities code,
> but we also insert the Characteristics array into the Reference instance.
> As far as I can tell, this is okay to be 2=Default for all those references.
> Also, only do this for the MemoryAC at the moment, since only that profile
> specifies this behavior.
>
> The reverse direction replaces the unsupported AC-to-pool code with
> bits to return the HostSystem.
>
> Signed-off-by: Dan Smith <danms at us.ibm.com>
>
> diff -r c84430202e2e -r b0cbe4e6fd7d src/Virt_ElementCapabilities.c
> --- a/src/Virt_ElementCapabilities.c Thu Apr 24 08:47:26 2008 -0700
> +++ b/src/Virt_ElementCapabilities.c Thu Apr 24 09:06:01 2008 -0700
> @@ -41,6 +41,8 @@
> #include "Virt_VSMigrationCapabilities.h"
> #include "Virt_AllocationCapabilities.h"
>
> +#include "svpc_types.h"
> +
> /* Associate an XXX_Capabilities to the proper XXX_ManagedElement.
> *
> * -- or --
> @@ -143,6 +145,11 @@ static CMPIStatus sys_to_cap(const CMPIO
> if (s.rc == CMPI_RC_OK)
> inst_list_add(list, inst);
>
> + s = enum_alloc_cap_instances(_BROKER, ref, NULL, NULL, list);
> + if (s.rc != CMPI_RC_OK) {
> + CU_DEBUG("Failed to enum AC: %s",
> + CMGetCharPtr(s.msg));
> + }
> out:
> return s;
> }
> @@ -260,8 +267,32 @@ static CMPIStatus alloc_to_pool(const CM
> struct std_assoc_info *info,
> struct inst_list *list)
Can you add a comment here that this function handles
AC --> HS
AC --> pool
The function name is confusing (or confused me at least =)
> +
> +static CMPIInstance *make_ref_default(const CMPIObjectPath *source_ref,
> + const CMPIInstance *target_inst,
> + struct std_assoc_info *info,
> + struct std_assoc *assoc)
> +{
> + CMPIInstance *ref_inst = NULL;
> + CMPIArray *array = NULL;
> + CMPIStatus s;
> + uint16_t val = CIM_EC_CHAR_DEFAULT;
> +
> + ref_inst = make_reference(_BROKER,
> + source_ref,
> + target_inst,
> + info,
> + assoc);
> +
> + array = CMNewArray(_BROKER, 1, CMPI_uint16, &s);
> + if ((array == NULL) || (s.rc != CMPI_RC_OK)) {
> + CU_DEBUG("Unable to allocate Characteristics array");
> + goto out;
> + }
> +
> + CMSetArrayElementAt(array, 0, &val, CMPI_uint16);
> +
> + CMSetProperty(ref_inst, "Characteristics",
> + (CMPIValue *)&array, CMPI_uint16A);
It looks like the Characteristics value gets set even for the AC -> Pool
case. Is this expected?
> +
> + out:
> + return ref_inst;
> }
>
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list