On Wed, Dec 12, 2018 at 06:09:04PM +0100, Peter Krempa wrote:
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 41 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_blockjob.h | 3 +++
2 files changed, 44 insertions(+)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index ee545fc8de..020e7b3994 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -480,3 +480,44 @@ qemuBlockJobGetByDisk(virDomainDiskDefPtr disk)
return virObjectRef(job);
}
+
+
+/**
+ * @monitorstatus: Status of the blockjob from qemu monitor (qemuMonitorJobStatus)
+ *
+ * Converts the block job status from the monitor to the one used by
+ * qemuBlockJobData. If the status is unknown or does not require any handling
+ * QEMU_BLOCKJOB_TYPE_LAST is returned.
+ */
+qemuBlockjobState
+qemuBlockjobConvertMonitorStatus(int monitorstatus)
+{
+ qemuBlockjobState ret = QEMU_BLOCKJOB_TYPE_LAST;
+
qemu/qemu_blockjob.c:495:29: error: implicit conversion from enumeration type
'qemuBlockjobType' to different enumeration type 'qemuBlockjobState'
[-Werror,-Wenum-conversion]
qemuBlockjobState ret = QEMU_BLOCKJOB_TYPE_LAST;
~~~ ^~~~~~~~~~~~~~~~~~~~~~~
+ switch ((qemuMonitorJobStatus) monitorstatus) {
+ case QEMU_MONITOR_JOB_STATUS_READY:
+ ret = QEMU_BLOCKJOB_STATE_READY;
+ break;
+
+ case QEMU_MONITOR_JOB_STATUS_CONCLUDED:
+ ret = QEMU_BLOCKJOB_STATE_CONCLUDED;
+ break;
+
+ case QEMU_MONITOR_JOB_STATUS_UNKNOWN:
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano