9ae3a8
From 7cba796b16325e96d01e65bd265b4073ab103157 Mon Sep 17 00:00:00 2001
9ae3a8
Message-Id: <7cba796b16325e96d01e65bd265b4073ab103157.1387385974.git.minovotn@redhat.com>
9ae3a8
From: Markus Armbruster <armbru@redhat.com>
9ae3a8
Date: Tue, 17 Dec 2013 06:46:35 +0100
9ae3a8
Subject: [PATCH 1/5] QMP: Forward-port __com.redhat_drive_del from RHEL-6
9ae3a8
9ae3a8
RH-Author: Markus Armbruster <armbru@redhat.com>
9ae3a8
Message-id: <1387262799-10350-3-git-send-email-armbru@redhat.com>
9ae3a8
Patchwork-id: 56292
9ae3a8
O-Subject: [PATCH v2 2/6] QMP: Forward-port __com.redhat_drive_del from RHEL-6
9ae3a8
Bugzilla: 889051
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
9ae3a8
From: Markus Armbruster <armbru@redhat.com>
9ae3a8
9ae3a8
Upstream has drive_del, but only in HMP.  The backport to RHEL-6 added
9ae3a8
it to QMP as well.  Since the QMP command is a downstream extension,
9ae3a8
it needs the __com.redhat_ prefix.  Since RHEL-6 doesn't have separate
9ae3a8
definition of QMP and HMP commands, both the QMP and the HMP command
9ae3a8
got the prefix.
9ae3a8
9ae3a8
RHEL-7 inherits HMP command drive_del from upstream.  Add QMP command
9ae3a8
__com.redhat_drive_del for RHEL-6 compatibility.
9ae3a8
9ae3a8
If we needed similar compatibility for the HMP command, we'd have to
9ae3a8
add __com.redhat_drive_del as alias for drive_del.  But we don't.
9ae3a8
9ae3a8
Code copied from RHEL-6's qemu-monitor.hx as of
9ae3a8
qemu-kvm-0.12.1.2-2.418.el6.  It has a "drive_del" without the prefix
9ae3a8
in the documentation.  Fixed here.  Hardly worth fixing in RHEL-6 now.
9ae3a8
9ae3a8
Signed-off-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
---
9ae3a8
 qmp-commands.hx | 31 +++++++++++++++++++++++++++++++
9ae3a8
 1 file changed, 31 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
---
9ae3a8
 qmp-commands.hx | 31 +++++++++++++++++++++++++++++++
9ae3a8
 1 file changed, 31 insertions(+)
9ae3a8
9ae3a8
diff --git a/qmp-commands.hx b/qmp-commands.hx
9ae3a8
index cedcd17..0ae9204 100644
9ae3a8
--- a/qmp-commands.hx
9ae3a8
+++ b/qmp-commands.hx
9ae3a8
@@ -108,6 +108,37 @@ Note: The "force" argument defaults to false.
9ae3a8
 EQMP
9ae3a8
 
9ae3a8
     {
9ae3a8
+        .name       = RFQDN_REDHAT "drive_del",
9ae3a8
+        .args_type  = "id:s",
9ae3a8
+        .params     = "device",
9ae3a8
+        .help       = "remove host block device",
9ae3a8
+        .user_print = monitor_user_noop,
9ae3a8
+        .mhandler.cmd_new = do_drive_del,
9ae3a8
+    },
9ae3a8
+
9ae3a8
+SQMP
9ae3a8
+__com.redhat_drive_del
9ae3a8
+----------
9ae3a8
+
9ae3a8
+Remove host block device.  The result is that guest generated IO is no longer
9ae3a8
+submitted against the host device underlying the disk.  Once a drive has
9ae3a8
+been deleted, the QEMU Block layer returns -EIO which results in IO
9ae3a8
+errors in the guest for applications that are reading/writing to the device.
9ae3a8
+These errors are always reported to the guest, regardless of the drive's error
9ae3a8
+actions (drive options rerror, werror).
9ae3a8
+
9ae3a8
+Arguments:
9ae3a8
+
9ae3a8
+- "id": the device's ID (json-string)
9ae3a8
+
9ae3a8
+Example:
9ae3a8
+
9ae3a8
+-> { "execute": "__com.redhat_drive_del", "arguments": { "id": "block1" } }
9ae3a8
+<- { "return": {} }
9ae3a8
+
9ae3a8
+EQMP
9ae3a8
+
9ae3a8
+    {
9ae3a8
         .name       = "change",
9ae3a8
         .args_type  = "device:B,target:F,arg:s?",
9ae3a8
         .mhandler.cmd_new = qmp_marshal_input_change,
9ae3a8
-- 
9ae3a8
1.7.11.7
9ae3a8