[Libvirt-cim] [PATCH 1 of 3] This patch exposes error messages from libvirt calls in VirtualSystemManagementService

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Feb 18 23:55:11 UTC 2009


> @@ -1068,6 +1069,10 @@
>                  cu_statusf(_BROKER, &s,
>                             CMPI_RC_ERR_NOT_FOUND,
>                             "Referenced domain `%s' does not exist", name);

Remove the call to cu_statusf().

> +                virt_set_status(_BROKER, &s,
> +                                CMPI_RC_ERR_NOT_FOUND,
> +                                conn,
> +                                "Referenced domain `%s' does not exist", name);
>                  goto out;
>          }
> 
> @@ -1252,6 +1257,10 @@
>          dom = virDomainLookupByName(conn, dom_name);
>          if (dom == NULL) {
>                  CU_DEBUG("No such domain `%s'", dom_name);
> +                virt_set_status(_BROKER, &status,
> +                                CMPI_RC_ERR_NOT_FOUND,
> +                                conn,
> +                                "Referenced domain `%s' does not exist", dom_name);

When you set the status here, it will get overwritten by the calls to 
cu_statusf() on lines 1285 - 1292.

Instead, replace the cu_statusf() calls on lines 1285 - 1292 with calls 
to virt_set_status().


> @@ -1825,9 +1839,11 @@
> 
>                  dom = virDomainLookupByName(conn, name);
>                  if (dom == NULL) {
> -                        cu_statusf(_BROKER, &s,
> -                                   CMPI_RC_ERR_FAILED,
> -                                   "Unknown system `%s'", name);
> +                        virt_set_status(_BROKER, &s,
> +                                        CMPI_RC_ERR_NOT_FOUND,
> +                                        conn,
> +                                        "Referenced domain `%s' \
> +                                        does not exist", name);

Instead of splitting the string up, format like the following:

virt_set_status(_BROKER, &s,
                 CMPI_RC_ERR_NOT_FOUND,
                 conn,
                 "Referenced domain `%s' does not exist",
                 name);


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




More information about the Libvirt-cim mailing list