Re: [PATCH V2] implement managedsave in libvirt xen legacy driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bamvor Jian Zhang wrote:
> Implement the domainManagedSave, domainHasManagedSaveImage, and
> domainManagedSaveRemove functions in the libvirt legacy xen driver.
>
> domainHasManagedSaveImage check the managedsave image from filesystem
> everytime. This is different from qemu and libxl driver. In qemu or
> libxl driver, there is a hasManagesSave flags in virDomainObjPtr which
> is not used in xen legacy driver. This flag could not add into xen
> driver ptr either, because the driver ptr will be release at the end of
> every libvirt api calls. Meanwhile, AFAIK, xen store all the flags in
> xen not in libvirt xen driver. There is no need to add this flags in xen.
>
> Signed-off-by: Bamvor Jian Zhang <bjzhang@xxxxxxxx>
>   
[...]
> @@ -1505,15 +1591,32 @@ xenUnifiedDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
>  {
>      GET_PRIVATE(dom->conn);
>      int i;
> +    int ret = -1;
> +    char *name = NULL;
>  
>      virCheckFlags(0, -1);
>  
> +    name = xenUnifiedDomainManagedSavePath(priv, dom);
> +    if (!name)
> +        goto cleanup;
> +
> +    if (virFileExists(name)) {
> +        if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
> +            ret = xenDaemonDomainRestore(dom->conn, name);
> +            if (ret == 0)
> +                unlink(name);
> +        }
> +        goto cleanup;
> +    }
> +
>      for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
>          if (priv->opened[i] && drivers[i]->xenDomainCreate &&
>              drivers[i]->xenDomainCreate(dom) == 0)
>              return 0;
>   

Still a memory leak here.  I've squashed in the below patch and pushed
the result.  Thanks Bamvor.

Regards,
Jim

diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 8b44f17..3786176 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1611,10 +1611,13 @@ xenUnifiedDomainCreateWithFlags(virDomainPtr
dom, unsigned int flags)
         goto cleanup;
     }
 
-    for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
+    for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) {
         if (priv->opened[i] && drivers[i]->xenDomainCreate &&
-            drivers[i]->xenDomainCreate(dom) == 0)
-            return 0;
+            drivers[i]->xenDomainCreate(dom) == 0) {
+            ret = 0;
+            goto cleanup;
+        }
+    }
 
 cleanup:
     VIR_FREE(name);

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]