<html><body>
<p>Sharad Mishra<br>
Open Virtualization<br>
Linux Technology Center<br>
IBM<br>
<br>
<tt>libvirt-cim-bounces@redhat.com wrote on 04/28/2011 04:51:13 PM:<br>
<br>
> Chip Vincent <cvincent@linux.vnet.ibm.com> </tt><br>
<tt>> Sent by: libvirt-cim-bounces@redhat.com<br>
> </tt><br>
<tt>> 04/28/2011 04:51 PM</tt><br>
<tt>> <br>
> Please respond to<br>
> List for discussion and development of libvirt CIM <libvirt-cim@redhat.com></tt><br>
<tt>> <br>
> To</tt><br>
<tt>> <br>
> libvirt-cim@redhat.com</tt><br>
<tt>> <br>
> cc</tt><br>
<tt>> <br>
> Subject</tt><br>
<tt>> <br>
> [Libvirt-cim] [PATCH] Fix UUID in migration job lifecycle indications</tt><br>
<tt>> <br>
> # HG changeset patch<br>
> # User Chip Vincent <cvincent@us.ibm.com><br>
> # Date 1304034351 14400<br>
> # Node ID 454ce8f30a13881cc6f5206d8e8e6f42a2ff8621<br>
> # Parent  8b428df21c360d1eaedba7157b0dfd429d2db121<br>
> Fix UUID in migration job lifecycle indications.<br>
> <br>
> Fixed the logic that fetches a VM UUID and adds it to the migration <br>
> job's InstanceIdentifier property.<br>
> <br>
> Siged-off-by: Chip Vincent <cvincent@us.ibm.com><br>
> <br>
> diff --git a/src/Virt_VSMigrationService.c b/src/Virt_VSMigrationService.c<br>
> --- a/src/Virt_VSMigrationService.c<br>
> +++ b/src/Virt_VSMigrationService.c<br>
> @@ -812,15 +812,20 @@<br>
>          CMPIInstance *ind = NULL;<br>
>          CMPIInstance *prev_inst = NULL;<br>
>          const char *pfx = NULL;<br>
> +        virConnectPtr conn = NULL;<br>
>          virDomainPtr dom = NULL;<br>
>          char uuid[VIR_UUID_STRING_BUFLEN];<br>
>          CMPIDateTime *timestamp = NULL;<br>
>          <br>
> +        conn = connect_by_classname(_BROKER, job->ref_cn, s);<br>
> +        if(conn == NULL)<br>
> +                goto out;</tt><br>
<br>
<tt>"out" will try to close a connection that has not been established yet.</tt><br>
<tt><br>
> +<br>
>          ind_name = ind_type_to_name(ind_type);<br>
>  <br>
>          CU_DEBUG("Creating indication.");<br>
>  <br>
> -        pfx = pfx_from_conn(job->conn);<br>
> +        pfx = pfx_from_conn(conn);<br>
>  <br>
>          ind = get_typed_instance(broker, <br>
>                                   pfx, <br>
> @@ -832,13 +837,15 @@<br>
>                  goto out;<br>
>          }<br>
>          <br>
> -        dom = virDomainLookupByName(job->conn, job->domain);<br>
> -        if(dom == NULL) {<br>
> -                CU_DEBUG("Failed to connect to domain %s", job->domain);<br>
> +        timestamp = CMNewDateTime(broker, s);<br>
> +        CMSetProperty(ind, "IndicationTime",<br>
> +                (CMPIValue *)&timestamp, CMPI_dateTime);<br>
> +        <br>
> +        dom = virDomainLookupByName(conn, job->domain);<br>
> +        if (dom == NULL)<br>
>                  goto out;<br>
> -        }<br>
>  <br>
> -        if(virDomainGetUUIDString(dom, uuid) != 0) {<br>
> +        if (virDomainGetUUIDString(dom, &uuid[0]) != 0) {</tt><br>
<br>
<tt>Why are you doing "&uuid[0]" and why not just "&uuid" ?</tt><br>
<tt><br>
>                  CU_DEBUG("Failed to get UUID from domain name");<br>
>                  goto out;<br>
>          }<br>
> @@ -846,10 +853,6 @@<br>
>          CMSetProperty(ind, "IndicationIdentifier",<br>
>                  (CMPIValue *)uuid, CMPI_chars);<br>
>  <br>
> -        timestamp = CMNewDateTime(broker, s);<br>
> -        CMSetProperty(ind, "IndicationTime",<br>
> -                (CMPIValue *)&timestamp, CMPI_dateTime);<br>
> -<br>
>          if (ind_type == MIG_MODIFIED) {<br>
>                  /* Need to copy job inst before attaching as <br>
> PreviousInstance <br>
>                     because otherwise the changes we are about to make to job<br>
> @@ -867,6 +870,7 @@<br>
>  <br>
>   out:<br>
>          virDomainFree(dom);<br>
> +        virConnectClose(conn);<br>
>          return ind;<br>
>  }<br>
>  <br>
> _______________________________________________<br>
> Libvirt-cim mailing list<br>
> Libvirt-cim@redhat.com<br>
> <a href="https://www.redhat.com/mailman/listinfo/libvirt-cim">https://www.redhat.com/mailman/listinfo/libvirt-cim</a><br>
</tt></body></html>