[PATCH 09/10] qemuDomainGetStorageSourceByDevstr: Look also in 'mirror' chain

Peter Krempa posted 10 patches 5 years, 6 months ago
[PATCH 09/10] qemuDomainGetStorageSourceByDevstr: Look also in 'mirror' chain
Posted by Peter Krempa 5 years, 6 months ago
A disk can have a mirror, look also in it's backing chain.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_domain.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 18fd445e30..ebf18a546e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11553,11 +11553,16 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr,
     }

     if (idx == 0)
-        src = disk->src;
-    else
-        src = virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL);
+        return disk->src;
+
+    if ((src = virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL)))
+        return src;

-    return src;
+    if (disk->mirror &&
+        (src = virStorageFileChainLookup(disk->mirror, NULL, NULL, idx, NULL)))
+        return src;
+
+    return NULL;
 }


-- 
2.26.2

Re: [PATCH 09/10] qemuDomainGetStorageSourceByDevstr: Look also in 'mirror' chain
Posted by Eric Blake 5 years, 6 months ago
On 7/15/20 8:10 AM, Peter Krempa wrote:
> A disk can have a mirror, look also in it's backing chain.

its

(it's is only valid when you can replace with 'it is')

> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>   src/qemu/qemu_domain.c | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

Hmm, when doing a pull-mode backup, do we ever want a write-threshold on 
the temporary image?  Or is this only for actual block-copy mirroring, 
and not backups?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Re: [PATCH 09/10] qemuDomainGetStorageSourceByDevstr: Look also in 'mirror' chain
Posted by Peter Krempa 5 years, 6 months ago
On Mon, Jul 20, 2020 at 16:07:25 -0500, Eric Blake wrote:
> On 7/15/20 8:10 AM, Peter Krempa wrote:
> > A disk can have a mirror, look also in it's backing chain.
> 
> its
> 
> (it's is only valid when you can replace with 'it is')
> 
> > 
> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> > ---
> >   src/qemu/qemu_domain.c | 13 +++++++++----
> >   1 file changed, 9 insertions(+), 4 deletions(-)
> > 
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
> Hmm, when doing a pull-mode backup, do we ever want a write-threshold on the
> temporary image?

That's a good question. I didn't yet have a request for it.

> Or is this only for actual block-copy mirroring, and not
> backups?

This one is just for block copy for now. The slight problem is that the
backup scratch is not associated with the disk in the VM xml, but
technically nothing prevents us from adding the event for that as well.
The question is only how to do it API-wise.