[Libvirt-cim] [PATCH] Missing namespace from migration indications

Chip Vincent cvincent at linux.vnet.ibm.com
Thu Nov 4 21:50:32 UTC 2010


+1

Sharad Mishra wrote:
> # HG changeset patch
> # User Sharad Mishra <snmishra at us.ibm.com>
> # Date 1286382665 25200
> # Node ID a97431f4b91e5d4009e9f2e70dea7d7bc85464f5
> # Parent  d4beac1f62c6ad131f584b04460eb807aa46f0d4
> Missing namespace from migration indications
>
> This patch passes ObjectPath inside the indication when calling CBDeliverIndication.
>
> Signed-off-by: Sharad Mishra <snmishra at us.ibm.com>
>
> diff -r d4beac1f62c6 -r a97431f4b91e std_indication.c
> --- a/std_indication.c	Tue Sep 14 21:19:05 2010 -0400
> +++ b/std_indication.c	Wed Oct 06 09:31:05 2010 -0700
> @@ -98,13 +98,15 @@
>
>  static CMPIStatus default_raise(const CMPIBroker *broker,
>                                  const CMPIContext *context,
> +                                CMPIObjectPath *ref,
>                                  CMPIInstance *ind)
>  {
> -        CMPIObjectPath *ref;
>          CMPIStatus s = {CMPI_RC_OK, NULL};
>
> -        ref = CMGetObjectPath(ind, NULL);
> -        
> +        s = CMSetObjectPath(ind, ref);
> +        if (s.rc != CMPI_RC_OK) 
> +                return s;
> +
>          CBDeliverIndication(broker,
>                              context, 
>                              NAMESPACE(ref), 
> @@ -114,13 +116,15 @@
>
>  static CMPIStatus raise(struct std_indication_ctx *ctx,
>                          const CMPIContext *context,
> -                        const CMPIArgs *argsin)
> +                        const CMPIArgs *argsin,
> +                        CMPIObjectPath *ref)
>  {
>          bool enabled;
>          CMPIInstance *inst;
>          CMPIStatus s = {CMPI_RC_OK, NULL};
>          const char *ind_name = NULL;
>
> +        CU_DEBUG("In raise");
>          if (cu_get_inst_arg(argsin, "TheIndication", &inst) != CMPI_RC_OK) {
>                  cu_statusf(ctx->brkr, &s,
>                             CMPI_RC_ERR_FAILED,
> @@ -136,6 +140,8 @@
>                  goto out;
>          }
>
> +        CU_DEBUG("Indication is %s", ind_name);
> +
>          enabled = is_ind_enabled(ctx, ind_name, &s);
>          if (s.rc != CMPI_RC_OK) {
>                  CU_DEBUG("Problem checking enabled: '%s'", CMGetCharPtr(s.msg));
> @@ -146,13 +152,14 @@
>                  goto out;
>
>          if (ctx->handler == NULL || ctx->handler->raise_fn == NULL)
> -                s = default_raise(ctx->brkr, context, inst);
> +                s = default_raise(ctx->brkr, context, ref, inst);
>          else
> -                s = ctx->handler->raise_fn(ctx->brkr, context, inst);
> +                s = ctx->handler->raise_fn(ctx->brkr, context, ref, inst);
>
>   out:
>          return s;
>  }
> +
>  CMPIStatus stdi_deliver(const CMPIBroker *broker,
>                          const CMPIContext *ctx,
>                          struct ind_args *args,
> @@ -294,7 +301,7 @@
>  CMPIStatus stdi_handler(CMPIMethodMI *self,
>                          const CMPIContext *context,
>                          const CMPIResult *results,
> -                        const CMPIObjectPath *reference,
> +                        CMPIObjectPath *reference,
>                          const char *methodname,
>                          const CMPIArgs *argsin,
>                          CMPIArgs *argsout)
> @@ -305,13 +312,13 @@
>          if (STREQC(methodname, "TriggerIndications"))
>                  s = trigger(ctx, context);
>          else if (STREQ(methodname, "RaiseIndication"))
> -                s = raise(ctx, context, argsin);
> +                s = raise(ctx, context, argsin, reference);
>          else
>                  cu_statusf(ctx->brkr, &s,
>                             CMPI_RC_ERR_FAILED,
>                             "Invalid method");
>
> -        CMReturnDone(results); 
> +        CMReturnDone(results);
>          return s;
>  }
>
> @@ -370,8 +377,15 @@
>          CMPIArgs *argsout;
>
>          op = CMNewObjectPath(broker, ns, type, &s);
> -        if (s.rc != CMPI_RC_OK)
> +        if ((op == NULL) || (s.rc != CMPI_RC_OK)) {
> +                CU_DEBUG("Unable to create path for indication %s",
> +                         type);
> +                cu_statusf(broker, &s,
> +                           CMPI_RC_ERR_FAILED,
> +                           "Unable to create path for indication %s",
> +                           type);
>                  return s;
> +        }
>
>          argsin = CMNewArgs(broker, &s);
>          if (s.rc != CMPI_RC_OK)
> @@ -386,7 +400,7 @@
>                  return s;
>
>          CBInvokeMethod(broker, context, op, method, argsin, argsout, &s);
> -
> +        
>          return s;
>  }
>
> diff -r d4beac1f62c6 -r a97431f4b91e std_indication.h
> --- a/std_indication.h	Tue Sep 14 21:19:05 2010 -0400
> +++ b/std_indication.h	Wed Oct 06 09:31:05 2010 -0700
> @@ -41,6 +41,7 @@
>
>  typedef CMPIStatus (*raise_indication_t)(const CMPIBroker *broker,
>                                           const CMPIContext *ctx,
> +                                         CMPIObjectPath *ref,
>                                           const CMPIInstance *ind);
>
>  typedef CMPIStatus (*trigger_indication_t)(const CMPIContext *ctx);
> @@ -134,7 +135,7 @@
>  CMPIStatus stdi_handler(CMPIMethodMI *self,
>                          const CMPIContext *context,
>                          const CMPIResult *results,
> -                        const CMPIObjectPath *reference,
> +                        CMPIObjectPath *reference,
>                          const char *methodname,
>                          const CMPIArgs *argsin,
>                          CMPIArgs *argsout);
>
> _______________________________________________
> 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