0a122b
From c18bb5012af503e6ca0278cc5bd9457d853fa218 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <c18bb5012af503e6ca0278cc5bd9457d853fa218.1387385974.git.minovotn@redhat.com>
0a122b
In-Reply-To: <7cba796b16325e96d01e65bd265b4073ab103157.1387385974.git.minovotn@redhat.com>
0a122b
References: <7cba796b16325e96d01e65bd265b4073ab103157.1387385974.git.minovotn@redhat.com>
0a122b
From: Markus Armbruster <armbru@redhat.com>
0a122b
Date: Tue, 17 Dec 2013 06:46:37 +0100
0a122b
Subject: [PATCH 3/5] HMP: Forward-port __com.redhat_drive_add from RHEL-6
0a122b
0a122b
RH-Author: Markus Armbruster <armbru@redhat.com>
0a122b
Message-id: <1387262799-10350-5-git-send-email-armbru@redhat.com>
0a122b
Patchwork-id: 56295
0a122b
O-Subject: [PATCH v2 4/6] HMP: Forward-port __com.redhat_drive_add from RHEL-6
0a122b
Bugzilla: 889051
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
0a122b
0a122b
From: Markus Armbruster <armbru@redhat.com>
0a122b
0a122b
Signed-off-by: Markus Armbruster <armbru@redhat.com>
0a122b
---
0a122b
 blockdev.c              | 14 ++++++++++++++
0a122b
 hmp-commands.hx         | 15 +++++++++++++++
0a122b
 include/sysemu/sysemu.h |  1 +
0a122b
 vl.c                    |  1 +
0a122b
 4 files changed, 31 insertions(+)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 blockdev.c              | 14 ++++++++++++++
0a122b
 hmp-commands.hx         | 15 +++++++++++++++
0a122b
 include/sysemu/sysemu.h |  1 +
0a122b
 vl.c                    |  1 +
0a122b
 4 files changed, 31 insertions(+)
0a122b
0a122b
diff --git a/blockdev.c b/blockdev.c
0a122b
index f6d607c..93fb339 100644
0a122b
--- a/blockdev.c
0a122b
+++ b/blockdev.c
0a122b
@@ -1916,3 +1916,17 @@ QemuOptsList qemu_drive_opts = {
0a122b
         { /* end of list */ }
0a122b
     },
0a122b
 };
0a122b
+
0a122b
+QemuOptsList qemu_simple_drive_opts = {
0a122b
+    .name = "simple-drive",
0a122b
+    .implied_opt_name = "format",
0a122b
+    .head = QTAILQ_HEAD_INITIALIZER(qemu_simple_drive_opts.head),
0a122b
+    .desc = {
0a122b
+        /*
0a122b
+         * no elements => accept any
0a122b
+         * sanity checking will happen later
0a122b
+         * when setting device properties
0a122b
+         */
0a122b
+        { /* end if list */ }
0a122b
+    }
0a122b
+};
0a122b
diff --git a/hmp-commands.hx b/hmp-commands.hx
0a122b
index c881e01..bfb565b 100644
0a122b
--- a/hmp-commands.hx
0a122b
+++ b/hmp-commands.hx
0a122b
@@ -1091,6 +1091,21 @@ STEXI
0a122b
 Add drive to PCI storage controller.
0a122b
 ETEXI
0a122b
 
0a122b
+    {
0a122b
+        .name       = RFQDN_REDHAT "drive_add",
0a122b
+        .args_type  = "simple-drive:O",
0a122b
+        .params     = "id=name,[file=file][,format=f][,media=d]...",
0a122b
+        .help       = "Create a drive similar to -device if=none.",
0a122b
+	.user_print = monitor_user_noop,
0a122b
+        .mhandler.cmd_new = simple_drive_add,
0a122b
+    },
0a122b
+
0a122b
+STEXI
0a122b
+@item __com.redhat_drive_add
0a122b
+@findex __com.redhat_drive_add
0a122b
+Create a drive similar to -device if=none.
0a122b
+ETEXI
0a122b
+
0a122b
 #if defined(TARGET_I386) && 0 /* Disabled for Red Hat Enterprise Linux */
0a122b
     {
0a122b
         .name       = "pci_add",
0a122b
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
0a122b
index 8fbc818..c70d2dd 100644
0a122b
--- a/include/sysemu/sysemu.h
0a122b
+++ b/include/sysemu/sysemu.h
0a122b
@@ -192,6 +192,7 @@ QemuOpts *qemu_get_machine_opts(void);
0a122b
 bool usb_enabled(bool default_usb);
0a122b
 
0a122b
 extern QemuOptsList qemu_drive_opts;
0a122b
+extern QemuOptsList qemu_simple_drive_opts;
0a122b
 extern QemuOptsList qemu_chardev_opts;
0a122b
 extern QemuOptsList qemu_device_opts;
0a122b
 extern QemuOptsList qemu_netdev_opts;
0a122b
diff --git a/vl.c b/vl.c
0a122b
index da12b90..4a79f62 100644
0a122b
--- a/vl.c
0a122b
+++ b/vl.c
0a122b
@@ -2837,6 +2837,7 @@ int main(int argc, char **argv, char **envp)
0a122b
     module_call_init(MODULE_INIT_QOM);
0a122b
 
0a122b
     qemu_add_opts(&qemu_drive_opts);
0a122b
+    qemu_add_opts(&qemu_simple_drive_opts);
0a122b
     qemu_add_opts(&qemu_chardev_opts);
0a122b
     qemu_add_opts(&qemu_device_opts);
0a122b
     qemu_add_opts(&qemu_netdev_opts);
0a122b
-- 
0a122b
1.7.11.7
0a122b