[Libvirt-cim] [PATCH 3 of 6] Add VirtualSystemMigrationService

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Dec 4 01:53:55 UTC 2007


Dan Smith wrote:
> +
> +        conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
> +        if (conn == NULL)
> +                goto out;
> +
> +        dom = virDomainLookupByName(conn, domain);
> +        if (dom == NULL) {
> +                CU_DEBUG("Failed to lookup `%s'", domain);
> +                cu_statusf(_BROKER, &s,
> +                           CMPI_RC_ERR_FAILED,
> +                           "Failed to lookup domain `%s'", domain);
> +                goto out;
> +        }
> +
> +        dconn = virConnectOpen(uri);
> +        if (conn == NULL) {
>   
I think to mean:
     if (dconn == NULL)
> +                CU_DEBUG("Failed to connect to remote host (%s)", uri);
> +                cu_statusf(_BROKER, &s,
> +                           CMPI_RC_ERR_FAILED,
> +                           "Failed to connect to remote host (%s)", uri);
> +                goto out;
> +        }
> +
> +        CMSetStatus(&s, CMPI_RC_OK);
>   
I'm unsure why you call CMSetStatus() before calling 
virDomainMigrate().  If virDomainMigrate() fails, we set a failure 
status.  Otherwise, we set the status again below.  Although, setting it 
here is harmless anyway. =)
> +        CU_DEBUG("Migrating %s -> %s", domain, uri);
> +
> +        ddom = virDomainMigrate(dom, dconn, VIR_MIGRATE_LIVE, NULL, NULL, 0);
> +        if (ddom == NULL) {
> +                CU_DEBUG("Migration failed");
> +                cu_statusf(_BROKER, &s,
> +                           CMPI_RC_ERR_FAILED,
> +                           "Migration Failed");
> +                goto out;
> +        }
> +
> +        CU_DEBUG("Migration succeeded");
> +        CMSetStatus(&s, CMPI_RC_OK);
> +
> + out:
>   
-- 
Kaitlin Rupert
IBM Linux Technology Center
karupert at us.ibm.com





More information about the Libvirt-cim mailing list