mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-29 12:01:16 +00:00
qemu: backup: Properly propagate async job type when cancelling the job
When cancelling the blockjobs as part of failed backup job startup recover we didn't pass in the correct async job type. Luckily the block job handler and cancellation code paths use no block job at all currently so those were correct. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
3a98fe9db3
commit
bc8b159cb1
@ -661,6 +661,7 @@ qemuBackupJobTerminate(virDomainObjPtr vm,
|
||||
* @vm: domain object
|
||||
* @backup: backup definition
|
||||
* @terminatebackup: flag whether to terminate and unregister the backup
|
||||
* @asyncJob: currently used qemu asynchronous job type
|
||||
*
|
||||
* Sends all active blockjobs which are part of @backup of @vm a signal to
|
||||
* cancel. If @terminatebackup is true qemuBackupJobTerminate is also called
|
||||
@ -669,7 +670,8 @@ qemuBackupJobTerminate(virDomainObjPtr vm,
|
||||
void
|
||||
qemuBackupJobCancelBlockjobs(virDomainObjPtr vm,
|
||||
virDomainBackupDefPtr backup,
|
||||
bool terminatebackup)
|
||||
bool terminatebackup,
|
||||
int asyncJob)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
size_t i;
|
||||
@ -703,7 +705,8 @@ qemuBackupJobCancelBlockjobs(virDomainObjPtr vm,
|
||||
if (backupdisk->state != VIR_DOMAIN_BACKUP_DISK_STATE_RUNNING)
|
||||
continue;
|
||||
|
||||
qemuDomainObjEnterMonitor(priv->driver, vm);
|
||||
if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
|
||||
return;
|
||||
|
||||
rc = qemuMonitorJobCancel(priv->mon, job->name, false);
|
||||
|
||||
@ -868,7 +871,7 @@ qemuBackupBegin(virDomainObjPtr vm,
|
||||
goto endjob;
|
||||
|
||||
if (rc < 0) {
|
||||
qemuBackupJobCancelBlockjobs(vm, priv->backup, false);
|
||||
qemuBackupJobCancelBlockjobs(vm, priv->backup, false, QEMU_ASYNC_JOB_BACKUP);
|
||||
goto endjob;
|
||||
}
|
||||
}
|
||||
@ -919,7 +922,8 @@ qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk,
|
||||
qemuBlockjobState state,
|
||||
unsigned long long cur,
|
||||
unsigned long long end)
|
||||
unsigned long long end,
|
||||
int asyncJob)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
bool has_running = false;
|
||||
@ -937,7 +941,8 @@ qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm,
|
||||
return;
|
||||
|
||||
if (backup->type == VIR_DOMAIN_BACKUP_TYPE_PULL) {
|
||||
qemuDomainObjEnterMonitor(priv->driver, vm);
|
||||
if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
|
||||
return;
|
||||
ignore_value(qemuMonitorNBDServerStop(priv->mon));
|
||||
if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
|
||||
return;
|
||||
@ -1010,7 +1015,7 @@ qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm,
|
||||
|
||||
if (has_running && (has_failed || has_cancelled)) {
|
||||
/* cancel the rest of the jobs */
|
||||
qemuBackupJobCancelBlockjobs(vm, backup, false);
|
||||
qemuBackupJobCancelBlockjobs(vm, backup, false, asyncJob);
|
||||
} else if (!has_running && !has_cancelling) {
|
||||
/* all sub-jobs have stopped */
|
||||
|
||||
|
@ -31,14 +31,17 @@ qemuBackupGetXMLDesc(virDomainObjPtr vm,
|
||||
void
|
||||
qemuBackupJobCancelBlockjobs(virDomainObjPtr vm,
|
||||
virDomainBackupDefPtr backup,
|
||||
bool terminatebackup);
|
||||
bool terminatebackup,
|
||||
int asyncJob);
|
||||
|
||||
void
|
||||
qemuBackupNotifyBlockjobEnd(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk,
|
||||
qemuBlockjobState state,
|
||||
unsigned long long cur,
|
||||
unsigned long long end);
|
||||
unsigned long long end,
|
||||
int asyncJob);
|
||||
|
||||
|
||||
int
|
||||
qemuBackupGetJobInfoStats(virQEMUDriverPtr driver,
|
||||
|
@ -1336,7 +1336,8 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriverPtr driver,
|
||||
g_autoptr(qemuBlockStorageSourceAttachData) backend = NULL;
|
||||
g_autoptr(virJSONValue) actions = NULL;
|
||||
|
||||
qemuBackupNotifyBlockjobEnd(vm, job->disk, newstate, progressCurrent, progressTotal);
|
||||
qemuBackupNotifyBlockjobEnd(vm, job->disk, newstate,
|
||||
progressCurrent, progressTotal, asyncJob);
|
||||
|
||||
if (job->data.backup.store &&
|
||||
!(backend = qemuBlockStorageSourceDetachPrepare(job->data.backup.store, NULL)))
|
||||
|
@ -14121,7 +14121,7 @@ static int qemuDomainAbortJob(virDomainPtr dom)
|
||||
break;
|
||||
|
||||
case QEMU_ASYNC_JOB_BACKUP:
|
||||
qemuBackupJobCancelBlockjobs(vm, priv->backup, true);
|
||||
qemuBackupJobCancelBlockjobs(vm, priv->backup, true, QEMU_ASYNC_JOB_NONE);
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user