提交 80250f70 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 3dfcd17c
...@@ -8705,40 +8705,6 @@ qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver, ...@@ -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 * Makes sure the @disk differs from @orig_disk only by the source
* path and nothing else. Fields that are being checked and the * path and nothing else. Fields that are being checked and the
......
...@@ -720,9 +720,6 @@ int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, ...@@ -720,9 +720,6 @@ int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
virDomainDiskDefPtr disk, virDomainDiskDefPtr disk,
bool report_broken); bool report_broken);
bool qemuDomainDiskSourceDiffers(virDomainDiskDefPtr disk,
virDomainDiskDefPtr origDisk);
bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk, bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
virDomainDiskDefPtr orig_disk); virDomainDiskDefPtr orig_disk);
......
...@@ -7871,7 +7871,7 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm, ...@@ -7871,7 +7871,7 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm,
if (!qemuDomainDiskChangeSupported(disk, orig_disk)) if (!qemuDomainDiskChangeSupported(disk, orig_disk))
goto cleanup; goto cleanup;
if (qemuDomainDiskSourceDiffers(disk, orig_disk)) { if (!virStorageSourceIsSameLocation(disk->src, orig_disk->src)) {
/* Disk source can be changed only for removable devices */ /* Disk source can be changed only for removable devices */
if (disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM && if (disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) { disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册