Re: [PATCH RFC 48/51] qemu: blockjob: Add helper to convert monitor job status to internal state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 12, 2018 at 06:09:04PM +0100, Peter Krempa wrote:
Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
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@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux