[Libvirt-cim] [PATCH] Add method to merge RASDs

Chip Vincent cvincent at linux.vnet.ibm.com
Sat Dec 11 00:48:39 UTC 2010


+1 and pushed.

Sharad Mishra wrote:
> # HG changeset patch
> # User Sharad Mishra <snmishra at us.ibm.com>
> # Date 1291841067 28800
> # Node ID 531f151df659f030fe4fab1f6663572af356935f
> # Parent  f967d9432f317685981a5b8552f049a9b644a33f
> Add method to merge RASDs.
>
> This method will take two RASDs, src and dest, and  merge the  two into dest.
>
> Signed-off-by: Sharad Mishra <snmishra at us.ibm.com>
>
> diff -r f967d9432f31 -r 531f151df659 instance_util.c
> --- a/instance_util.c	Wed Oct 06 09:31:05 2010 -0700
> +++ b/instance_util.c	Wed Dec 08 12:44:27 2010 -0800
> @@ -253,6 +253,46 @@
>          return dest;
>  }
>
> +
> +CMPIStatus cu_merge_instances(CMPIInstance *src,
> +                              CMPIInstance *dest)
> +{
> +
> +        int i;
> +        int prop_count;
> +        CMPIData data;
> +        CMPIStatus s = {CMPI_RC_OK, NULL};
> +
> +        CU_DEBUG("Merging instances");
> +        prop_count = CMGetPropertyCount(src, &s);
> +        if (s.rc != CMPI_RC_OK) {
> +                CU_DEBUG("Could not get property count for merge");
> +                goto out;
> +        }
> +
> +        CU_DEBUG("Property count is %d", prop_count);
> +        for (i = 0; i < prop_count; i++) {
> +                CMPIString *prop;
> +                const char *prop_name;
> +
> +                data = CMGetPropertyAt(src, i, &prop, &s);
> +                if (s.rc != CMPI_RC_OK) {
> +                        goto out;
> +                }
> +
> +                prop_name = CMGetCharPtr(prop);
> +
> +                if(data.state == 0 ) {
> +                       CU_DEBUG("setting prop %s", prop_name);
> +                       CMSetProperty(dest, prop_name,
> +                                     &(data.value), data.type);
> +                }
> +        }
> +
> + out:
> +        return s;
> +}
> +
>  const char *cu_classname_from_inst(CMPIInstance *inst)
>  {
>          const char *ret = NULL;
> diff -r f967d9432f31 -r 531f151df659 libcmpiutil.h
> --- a/libcmpiutil.h	Wed Oct 06 09:31:05 2010 -0700
> +++ b/libcmpiutil.h	Wed Dec 08 12:44:27 2010 -0800
> @@ -167,6 +167,17 @@
>                         uint16_t *target);
>
>  /**
> + * Merge src and dest instances to dest.
> + *
> + * @param src Source instance
> + * @param dest Destination instance
> + * @returns {CMPI_RC_OK, NULL} if success, CMPI_RC ERR_FAILED and 
> + *          error message otherwise
> + */
> +CMPIStatus cu_merge_instances(CMPIInstance *src,
> +                                 CMPIInstance *dest);
> +
> +/**
>   * Create a copy of an instance
>   *
>   * @param src Source instance
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
>   


-- 
Chip Vincent
Open Virtualization, Linux Technology Center
IBM Systems & Technology Group
phone: 919-254-4482, T/L 444-4482
email: cvincent at us.ibm.com




More information about the Libvirt-cim mailing list