[libvirt] [PATCH] qemu: better error message when block job can't succeed

Eric Blake eblake at redhat.com
Tue Oct 28 14:31:36 UTC 2014


https://bugzilla.redhat.com/show_bug.cgi?id=1140981 reports that
the qemu-kvm shipped as part of RHEL 7.0 intentionally cripples
block jobs by removing the 'block-stream' QMP command, but that
our probe for whether block jobs work was merely whether
'block-job-cancel' exists.  Meanwhile, older qemu spelled the
two commands block_stream and block_job_cancel.  We know of no
qemu build that has block-stream while lacking block-job-cancel,
so it is easiest to change our witness to the command that
starts a job rather than ends one.  On RHEL, this results in
changing the message from an ugly:

 error: Requested operation is not valid: Command 'block-stream' is not found

to a nicer:

 error: unsupported configuration: block jobs not supported with this qemu binary

* src/qemu/qemu_capabilities.h (QEMU_CAPS_BLOCKJOB_SYNC): Tweak comment.
* src/qemu/qemu_capabilities.c (virQEMUCapsCommands): Look for stream
rather than cancel when determining the flavor of block jobs supported.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 src/qemu/qemu_capabilities.c | 4 ++--
 src/qemu/qemu_capabilities.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6fcb5c7..b6c0f1b 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1422,8 +1422,8 @@ struct virQEMUCapsStringFlags {
 struct virQEMUCapsStringFlags virQEMUCapsCommands[] = {
     { "system_wakeup", QEMU_CAPS_WAKEUP },
     { "transaction", QEMU_CAPS_TRANSACTION },
-    { "block_job_cancel", QEMU_CAPS_BLOCKJOB_SYNC },
-    { "block-job-cancel", QEMU_CAPS_BLOCKJOB_ASYNC },
+    { "block_stream", QEMU_CAPS_BLOCKJOB_SYNC },
+    { "block-stream", QEMU_CAPS_BLOCKJOB_ASYNC },
     { "dump-guest-memory", QEMU_CAPS_DUMP_GUEST_MEMORY },
     { "query-spice", QEMU_CAPS_SPICE },
     { "query-kvm", QEMU_CAPS_KVM },
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 0214f30..c0e2172 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -127,8 +127,8 @@ typedef enum {
     QEMU_CAPS_SCSI_DISK_CHANNEL  = 87, /* Is scsi-disk.channel available? */
     QEMU_CAPS_SCSI_BLOCK         = 88, /* -device scsi-block */
     QEMU_CAPS_TRANSACTION        = 89, /* transaction monitor command */
-    QEMU_CAPS_BLOCKJOB_SYNC      = 90, /* RHEL 6.2 block_job_cancel */
-    QEMU_CAPS_BLOCKJOB_ASYNC     = 91, /* qemu 1.1 block-job-cancel */
+    QEMU_CAPS_BLOCKJOB_SYNC      = 90, /* old block_job_cancel, block_stream */
+    QEMU_CAPS_BLOCKJOB_ASYNC     = 91, /* new block-job-cancel, block-stream */
     QEMU_CAPS_SCSI_CD            = 92, /* -device scsi-cd */
     QEMU_CAPS_IDE_CD             = 93, /* -device ide-cd */
     QEMU_CAPS_NO_USER_CONFIG     = 94, /* -no-user-config */
-- 
1.9.3




More information about the libvir-list mailing list