qemuDomainGetStorageSourceByDevstr: Look also in 'mirror' chain

A disk can have a mirror, look also in its backing chain.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2020-07-15 12:51:40 +02:00
parent 41c6939660
commit 5c52c186fd

View File

@ -11669,11 +11669,16 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr,
}
if (idx == 0)
src = disk->src;
else
src = virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL);
return disk->src;
return src;
if ((src = virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL)))
return src;
if (disk->mirror &&
(src = virStorageFileChainLookup(disk->mirror, NULL, NULL, idx, NULL)))
return src;
return NULL;
}