]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: blockjob: Add block job states for abort and pivot operations
authorPeter Krempa <pkrempa@redhat.com>
Mon, 11 Feb 2019 13:36:24 +0000 (14:36 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 25 Jul 2019 11:21:32 +0000 (13:21 +0200)
When initiating a pivot or abort of a block job we need to track which
one was initiated. Currently it was done via data stashed in
virDomainDiskDef. Add possibility to track this also together with the
job itself.

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 292610d089c6bd12598da2cfbb2db2e10d24cadf..fe0114bf2668e488534560cde9eeb333b18d35d9 100644 (file)
@@ -53,7 +53,9 @@ VIR_ENUM_IMPL(qemuBlockjobState,
               "ready",
               "new",
               "running",
-              "concluded");
+              "concluded",
+              "aborting",
+              "pivoting");
 
 VIR_ENUM_IMPL(qemuBlockjob,
               QEMU_BLOCKJOB_TYPE_LAST,
@@ -599,6 +601,8 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
     case QEMU_BLOCKJOB_STATE_NEW:
     case QEMU_BLOCKJOB_STATE_RUNNING:
     case QEMU_BLOCKJOB_STATE_CONCLUDED:
+    case QEMU_BLOCKJOB_STATE_ABORTING:
+    case QEMU_BLOCKJOB_STATE_PIVOTING:
     case QEMU_BLOCKJOB_STATE_LAST:
     default:
         break;
@@ -724,6 +728,9 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
     case QEMU_BLOCKJOB_STATE_NEW:
     case QEMU_BLOCKJOB_STATE_RUNNING:
     case QEMU_BLOCKJOB_STATE_LAST:
+    /* these are never processed as 'newstate' */
+    case QEMU_BLOCKJOB_STATE_ABORTING:
+    case QEMU_BLOCKJOB_STATE_PIVOTING:
     default:
         job->newstate = -1;
     }
index b0d17963fd3225efda80a275d36570dea1e27138..47bdc54b2b81f43904f2fa459964c81865fe353b 100644 (file)
@@ -40,6 +40,8 @@ typedef enum {
     QEMU_BLOCKJOB_STATE_RUNNING,
     QEMU_BLOCKJOB_STATE_CONCLUDED, /* job has finished, but it's unknown
                                       whether it has failed or not */
+    QEMU_BLOCKJOB_STATE_ABORTING,
+    QEMU_BLOCKJOB_STATE_PIVOTING,
     QEMU_BLOCKJOB_STATE_LAST
 } qemuBlockjobState;
 verify((int)QEMU_BLOCKJOB_STATE_NEW == VIR_DOMAIN_BLOCK_JOB_LAST);