qemu: blockjob: Add reference to disk into struct qemuBlockJobData

Block jobs can also happen on objects which are not a disk at a given
point (e.g. the frontend was not hotplugged yet) and thus will be
eventually kept separately. Add a reference back to the disk for
blockjobs which do correspond to a disk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-11-21 15:36:47 +01:00
parent addb82bc5f
commit f877ec1020
2 changed files with 3 additions and 0 deletions

View File

@ -99,6 +99,7 @@ qemuBlockJobDataPtr
qemuBlockJobDiskNew(virDomainDiskDefPtr disk)
{
qemuBlockJobDataPtr job = QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob;
job->disk = disk;
qemuBlockJobDataReset(job);
return virObjectRef(job);

View File

@ -32,6 +32,8 @@ typedef qemuBlockJobData *qemuBlockJobDataPtr;
struct _qemuBlockJobData {
virObject parent;
virDomainDiskDefPtr disk; /* may be NULL, if blockjob does not correspond to any disk */
bool started;
int type;
char *errmsg;