diff mbox

[2/2] Add qmp version of drive_unplug

Message ID 1288646010-8272-3-git-send-email-ryanh@us.ibm.com
State New
Headers show

Commit Message

Ryan Harper Nov. 1, 2010, 9:13 p.m. UTC
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
---
 qmp-commands.hx |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/qmp-commands.hx b/qmp-commands.hx
index 793cf1c..a1f7b2f 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -338,6 +338,37 @@  Example:
 EQMP
 
     {
+        .name       = "drive_unplug",
+        .args_type  = "id:s",
+        .params     = "device",
+        .help       = "unplug block device",
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_drive_unplug,
+    },
+
+SQMP
+drive unplug
+----------
+
+Unplug a block device.  The result is that guest generated IO is no longer 
+submitted against the host device underlying the disk.  Once a drive has
+been unplugged, the QEMU Block layer returns -EIO which results in IO 
+errors in the guest for applications that are reading/writing to the device
+when it is unplugged.  Unplugged block devices can be safely deleted along with 
+the associated pci devices (if present).
+
+Arguments:
+
+- "id": the device's ID (json-string)
+
+Example:
+
+-> { "execute": "drive_unplug", "arguments": { "id": "drive-virtio-blk1" } }
+<- { "return": {} }
+
+EQMP
+
+    {
         .name       = "cpu",
         .args_type  = "index:i",
         .params     = "index",