1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-12-15 08:24:32 +03:00

qemu: backup: Don't attempt to stop the NBD server twice

When notifying the backup code about termination of the block job which
is part of a backup operation the code attempts to terminate the NBD
server. This is done for every blockjob so could cause us to attempt to
terminate the NBD server multiple times which doesn't cause problems but
generates spurious errors.

Add a flag that the NBD server was stopped and do it just once. Don't
bother storing the flag in the status XML as it's just for the shutdown
phase.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa
2025-11-19 09:11:18 +01:00
parent 7d90085e12
commit 0fe378f1b1
2 changed files with 15 additions and 8 deletions

View File

@@ -99,6 +99,10 @@ struct _virDomainBackupDef {
char *errmsg; /* error message of failed sub-blockjob */
unsigned int apiFlags; /* original flags used when starting the job */
bool nbdStopped; /* The NBD server for a pull-mode backup was stopped. This
flag is deliberately not stored in the status XML as
it's related only to termination of the backup. */
};
typedef enum {

View File

@@ -1006,14 +1006,17 @@ qemuBackupNotifyBlockjobEnd(virDomainObj *vm,
return;
if (backup->type == VIR_DOMAIN_BACKUP_TYPE_PULL) {
if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0)
return;
ignore_value(qemuMonitorNBDServerStop(priv->mon));
if (backup->tlsAlias)
ignore_value(qemuMonitorDelObject(priv->mon, backup->tlsAlias, false));
if (backup->tlsSecretAlias)
ignore_value(qemuMonitorDelObject(priv->mon, backup->tlsSecretAlias, false));
qemuDomainObjExitMonitor(vm);
if (!backup->nbdStopped) {
if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0)
return;
ignore_value(qemuMonitorNBDServerStop(priv->mon));
if (backup->tlsAlias)
ignore_value(qemuMonitorDelObject(priv->mon, backup->tlsAlias, false));
if (backup->tlsSecretAlias)
ignore_value(qemuMonitorDelObject(priv->mon, backup->tlsSecretAlias, false));
qemuDomainObjExitMonitor(vm);
backup->nbdStopped = true;
}
/* update the final statistics with the current job's data */
backup->pull_tmp_used += cur;