From: Peter Krempa <[email protected]> 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 <[email protected]> --- src/conf/backup_conf.h | 4 ++++ src/qemu/qemu_backup.c | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/conf/backup_conf.h b/src/conf/backup_conf.h index 9c3532a546..f90a4dcaee 100644 --- a/src/conf/backup_conf.h +++ b/src/conf/backup_conf.h @@ -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 { diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 3b4fe54854..9832c186a8 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -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; -- 2.51.1
