From: Peter Krempa Date: Wed, 29 Mar 2017 14:56:05 +0000 (+0200) Subject: qemu: domain: Properly lookup top of chain in qemuDomainGetStorageSourceByDevstr X-Git-Tag: v3.2.0-rc2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20ee78bf9bafe542097fe0e144921d001a6799a7;p=thirdparty%2Flibvirt.git qemu: domain: Properly lookup top of chain in qemuDomainGetStorageSourceByDevstr When idx is 0 virStorageFileChainLookup returns the base (bottom) of the backing chain rather than the top. This is expected by the callers of qemuDomainGetStorageSourceByDevstr. Add a special case for idx == 0 --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 458bb5f9a4..589eb18899 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8605,7 +8605,10 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr, goto cleanup; } - src = virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL); + if (idx == 0) + src = disk->src; + else + src = virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL); cleanup: VIR_FREE(target);