aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Litke <agl@us.ibm.com>2012-01-13 14:51:23 -0600
committerEric Blake <eblake@redhat.com>2012-04-11 20:52:18 -0600
commita696f8b71a48e29c11f175e12def6d1f3b302353 (patch)
treefda83a277509e3303db86b77219af8e36fe9c535 /include
parentblockjob: add qemu capabilities related to block pull jobs (diff)
downloadlibvirt-a696f8b71a48e29c11f175e12def6d1f3b302353.tar.gz
libvirt-a696f8b71a48e29c11f175e12def6d1f3b302353.tar.bz2
libvirt-a696f8b71a48e29c11f175e12def6d1f3b302353.zip
blockjob: add API for async virDomainBlockJobAbort
Block job cancellation can take a while. Now that upstream qemu 1.1 has asynchronous block cancellation, we want to expose that to the user. Therefore, the following updates are made to the virDomainBlockJob API: A new block job event type VIR_DOMAIN_BLOCK_JOB_CANCELED is managed by libvirt. Regardless of the flags used with virDomainBlockJobAbort, this event will be raised: 1. when using synchronous block_job_cancel (the event will be synthesized by libvirt), and 2. whenever it is received from qemu (via asynchronous block-job-cancel). Note that the event may be detected by libvirt even before the virDomainBlockJobAbort completes (always true when it is synthesized, but also possible if cancellation was fast). A new extension flag VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC is added to the virDomainBlockJobAbort API. When enabled, this function will allow (but not require) asynchronous operation (ie, it returns as soon as possible, which might be before the job has actually been canceled). When the API is used in this mode, it is the responsibility of the caller to wait for a VIR_DOMAIN_BLOCK_JOB_CANCELED event or poll via the virDomainGetBlockJobInfo API to check the cancellation status. This patch also exposes the new flag through virsh, and makes virsh slightly easier to use (--async implies --abort, and lack of any options implies --info), although it leaves the qemu implementation for later patches. Signed-off-by: Adam Litke <agl@us.ibm.com> Cc: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/libvirt/libvirt.h.in10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 499dcd451..97ad99d93 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1946,6 +1946,15 @@ typedef enum {
#endif
} virDomainBlockJobType;
+/**
+ * virDomainBlockJobAbortFlags:
+ *
+ * VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC: Request only, do not wait for completion
+ */
+typedef enum {
+ VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC = 1 << 0,
+} virDomainBlockJobAbortFlags;
+
/* An iterator for monitoring block job operations */
typedef unsigned long long virDomainBlockJobCursor;
@@ -3617,6 +3626,7 @@ typedef void (*virConnectDomainEventGraphicsCallback)(virConnectPtr conn,
typedef enum {
VIR_DOMAIN_BLOCK_JOB_COMPLETED = 0,
VIR_DOMAIN_BLOCK_JOB_FAILED = 1,
+ VIR_DOMAIN_BLOCK_JOB_CANCELED = 2,
#ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_BLOCK_JOB_LAST