render / rpms / libvirt

Forked from rpms/libvirt 11 months ago
Clone
9119d9
From b514fee67a81636d71e4598ab8a1bcc64459f7b2 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <b514fee67a81636d71e4598ab8a1bcc64459f7b2@dist-git>
9119d9
From: Eric Blake <eblake@redhat.com>
9119d9
Date: Wed, 29 Oct 2014 15:15:23 -0600
9119d9
Subject: [PATCH] qemu: better error message when block job can't succeed
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1140981 reports that
9119d9
the qemu-kvm shipped as part of RHEL 7.0 intentionally[1] cripples
9119d9
block jobs by removing the 'block-stream' QMP command, while still
9119d9
leaving 'block-job-cancel' as an unusable no-op.  Meanwhile, we
9119d9
already had existing code that checked whether block jobs were
9119d9
completely missing (such as qemu 0.15), old style (cancel is
9119d9
synchronous, and all commands spelled with '_'), or new style
9119d9
(cancel is asynchronous, and all commands spelled with '-'), and
9119d9
used that three-way probe to give decent error messages.  At the
9119d9
time that code was added, all existing qemu versions fell in one
9119d9
of three buckets, and the code was using the presence of
9119d9
'block-job-cancel' as the witness of which of the three buckets.
9119d9
But now that RHEL qemu has shipped with intentionally crippled
9119d9
'block-stream', we have a fourth bucket, which results in ugly
9119d9
error messages when trying 'virsh blockpull':
9119d9
9119d9
 error: Requested operation is not valid: Command 'block-stream' is not found
9119d9
9119d9
In reality, the fourth bucket should be treated the same as the
9119d9
first bucket (no block job support); we can do that by realizing
9119d9
that no existing build of qemu has working block-stream while
9119d9
lacking block-job-cancel, so it is easiest to change our witness
9119d9
to the command that starts a job rather than ends one.  We still
9119d9
act correctly regarding command spelling and whether cancel is
9119d9
asynchronous.  And on crippled RHEL builds, we now get the desired:
9119d9
9119d9
 error: unsupported configuration: block jobs not supported with this qemu binary
9119d9
9119d9
[1] The intentional cripple is limited to qemu-kvm of RHEL; when using
9119d9
qemu-kvm-rhev of RHEV, block job functionality is supported.  Don't ask
9119d9
me to explain the "why" behind it all - I'm just dealing with fallout
9119d9
from someone else's decision.
9119d9
9119d9
* src/qemu/qemu_capabilities.h (QEMU_CAPS_BLOCKJOB_SYNC): Tweak comment.
9119d9
* src/qemu/qemu_capabilities.c (virQEMUCapsCommands): Look for stream
9119d9
rather than cancel when determining the flavor of block jobs supported.
9119d9
9119d9
Signed-off-by: Eric Blake <eblake@redhat.com>
9119d9
(cherry picked from commit 00331bfbc9626ee9e94352453087b521943236ca)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_capabilities.c | 4 ++--
9119d9
 src/qemu/qemu_capabilities.h | 4 ++--
9119d9
 2 files changed, 4 insertions(+), 4 deletions(-)
9119d9
9119d9
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
9119d9
index bb804d3..683b882 100644
9119d9
--- a/src/qemu/qemu_capabilities.c
9119d9
+++ b/src/qemu/qemu_capabilities.c
9119d9
@@ -1422,8 +1422,8 @@ struct virQEMUCapsStringFlags {
9119d9
 struct virQEMUCapsStringFlags virQEMUCapsCommands[] = {
9119d9
     { "system_wakeup", QEMU_CAPS_WAKEUP },
9119d9
     { "transaction", QEMU_CAPS_TRANSACTION },
9119d9
-    { "block_job_cancel", QEMU_CAPS_BLOCKJOB_SYNC },
9119d9
-    { "block-job-cancel", QEMU_CAPS_BLOCKJOB_ASYNC },
9119d9
+    { "block_stream", QEMU_CAPS_BLOCKJOB_SYNC },
9119d9
+    { "block-stream", QEMU_CAPS_BLOCKJOB_ASYNC },
9119d9
     { "dump-guest-memory", QEMU_CAPS_DUMP_GUEST_MEMORY },
9119d9
     { "query-spice", QEMU_CAPS_SPICE },
9119d9
     { "query-kvm", QEMU_CAPS_KVM },
9119d9
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
9119d9
index d3a9a0a..08c531d 100644
9119d9
--- a/src/qemu/qemu_capabilities.h
9119d9
+++ b/src/qemu/qemu_capabilities.h
9119d9
@@ -127,8 +127,8 @@ typedef enum {
9119d9
     QEMU_CAPS_SCSI_DISK_CHANNEL  = 87, /* Is scsi-disk.channel available? */
9119d9
     QEMU_CAPS_SCSI_BLOCK         = 88, /* -device scsi-block */
9119d9
     QEMU_CAPS_TRANSACTION        = 89, /* transaction monitor command */
9119d9
-    QEMU_CAPS_BLOCKJOB_SYNC      = 90, /* RHEL 6.2 block_job_cancel */
9119d9
-    QEMU_CAPS_BLOCKJOB_ASYNC     = 91, /* qemu 1.1 block-job-cancel */
9119d9
+    QEMU_CAPS_BLOCKJOB_SYNC      = 90, /* old block_job_cancel, block_stream */
9119d9
+    QEMU_CAPS_BLOCKJOB_ASYNC     = 91, /* new block-job-cancel, block-stream */
9119d9
     QEMU_CAPS_SCSI_CD            = 92, /* -device scsi-cd */
9119d9
     QEMU_CAPS_IDE_CD             = 93, /* -device ide-cd */
9119d9
     QEMU_CAPS_NO_USER_CONFIG     = 94, /* -no-user-config */
9119d9
-- 
9119d9
2.1.3
9119d9