mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 13:05:27 +00:00
qemu: Replace use of virDomainDiskFindByBusAndDst with virDomainDiskByTarget
In both replaced cases we have other code that verifies that the bus can't be changed or that the target is unique, so limiting the search to disks with same bus makes no sense. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
22335e9ed0
commit
704edb1b70
@ -7978,12 +7978,9 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm,
|
||||
virDomainDeviceDef oldDev = { .type = dev->type };
|
||||
int ret = -1;
|
||||
|
||||
if (!(orig_disk = virDomainDiskFindByBusAndDst(vm->def,
|
||||
disk->bus, disk->dst))) {
|
||||
if (!(orig_disk = virDomainDiskByTarget(vm->def, disk->dst))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("No device with bus '%s' and target '%s'"),
|
||||
virDomainDiskBusTypeToString(disk->bus),
|
||||
disk->dst);
|
||||
_("disk '%s' not found"), disk->dst);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1092,7 +1092,7 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver,
|
||||
* for devices supporting media changes */
|
||||
if ((disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ||
|
||||
disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) &&
|
||||
(orig_disk = virDomainDiskFindByBusAndDst(vm->def, disk->bus, disk->dst))) {
|
||||
(orig_disk = virDomainDiskByTarget(vm->def, disk->dst))) {
|
||||
if (qemuDomainChangeEjectableMedia(driver, vm, orig_disk,
|
||||
disk->src, false) < 0)
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user