mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
qemuDomainGetStorageSourceByDevstr: Avoid logged errors
'virStorageFileChainLookup' reports an error when the lookup of the backing chain entry is unsuccessful. Since we possibly use it multiple times when looking up backing for 'disk->mirror' the function can report error which won't be actually reported. Replace the call to virStorageFileChainLookup by lookup in the chain by index. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4c4c07b941
commit
a0a2eb12ab
@ -9950,7 +9950,7 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr,
|
||||
virDomainDefPtr def)
|
||||
{
|
||||
virDomainDiskDefPtr disk = NULL;
|
||||
virStorageSourcePtr src = NULL;
|
||||
virStorageSourcePtr n;
|
||||
g_autofree char *target = NULL;
|
||||
unsigned int idx;
|
||||
|
||||
@ -9969,13 +9969,20 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr,
|
||||
if (idx == 0)
|
||||
return disk->src;
|
||||
|
||||
if ((src = virStorageFileChainLookup(disk->src, NULL, NULL, idx, NULL)))
|
||||
return src;
|
||||
for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
|
||||
if (n->id == idx)
|
||||
return n;
|
||||
}
|
||||
|
||||
if (disk->mirror &&
|
||||
(src = virStorageFileChainLookup(disk->mirror, NULL, NULL, idx, NULL)))
|
||||
return src;
|
||||
if (disk->mirror) {
|
||||
for (n = disk->mirror; virStorageSourceIsBacking(n); n = n->backingStore) {
|
||||
if (n->id == idx)
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("failed to find disk '%s'"), devstr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user