mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
qemu: Replace qemuDomainDiskSourceDiffers by virStorageSourceIsSameLocation
Now that we have a saner replacement for checking if the disk source is the same use it instead of formatting qemu command-line chunks. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3dfcd17c9d
commit
80250f70c5
@ -8705,40 +8705,6 @@ qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
qemuDomainDiskSourceDiffers(virDomainDiskDefPtr disk,
|
||||
virDomainDiskDefPtr origDisk)
|
||||
{
|
||||
char *diskSrc = NULL, *origDiskSrc = NULL;
|
||||
bool diskEmpty, origDiskEmpty;
|
||||
bool ret = true;
|
||||
|
||||
diskEmpty = virStorageSourceIsEmpty(disk->src);
|
||||
origDiskEmpty = virStorageSourceIsEmpty(origDisk->src);
|
||||
|
||||
if (diskEmpty && origDiskEmpty)
|
||||
return false;
|
||||
|
||||
if (diskEmpty ^ origDiskEmpty)
|
||||
return true;
|
||||
|
||||
/* This won't be a network storage, so no need to get the diskPriv
|
||||
* in order to fetch the secret, thus NULL for param2 */
|
||||
if (qemuGetDriveSourceString(disk->src, NULL, &diskSrc) < 0 ||
|
||||
qemuGetDriveSourceString(origDisk->src, NULL, &origDiskSrc) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* So far in qemu disk sources are considered different
|
||||
* if either path to disk or its format changes. */
|
||||
ret = virDomainDiskGetFormat(disk) != virDomainDiskGetFormat(origDisk) ||
|
||||
STRNEQ_NULLABLE(diskSrc, origDiskSrc);
|
||||
cleanup:
|
||||
VIR_FREE(diskSrc);
|
||||
VIR_FREE(origDiskSrc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Makes sure the @disk differs from @orig_disk only by the source
|
||||
* path and nothing else. Fields that are being checked and the
|
||||
|
@ -720,9 +720,6 @@ int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
||||
virDomainDiskDefPtr disk,
|
||||
bool report_broken);
|
||||
|
||||
bool qemuDomainDiskSourceDiffers(virDomainDiskDefPtr disk,
|
||||
virDomainDiskDefPtr origDisk);
|
||||
|
||||
bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
|
||||
virDomainDiskDefPtr orig_disk);
|
||||
|
||||
|
@ -7871,7 +7871,7 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm,
|
||||
if (!qemuDomainDiskChangeSupported(disk, orig_disk))
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainDiskSourceDiffers(disk, orig_disk)) {
|
||||
if (!virStorageSourceIsSameLocation(disk->src, orig_disk->src)) {
|
||||
/* Disk source can be changed only for removable devices */
|
||||
if (disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
|
||||
disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
|
||||
|
Loading…
Reference in New Issue
Block a user