mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virStorageSourceIsSameLocation: Special-case storage sources of type 'volume'
The function is used also to compare virStorageSource which may not be resolved to the image at that point in which case the 'path' is not yet populated and the actual type is not yet set. This means that the function fails to consider two identical volume-based disks as pointing to the same thing. Add a special case for both images being type=volume in which case we compare only the pool/volume names. Closes: https://gitlab.com/libvirt/libvirt/-/issues/240 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
c0b40323f8
commit
f654464f7a
@ -920,6 +920,13 @@ virStorageSourceIsSameLocation(virStorageSource *a,
|
||||
virStorageSourceIsEmpty(b))
|
||||
return true;
|
||||
|
||||
/* for disk type=volume we must check just pool/volume names as they might
|
||||
* not yet be resolved if e.g. we are comparing against the persistent def */
|
||||
if (a->type == VIR_STORAGE_TYPE_VOLUME && b->type == VIR_STORAGE_TYPE_VOLUME) {
|
||||
return STREQ(a->srcpool->pool, b->srcpool->pool) &&
|
||||
STREQ(a->srcpool->volume, b->srcpool->volume);
|
||||
}
|
||||
|
||||
if (virStorageSourceGetActualType(a) != virStorageSourceGetActualType(b))
|
||||
return false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user