qemu: blockjob: Store 'flags' for all the block job types

The flags may control important aspects of the block job which may
influence also the termination of the job. Store the 'flags' for all
the block job types.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-01-30 14:02:55 +01:00
parent 9ba804a1d1
commit ccd4228aff
3 changed files with 20 additions and 9 deletions

View File

@ -252,7 +252,8 @@ qemuBlockJobDiskNew(virDomainObjPtr vm,
qemuBlockJobDataPtr
qemuBlockJobDiskNewPull(virDomainObjPtr vm,
virDomainDiskDefPtr disk,
virStorageSourcePtr base)
virStorageSourcePtr base,
unsigned int jobflags)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
g_autoptr(qemuBlockJobData) job = NULL;
@ -269,6 +270,7 @@ qemuBlockJobDiskNewPull(virDomainObjPtr vm,
return NULL;
job->data.pull.base = base;
job->jobflags = jobflags;
if (qemuBlockJobRegister(job, vm, disk, true) < 0)
return NULL;
@ -283,7 +285,8 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
virStorageSourcePtr topparent,
virStorageSourcePtr top,
virStorageSourcePtr base,
bool delete_imgs)
bool delete_imgs,
unsigned int jobflags)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
g_autoptr(qemuBlockJobData) job = NULL;
@ -307,6 +310,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
job->data.commit.top = top;
job->data.commit.base = base;
job->data.commit.deleteCommittedImages = delete_imgs;
job->jobflags = jobflags;
if (qemuBlockJobRegister(job, vm, disk, true) < 0)
return NULL;
@ -350,7 +354,8 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm,
virDomainDiskDefPtr disk,
virStorageSourcePtr mirror,
bool shallow,
bool reuse)
bool reuse,
unsigned int jobflags)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
g_autoptr(qemuBlockJobData) job = NULL;
@ -371,6 +376,8 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm,
if (shallow && !reuse)
job->data.copy.shallownew = true;
job->jobflags = jobflags;
if (qemuBlockJobRegister(job, vm, disk, true) < 0)
return NULL;

View File

@ -176,7 +176,8 @@ qemuBlockJobDiskNew(virDomainObjPtr vm,
qemuBlockJobDataPtr
qemuBlockJobDiskNewPull(virDomainObjPtr vm,
virDomainDiskDefPtr disk,
virStorageSourcePtr base);
virStorageSourcePtr base,
unsigned int jobflags);
qemuBlockJobDataPtr
qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
@ -184,7 +185,8 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm,
virStorageSourcePtr topparent,
virStorageSourcePtr top,
virStorageSourcePtr base,
bool delete_imgs);
bool delete_imgs,
unsigned int jobflags);
qemuBlockJobDataPtr
qemuBlockJobNewCreate(virDomainObjPtr vm,
@ -197,7 +199,8 @@ qemuBlockJobDiskNewCopy(virDomainObjPtr vm,
virDomainDiskDefPtr disk,
virStorageSourcePtr mirror,
bool shallow,
bool reuse);
bool reuse,
unsigned int jobflags);
qemuBlockJobDataPtr
qemuBlockJobDiskNewBackup(virDomainObjPtr vm,

View File

@ -17706,7 +17706,7 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm,
speed <<= 20;
}
if (!(job = qemuBlockJobDiskNewPull(vm, disk, baseSource)))
if (!(job = qemuBlockJobDiskNewPull(vm, disk, baseSource, flags)))
goto endjob;
if (blockdev) {
@ -18393,7 +18393,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
goto endjob;
}
if (!(job = qemuBlockJobDiskNewCopy(vm, disk, mirror, mirror_shallow, mirror_reuse)))
if (!(job = qemuBlockJobDiskNewCopy(vm, disk, mirror, mirror_shallow, mirror_reuse, flags)))
goto endjob;
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
@ -18814,7 +18814,8 @@ qemuDomainBlockCommit(virDomainPtr dom,
if (!(job = qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSource,
baseSource,
flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE)))
flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE,
flags)))
goto endjob;
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;