mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 22:03:49 +03:00
qemuBlockJobProcessEventConcludedBackup: Handle potentially NULL 'job->disk'
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@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
09cc83dcf6
commit
737f897c29
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -1372,8 +1372,12 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriver *driver,
|
||||
unsigned long long progressTotal)
|
||||
{
|
||||
g_autoptr(qemuBlockStorageSourceAttachData) backend = NULL;
|
||||
const char *diskdst = NULL;
|
||||
|
||||
qemuBackupNotifyBlockjobEnd(vm, job->disk, newstate, job->errmsg,
|
||||
if (job->disk)
|
||||
diskdst = job->disk->dst;
|
||||
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user