]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: blockjob: Add string convertors for blockjob type and state enums
authorPeter Krempa <pkrempa@redhat.com>
Fri, 30 Nov 2018 15:55:08 +0000 (16:55 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 18 Jul 2019 15:59:34 +0000 (17:59 +0200)
Later on we'll format these values into the status XML so the from/to
string functions will come handy. The implementation also notes that
these will be used in the status XML to avoid somebody changing the
values.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_blockjob.c
src/qemu/qemu_blockjob.h

index 0e2cdd63b9fceaf67d8f33120254ba340d16c55a..3a4e364a8dff4b228a6fb19b9be231a43b3a92ba 100644 (file)
 
 VIR_LOG_INIT("qemu.qemu_blockjob");
 
+/* Note that qemuBlockjobState and qemuBlockjobType values are formatted into
+ * the status XML */
+VIR_ENUM_IMPL(qemuBlockjobState,
+              QEMU_BLOCKJOB_STATE_LAST,
+              "completed",
+              "failed",
+              "cancelled",
+              "ready",
+              "new",
+              "running");
+
+VIR_ENUM_IMPL(qemuBlockjob,
+              QEMU_BLOCKJOB_TYPE_LAST,
+              "",
+              "pull",
+              "copy",
+              "commit",
+              "active-commit",
+              "");
 
 static virClassPtr qemuBlockJobDataClass;
 
index b7aaa86f4d68ab699052c56dbc8d79acc14a5d09..77298a4bead06c9d5371cc0b4485c4fd6279d953 100644 (file)
@@ -42,6 +42,8 @@ typedef enum {
 } qemuBlockjobState;
 verify((int)QEMU_BLOCKJOB_STATE_NEW == VIR_DOMAIN_BLOCK_JOB_LAST);
 
+VIR_ENUM_DECL(qemuBlockjobState);
+
 /**
  * This enum has to map all known block job types from enum virDomainBlockJobType
  * to the same values. All internal blockjobs can be mapped after and don't
@@ -60,6 +62,8 @@ typedef enum {
 } qemuBlockJobType;
 verify((int)QEMU_BLOCKJOB_TYPE_INTERNAL == VIR_DOMAIN_BLOCK_JOB_TYPE_LAST);
 
+VIR_ENUM_DECL(qemuBlockjob);
+
 typedef struct _qemuBlockJobData qemuBlockJobData;
 typedef qemuBlockJobData *qemuBlockJobDataPtr;