[libvirt] [PATCH 6/6] qemu: process: Don't redetect backing chain on reconnect

Peter Krempa posted 6 patches 7 years, 7 months ago
There is a newer version of this series
[libvirt] [PATCH 6/6] qemu: process: Don't redetect backing chain on reconnect
Posted by Peter Krempa 7 years, 7 months ago
Skip purging the backing chain and redetecting it when it was not going
to change during the time we were not present.

The decision is based on the new flag which records whether there were
blockjobs running to the status XML.
---
 src/qemu/qemu_process.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index bde3ba462..80d204599 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6892,13 +6892,18 @@ qemuProcessReconnect(void *opaque)
         if (virStorageTranslateDiskSourcePool(conn, obj->def->disks[i]) < 0)
             goto error;

-        /* XXX we should be able to restore all data from XML in the future.
-         * This should be the only place that calls qemuDomainDetermineDiskChain
-         * with @report_broken == false to guarantee best-effort domain
-         * reconnect */
-        if (qemuDomainDetermineDiskChain(driver, obj, obj->def->disks[i],
-                                         true, false) < 0)
-            goto error;
+        /* backing chains need to be refreshed only if they could change */
+        if (!priv->reconnectNoActiveBlockjobs) {
+            /* This should be the only place that calls
+             * qemuDomainDetermineDiskChain with @report_broken == false
+             * to guarantee best-effort domain reconnect */
+            if (qemuDomainDetermineDiskChain(driver, obj, obj->def->disks[i],
+                                             true, false) < 0)
+                goto error;
+        } else {
+            VIR_DEBUG("skipping backing chain detection for '%s'",
+                      obj->def->disks[i]->dst);
+        }

         dev.type = VIR_DOMAIN_DEVICE_DISK;
         dev.data.disk = obj->def->disks[i];
-- 
2.14.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/6] qemu: process: Don't redetect backing chain on reconnect
Posted by John Ferlan 7 years, 7 months ago

On 10/04/2017 07:59 AM, Peter Krempa wrote:
> Skip purging the backing chain and redetecting it when it was not going
> to change during the time we were not present.
> 
> The decision is based on the new flag which records whether there were
> blockjobs running to the status XML.
> ---
>  src/qemu/qemu_process.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index bde3ba462..80d204599 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -6892,13 +6892,18 @@ qemuProcessReconnect(void *opaque)

BTW: I'd support a

    virDomainDiskDefPtr disk = obj->def->disks[i];

right about here too ;-)


>          if (virStorageTranslateDiskSourcePool(conn, obj->def->disks[i]) < 0)
>              goto error;
> 
> -        /* XXX we should be able to restore all data from XML in the future.
> -         * This should be the only place that calls qemuDomainDetermineDiskChain
> -         * with @report_broken == false to guarantee best-effort domain
> -         * reconnect */
> -        if (qemuDomainDetermineDiskChain(driver, obj, obj->def->disks[i],
> -                                         true, false) < 0)
> -            goto error;
> +        /* backing chains need to be refreshed only if they could change */
> +        if (!priv->reconnectNoActiveBlockjobs) {

...or from my previous patch suggestion

    if (priv->NAME != VIR_TRISTATE_BOOL_NO)

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

I can give an R-B on patch 5 depending on your thoughts there. Maybe I'm
missing something in future attractions...


> +            /* This should be the only place that calls
> +             * qemuDomainDetermineDiskChain with @report_broken == false
> +             * to guarantee best-effort domain reconnect */
> +            if (qemuDomainDetermineDiskChain(driver, obj, obj->def->disks[i],
> +                                             true, false) < 0)
> +                goto error;
> +        } else {
> +            VIR_DEBUG("skipping backing chain detection for '%s'",
> +                      obj->def->disks[i]->dst);
> +        }
> 
>          dev.type = VIR_DOMAIN_DEVICE_DISK;
>          dev.data.disk = obj->def->disks[i];
> 

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