Similarly to other blockjob handlers, if there's no disk associated with
the blockjob the handler needs to behave correctly. This is needed as
the disk might have been de-associated on unplug or other operations.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_backup.c | 6 +++---
src/qemu/qemu_backup.h | 2 +-
src/qemu/qemu_blockjob.c | 9 +++++++--
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index 857709b17e..81391c29f7 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -966,7 +966,7 @@ qemuBackupGetXMLDesc(virDomainObj *vm,
void
qemuBackupNotifyBlockjobEnd(virDomainObj *vm,
- virDomainDiskDef *disk,
+ const char *diskdst,
qemuBlockjobState state,
const char *errmsg,
unsigned long long cur,
@@ -983,7 +983,7 @@ qemuBackupNotifyBlockjobEnd(virDomainObj *vm,
size_t i;
VIR_DEBUG("vm: '%s', disk:'%s', state:'%d'
errmsg:'%s'",
- vm->def->name, disk->dst, state, NULLSTR(errmsg));
+ vm->def->name, NULLSTR(diskdst), state, NULLSTR(errmsg));
if (!backup)
return;
@@ -1016,7 +1016,7 @@ qemuBackupNotifyBlockjobEnd(virDomainObj *vm,
if (!backupdisk->store)
continue;
- if (STREQ(disk->dst, backupdisk->name)) {
+ if (STREQ_NULLABLE(diskdst, backupdisk->name)) {
switch (state) {
case QEMU_BLOCKJOB_STATE_COMPLETED:
backupdisk->state = VIR_DOMAIN_BACKUP_DISK_STATE_COMPLETE;
diff --git a/src/qemu/qemu_backup.h b/src/qemu/qemu_backup.h
index ec0603026a..768da6cbef 100644
--- a/src/qemu/qemu_backup.h
+++ b/src/qemu/qemu_backup.h
@@ -36,7 +36,7 @@ qemuBackupJobCancelBlockjobs(virDomainObj *vm,
void
qemuBackupNotifyBlockjobEnd(virDomainObj *vm,
- virDomainDiskDef *disk,
+ const char *diskdst,
qemuBlockjobState state,
const char *errmsg,
unsigned long long cur,
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 4b5b63d287..42856df6d4 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -1372,8 +1372,12 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriver *driver,
unsigned long long progressTotal)
{
g_autoptr(qemuBlockStorageSourceAttachData) backend = NULL;
+ const char *diskdst = NULL;
+
+ if (job->disk)
+ diskdst = job->disk->dst;
- qemuBackupNotifyBlockjobEnd(vm, job->disk, newstate, job->errmsg,
+ qemuBackupNotifyBlockjobEnd(vm, diskdst, newstate, job->errmsg,
progressCurrent, progressTotal, asyncJob);
if (job->data.backup.store &&
@@ -1386,7 +1390,8 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriver *driver,
if (backend)
qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), backend);
- if (job->data.backup.bitmap)
+ if (job->disk &&
+ job->data.backup.bitmap)
qemuMonitorBitmapRemove(qemuDomainGetMonitor(vm),
qemuBlockStorageSourceGetEffectiveNodename(job->disk->src),
job->data.backup.bitmap);
--
2.45.2