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

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Feb 19 00:24:22 UTC 2009


>          if (virConnectGetVersion(dconn, &remote)) {
> -                cu_statusf(_BROKER, &s,
> -                           CMPI_RC_ERR_FAILED,
> -                           "Unable to get remote hypervisor version");
> +                virt_set_status(_BROKER, &s,
> +                                CMPI_RC_ERR_FAILED,
> +                                conn,

This needs to be dconn, not conn.


> @@ -930,9 +950,10 @@
> 
>          ret = virDomainGetInfo(dom, &info);
>          if (ret == -1) {
> -                cu_statusf(_BROKER, &s,
> -                           CMPI_RC_ERR_FAILED,
> -                           "Error getting domain info");
> +                virt_set_status(_BROKER, &s,
> +                                CMPI_RC_ERR_FAILED,
> +                                conn,

There isn't a conn variable in this function.  You need to use: 
virDomainGetConnect(dom);

> +                                "Error getting domain info");
>                  goto out;
>          }
> 

Can you fix the bug on line 973?  That should be using dconn, not 
virDomainGetConnect(dom);

> @@ -969,9 +990,10 @@
>          CU_DEBUG("Shutting down domain for migration");
>          ret = virDomainShutdown(dom);
>          if (ret != 0) {
> -                cu_statusf(_BROKER, &s,
> -                           CMPI_RC_ERR_FAILED,
> -                           "Unable to shutdown guest");
> +                virt_set_status(_BROKER, &s,
> +                                CMPI_RC_ERR_FAILED,
> +                                dconn,

This should be virDomainGetConnect(dom), not dconn.  You're shutting 
down the guest on the local system, but the remote system.

Actually.. dconn isn't used in the function.  Should be removed from the 
function at some point, but that's a different patch altogether....

> +                                "Unable to shutdown guest");
>                  goto out;
>          }
> 
> @@ -1005,10 +1027,21 @@
> 
>          *xml = virDomainGetXMLDesc(dom, 0);
>          if (*xml == NULL) {
> -                cu_statusf(_BROKER, &s,
> -                           CMPI_RC_ERR_FAILED,
> -                           "Unable to retrieve domain XML.");
> -                goto out;
> +
> +                virConnectPtr conn = virDomainGetConnect(dom);
> +                if (conn == NULL) {
> +                        cu_statusf(_BROKER, &s,
> +                                   CMPI_RC_ERR_FAILED,
> +                                   "Unable to retrieve domain XML.");
> +                        goto out;
> +                }

No need for this check here.  virt_set_status() handles NULL connections.

> +
> +                virt_set_status(_BROKER, &s,
> +                                CMPI_RC_ERR_FAILED,
> +                                conn,
> +                                "Unable to retrieve domain XML");
> +
> +                                goto out;

The goto out isn't aligned properly.
>          }
> 
>   out:
> @@ -1036,6 +1069,13 @@
>                                              virDomainGetName(ldom));
>                  if (dom == NULL) {
>                          CU_DEBUG("Unable to re-lookup domain");
> +
> +                        virt_set_status(_BROKER, &s,
> +                                        CMPI_RC_ERR_NOT_FOUND,
> +                                        rconn,

Should use virDomainGetConnect(ldom) instead of rconn.

> +                                        "Domain `%s' not found",
> +                                        virDomainGetName(ldom));
> +


> @@ -1086,9 +1129,20 @@
> 
>          ret = virDomainGetInfo(dom, &info);
>          if (ret == -1) {
> -                cu_statusf(_BROKER, &s,
> -                           CMPI_RC_ERR_FAILED,
> -                           "Error getting domain info");
> +                virConnectPtr conn = virDomainGetConnect(dom);
> +                if (conn == NULL) {
> +                        cu_statusf(_BROKER, &s,
> +                                   CMPI_RC_ERR_FAILED,
> +                                   "Error getting domain info");
> +
> +                        goto out;
> +                }

No need to do this check - virt_set_status() handles NULL connections.


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




More information about the Libvirt-cim mailing list