On Wed, Dec 12, 2018 at 06:08:36PM +0100, Peter Krempa wrote:
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(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 1 +
src/qemu/qemu_blockjob.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 17657a9d9b..7bbe582722 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -99,6 +99,7 @@ qemuBlockJobDataPtr
qemuBlockJobDiskNew(virDomainDiskDefPtr disk)
{
qemuBlockJobDataPtr job = QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob;
+ job->disk = disk;
qemuBlockJobDataReset(job);
return virObjectRef(job);
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
index 3d1b389dec..feaee4dee3 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -32,6 +32,8 @@ typedef qemuBlockJobData *qemuBlockJobDataPtr;
struct _qemuBlockJobData {
virObject parent;
+ virDomainDiskDefPtr disk; /* may be NULL, if blockjob does not corrspond to any disk
*/
correspond
+
bool started;
int type;
char *errmsg;
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano