mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
backup: Store 'apiFlags' in private section of virDomainBackupDef
'qemuBackupJobTerminate' needs the API flags to see whether VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL. Unfortunately when called via qemuProcessReconnect()->qemuProcessStop() early (e.g. if the qemu process died while we were reconnecting) the job is cleared temporarily so that other APIs can be called. This would mean that we couldn't clean up the files in some cases. Save the 'apiFlags' inside the backup object and set it from the 'qemuDomainJobObj' 'apiFlags' member when reconnecting to a VM. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7b8f78a3af
commit
aa372e5a01
@ -99,6 +99,8 @@ struct _virDomainBackupDef {
|
|||||||
unsigned long long pull_tmp_total;
|
unsigned long long pull_tmp_total;
|
||||||
|
|
||||||
char *errmsg; /* error message of failed sub-blockjob */
|
char *errmsg; /* error message of failed sub-blockjob */
|
||||||
|
|
||||||
|
unsigned int apiFlags; /* original flags used when starting the job */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -560,7 +560,7 @@ qemuBackupJobTerminate(virDomainObjPtr vm,
|
|||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!(priv->job.apiFlags & VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL) &&
|
if (!(priv->backup->apiFlags & VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL) &&
|
||||||
(priv->backup->type == VIR_DOMAIN_BACKUP_TYPE_PULL ||
|
(priv->backup->type == VIR_DOMAIN_BACKUP_TYPE_PULL ||
|
||||||
(priv->backup->type == VIR_DOMAIN_BACKUP_TYPE_PUSH &&
|
(priv->backup->type == VIR_DOMAIN_BACKUP_TYPE_PUSH &&
|
||||||
jobstatus != QEMU_DOMAIN_JOB_STATUS_COMPLETED))) {
|
jobstatus != QEMU_DOMAIN_JOB_STATUS_COMPLETED))) {
|
||||||
@ -766,6 +766,8 @@ qemuBackupBegin(virDomainObjPtr vm,
|
|||||||
if (def->type == VIR_DOMAIN_BACKUP_TYPE_PULL)
|
if (def->type == VIR_DOMAIN_BACKUP_TYPE_PULL)
|
||||||
pull = true;
|
pull = true;
|
||||||
|
|
||||||
|
def->apiFlags = flags;
|
||||||
|
|
||||||
/* we'll treat this kind of backup job as an asyncjob as it uses some of the
|
/* we'll treat this kind of backup job as an asyncjob as it uses some of the
|
||||||
* infrastructure for async jobs. We'll allow standard modify-type jobs
|
* infrastructure for async jobs. We'll allow standard modify-type jobs
|
||||||
* as the interlocking of conflicting operations is handled on the block
|
* as the interlocking of conflicting operations is handled on the block
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
#include "virthreadjob.h"
|
#include "virthreadjob.h"
|
||||||
#include "virutil.h"
|
#include "virutil.h"
|
||||||
#include "storage_source.h"
|
#include "storage_source.h"
|
||||||
|
#include "backup_conf.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_QEMU
|
#define VIR_FROM_THIS VIR_FROM_QEMU
|
||||||
|
|
||||||
@ -8315,12 +8316,14 @@ qemuProcessReconnect(void *opaque)
|
|||||||
g_clear_object(&data->identity);
|
g_clear_object(&data->identity);
|
||||||
VIR_FREE(data);
|
VIR_FREE(data);
|
||||||
|
|
||||||
|
cfg = virQEMUDriverGetConfig(driver);
|
||||||
|
priv = obj->privateData;
|
||||||
|
|
||||||
qemuDomainObjRestoreJob(obj, &oldjob);
|
qemuDomainObjRestoreJob(obj, &oldjob);
|
||||||
if (oldjob.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN)
|
if (oldjob.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN)
|
||||||
stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
|
stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
|
||||||
|
if (oldjob.asyncJob == QEMU_ASYNC_JOB_BACKUP && priv->backup)
|
||||||
cfg = virQEMUDriverGetConfig(driver);
|
priv->backup->apiFlags = oldjob.apiFlags;
|
||||||
priv = obj->privateData;
|
|
||||||
|
|
||||||
/* expect that libvirt might have crashed during VM start, so prevent
|
/* expect that libvirt might have crashed during VM start, so prevent
|
||||||
* cleanup of transient disks */
|
* cleanup of transient disks */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user