[Libvirt-cim] [PATCH 3 of 3] Parse parameters passed in to CreateResourceInPool

Richard Maciel rmaciel at linux.vnet.ibm.com
Mon Aug 10 14:16:07 UTC 2009


On 08/06/2009 06:59 PM, Kaitlin Rupert wrote:
> # HG changeset patch
> # User Kaitlin Rupert<karupert at us.ibm.com>
> # Date 1249595963 25200
> # Node ID af509ca0e7f25db4e7ce96dff8bc77df6289e9b3
> # Parent  fc589363fb55e780942d8431f9c3559d766dcb69
> Parse parameters passed in to CreateResourceInPool
>
> Signed-off-by: Kaitlin Rupert<karupert at us.ibm.com>
>
> diff -r fc589363fb55 -r af509ca0e7f2 src/Virt_ResourcePoolConfigurationService.c
> --- a/src/Virt_ResourcePoolConfigurationService.c	Thu Aug 06 14:58:56 2009 -0700
> +++ b/src/Virt_ResourcePoolConfigurationService.c	Thu Aug 06 14:59:23 2009 -0700
> @@ -664,6 +664,32 @@
>           return s;
>   }
>
> +static CMPIStatus create_resource_parse_args(const CMPIArgs *argsin,
> +                                             CMPIInstance **settings,
> +                                             CMPIObjectPath **pool)
> +{
> +        CMPIStatus s = {CMPI_RC_OK, NULL};
> +
> +        if (cu_get_inst_arg(argsin, "Settings", settings) != CMPI_RC_OK) {
> +                CU_DEBUG("Failed to get Settings arg");
> +                cu_statusf(_BROKER,&s,
> +                           CMPI_RC_ERR_INVALID_PARAMETER,
> +                           "Missing argument `Settings'");
> +                goto out;
> +        }
> +
> +        if (cu_get_ref_arg(argsin, "Pool", pool) != CMPI_RC_OK) {
> +                CU_DEBUG("Failed to get Pool reference arg");
> +                cu_statusf(_BROKER,&s,
> +                           CMPI_RC_ERR_INVALID_PARAMETER,
> +                           "Missing argument `Pool'");
> +                goto out;
> +        }
> +
> + out:
> +        return s;
> +}
> +
>   static CMPIStatus create_resource_in_pool(CMPIMethodMI *self,
>                                             const CMPIContext *context,
>                                             const CMPIResult *results,
> @@ -673,13 +699,21 @@
>   {
>           uint32_t rc = CIM_SVPC_RETURN_FAILED;
>           CMPIStatus s = {CMPI_RC_OK, NULL};
> +        CMPIInstance *settings;
> +        CMPIObjectPath *pool;
>
>           CU_DEBUG("CreateResourceInPool");
>
> +        s = create_resource_parse_args(argsin,&settings,&pool);
> +        if (s.rc != CMPI_RC_OK)
> +                goto out;
> +
>           if (s.rc == CMPI_RC_OK)
>                   rc = CIM_SVPC_RETURN_COMPLETED;
>           CMReturnData(results,&rc, CMPI_uint32);
>
> + out:
> +
>           return s;
>   }

According to the patchset header, this should check the parameters 
passed, but this code always call create_resource_parse_args with a both 
settings and pool parameters NULL. This will always generate an error!



>
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim


-- 
Richard Maciel, MSc
IBM Linux Technology Center
rmaciel at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list