[Libvirt-cim] [PATCH 1 of 2] ComputerSystemDeletedIndication wasn't being called when a guest was removed. This patch fix it

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Aug 27 21:28:34 UTC 2009


> +static CMPIStatus set_properties_from_dominfo(const CMPIBroker *broker,
> +                                              const char *prefix,
> +                                              struct domain *dominfo,
> +                                              CMPIInstance *instance)
> +{
> +        CMPIStatus s = {CMPI_RC_ERR_FAILED, NULL};

Since you set the status when an error occurs, just set this to CMPI_RC_OK.

> +        CMPIObjectPath *ref = NULL;
> +
> +        ref = CMGetObjectPath(instance, &s);
> +        if ((ref == NULL) || (s.rc != CMPI_RC_OK))
> +                return s;
> +
> +        CMSetProperty(instance, "Name",
> +                      (CMPIValue *)dominfo->name, CMPI_chars);
> +
> +        CMSetProperty(instance, "ElementName",
> +                      (CMPIValue *)dominfo->name, CMPI_chars);
> +
> +        CMSetProperty(instance, "UUID",
> +                      (CMPIValue *)dominfo->uuid, CMPI_chars);
> +
> +        if (!set_capdesc_from_dominfo(broker, dominfo, ref, instance)) {
> +                CU_DEBUG("Problem in set_capdesc_from_dominfo function");
> +                cu_statusf(broker, &s, 
> +                           CMPI_RC_FAILED, 

This should be CMPI_RC_ERR_FAILED.

> +                           "Could not set caption and description properties");
> +                goto out;
> +        }
> +
> +        /* We don't set state, because struct domain doesn't have that
> +         * information */
> +
> +        if (!set_creation_class(instance)) {
> +                CU_DEBUG("Problem in set_creation_class function");
> +                cu_statusf(broker, &s,
> +                           CMPI_RC_FAILED,

Here's as well.

> +                           "Could not set creation class");
> +                goto out;
> +        }
> +
> +        if (!set_other_id_info(broker, dominfo->uuid, prefix, instance)) {
> +                CU_DEBUG("Problem in set_other_id_info function");
> +                cu_statusf(broker, &s,
> +                           CMPI_RC_FAILED,

Here too.

> +                           "Could not set other OtherIdentifyingInfo and "
> +                           "IdentifyingDescription");
> +                goto out;
> +        }
> +
> +        cu_statusf(broker, &s,
> +                   CMPI_RC_OK,
> +                   "");

This is not needed if you initialize s to be CMPI_RC_OK.

> +
> + out:
> +        return s;
> +}


-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list