From: Masayoshi Mizuma <m.mizuma(a)jp.fujitsu.com>
Add virtio disks to be sharable transient disks.
Signed-off-by: Masayoshi Mizuma <m.mizuma(a)jp.fujitsu.com>
---
src/qemu/qemu_hotplug.c | 13 ++++++++-----
src/qemu/qemu_process.c | 2 +-
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 5d0445538d..fc6ca028e3 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -814,7 +814,9 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
static int
qemuDomainAttachVirtioDiskDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- virDomainDiskDefPtr disk)
+ virDomainDiskDefPtr disk,
+ int bootindex,
+ qemuDomainAsyncJob asyncJob)
{
virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_DISK, { .disk = disk } };
bool releaseaddr = false;
@@ -823,8 +825,8 @@ qemuDomainAttachVirtioDiskDevice(virQEMUDriverPtr driver,
if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev, disk->dst) <
0)
return -1;
- if ((rv = qemuDomainAttachDiskGeneric(driver, vm, disk, 0,
- QEMU_ASYNC_JOB_NONE)) < 0) {
+ if ((rv = qemuDomainAttachDiskGeneric(driver, vm, disk, bootindex,
+ asyncJob)) < 0) {
if (rv == -1 && releaseaddr)
qemuDomainReleaseDeviceAddress(vm, &disk->info);
@@ -1033,7 +1035,7 @@ static int
qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- qemuDomainAsyncJob asyncJob G_GNUC_UNUSED)
+ qemuDomainAsyncJob asyncJob)
{
size_t i;
virDomainDiskDefPtr disk = dev->data.disk;
@@ -1080,7 +1082,8 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriverPtr driver,
break;
case VIR_DOMAIN_DISK_BUS_VIRTIO:
- ret = qemuDomainAttachVirtioDiskDevice(driver, vm, disk);
+ ret = qemuDomainAttachVirtioDiskDevice(driver, vm, disk,
+ disk->info.bootIndex, asyncJob);
break;
case VIR_DOMAIN_DISK_BUS_SCSI:
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2e2d1c6fea..55577632c5 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6907,7 +6907,7 @@ qemuCheckTransientDiskSharable(virDomainObjPtr vm)
for (i = 0; i < vm->def->ndisks; i++) {
virDomainDiskDefPtr disk = vm->def->disks[i];
- if (disk->transient && disk->bus != VIR_DOMAIN_DISK_BUS_LAST)
+ if (disk->transient && disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO)
return;
}
--
2.27.0