|
|
357786 |
From 4825ef2a732c3df196b681474a5aba44622da0a6 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
9bac43 |
Date: Tue, 14 Mar 2017 14:25:44 +0100
|
|
|
9bac43 |
Subject: HMP: Forward-port __com.redhat_drive_add from RHEL-6
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
9bac43 |
Message-id: <1387262799-10350-5-git-send-email-armbru@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 56295
|
|
|
9bac43 |
O-Subject: [PATCH v2 4/6] HMP: Forward-port __com.redhat_drive_add from RHEL-6
|
|
|
9bac43 |
Bugzilla: 889051
|
|
|
9bac43 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
Rebase notes (2.8.0):
|
|
|
9bac43 |
- qmp-commands.hx replaced by docs/qmp-commands.txt (commit bd6092e)
|
|
|
9bac43 |
- mhandler.cmd attribute renamed to cmd (commit 2b9e357)
|
|
|
9bac43 |
|
|
|
9bac43 |
Rebase notes (2.4.0):
|
|
|
9bac43 |
- removed user_print
|
|
|
9bac43 |
|
|
|
9bac43 |
Merged patches (2.9.0):
|
|
|
9bac43 |
- 854d5bf Drop macro RFQDN_REDHAT (partially)
|
|
|
9bac43 |
- 4804631 HMP: Clean up botched conflict resolution in user manual
|
|
|
9bac43 |
- bb06f4 HMP: Fix documentation of __com.redhat.drive_add
|
|
|
9bac43 |
|
|
|
9bac43 |
Merged patches (2.7.0):
|
|
|
9bac43 |
- a28dcc5 Fix crash bug in rebase of__com.redhat_drive_add
|
|
|
9bac43 |
|
|
|
9bac43 |
(cherry picked from commit 913177df4933b58f50ba55ad2e1205b03b61fc54)
|
|
|
357786 |
(cherry picked from commit 365e9ae133897df34817774c93b40ecee0821cf1)
|
|
|
357786 |
(cherry picked from commit d1b35add1a3e78f8b3fd321f251f8c2ab098a3a4)
|
|
|
357786 |
(cherry picked from commit d208565cba99223f730bcf7fc3598d02d1746462)
|
|
|
357786 |
(cherry picked from commit 8fae16b0f498343c87c1dd945936857b45ba9ee8)
|
|
|
9bac43 |
---
|
|
|
9bac43 |
blockdev.c | 14 ++++++++++++++
|
|
|
9bac43 |
device-hotplug.c | 12 +++++++++++-
|
|
|
9bac43 |
hmp-commands.hx | 14 ++++++++++++++
|
|
|
9bac43 |
include/sysemu/blockdev.h | 4 +++-
|
|
|
9bac43 |
include/sysemu/sysemu.h | 1 +
|
|
|
9bac43 |
monitor.c | 2 +-
|
|
|
9bac43 |
vl.c | 1 +
|
|
|
9bac43 |
7 files changed, 45 insertions(+), 3 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
357786 |
index f65d37c..e941b99 100644
|
|
|
9bac43 |
--- a/blockdev.c
|
|
|
9bac43 |
+++ b/blockdev.c
|
|
|
357786 |
@@ -4361,3 +4361,17 @@ QemuOptsList qemu_drive_opts = {
|
|
|
9bac43 |
{ /* end of list */ }
|
|
|
9bac43 |
},
|
|
|
9bac43 |
};
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+QemuOptsList qemu_simple_drive_opts = {
|
|
|
9bac43 |
+ .name = "simple-drive",
|
|
|
9bac43 |
+ .implied_opt_name = "format",
|
|
|
9bac43 |
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_simple_drive_opts.head),
|
|
|
9bac43 |
+ .desc = {
|
|
|
9bac43 |
+ /*
|
|
|
9bac43 |
+ * no elements => accept any
|
|
|
9bac43 |
+ * sanity checking will happen later
|
|
|
9bac43 |
+ * when setting device properties
|
|
|
9bac43 |
+ */
|
|
|
9bac43 |
+ { /* end if list */ }
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+};
|
|
|
9bac43 |
diff --git a/device-hotplug.c b/device-hotplug.c
|
|
|
357786 |
index 5575eb7..cff46ee 100644
|
|
|
9bac43 |
--- a/device-hotplug.c
|
|
|
9bac43 |
+++ b/device-hotplug.c
|
|
|
357786 |
@@ -119,7 +119,7 @@ static void check_parm(const char *key, QObject *obj, void *opaque)
|
|
|
9bac43 |
}
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
-void simple_drive_add(QDict *qdict, QObject **ret_data, Error **errp)
|
|
|
9bac43 |
+void qmp_simple_drive_add(QDict *qdict, QObject **ret_data, Error **errp)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
int stopped;
|
|
|
9bac43 |
Error *local_err = NULL;
|
|
|
357786 |
@@ -154,3 +154,13 @@ void simple_drive_add(QDict *qdict, QObject **ret_data, Error **errp)
|
|
|
9bac43 |
|
|
|
9bac43 |
return;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+void hmp_simple_drive_add(Monitor *mon, const QDict *qdict)
|
|
|
9bac43 |
+{
|
|
|
9bac43 |
+ Error *err = NULL;
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ qmp_simple_drive_add((QDict *)qdict, NULL, &err;;
|
|
|
9bac43 |
+ if (err) {
|
|
|
9bac43 |
+ error_report_err(err);
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+}
|
|
|
9bac43 |
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
|
|
357786 |
index 01dcbb2..399e427 100644
|
|
|
9bac43 |
--- a/hmp-commands.hx
|
|
|
9bac43 |
+++ b/hmp-commands.hx
|
|
|
357786 |
@@ -1295,6 +1295,20 @@ Add drive to PCI storage controller.
|
|
|
9bac43 |
ETEXI
|
|
|
9bac43 |
|
|
|
9bac43 |
{
|
|
|
9bac43 |
+ .name = "__com.redhat_drive_add",
|
|
|
9bac43 |
+ .args_type = "simple-drive:O",
|
|
|
9bac43 |
+ .params = "id=name,[file=file][,format=f][,media=d]...",
|
|
|
9bac43 |
+ .help = "Create a drive similar to -drive if=none.",
|
|
|
9bac43 |
+ .cmd = hmp_simple_drive_add,
|
|
|
9bac43 |
+ },
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+STEXI
|
|
|
9bac43 |
+@item __com.redhat_drive_add
|
|
|
9bac43 |
+@findex __com.redhat_drive_add
|
|
|
9bac43 |
+Create a drive similar to -drive if=none.
|
|
|
9bac43 |
+ETEXI
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ {
|
|
|
9bac43 |
.name = "pcie_aer_inject_error",
|
|
|
9bac43 |
.args_type = "advisory_non_fatal:-a,correctable:-c,"
|
|
|
9bac43 |
"id:s,error_status:s,"
|
|
|
9bac43 |
diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h
|
|
|
9bac43 |
index 3bda14c..c19c36a 100644
|
|
|
9bac43 |
--- a/include/sysemu/blockdev.h
|
|
|
9bac43 |
+++ b/include/sysemu/blockdev.h
|
|
|
9bac43 |
@@ -64,5 +64,7 @@ DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type);
|
|
|
9bac43 |
void hmp_commit(Monitor *mon, const QDict *qdict);
|
|
|
9bac43 |
void hmp_drive_del(Monitor *mon, const QDict *qdict);
|
|
|
9bac43 |
|
|
|
9bac43 |
-void simple_drive_add(QDict *qdict, QObject **ret_data, Error **errp);
|
|
|
9bac43 |
+void hmp_simple_drive_add(Monitor *mon, const QDict *qdict);
|
|
|
9bac43 |
+void qmp_simple_drive_add(QDict *qdict, QObject **ret_data, Error **errp);
|
|
|
9bac43 |
+
|
|
|
9bac43 |
#endif
|
|
|
9bac43 |
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
|
|
|
357786 |
index 5832c38..5d8634b 100644
|
|
|
9bac43 |
--- a/include/sysemu/sysemu.h
|
|
|
9bac43 |
+++ b/include/sysemu/sysemu.h
|
|
|
357786 |
@@ -200,6 +200,7 @@ extern QemuOptsList qemu_legacy_drive_opts;
|
|
|
9bac43 |
extern QemuOptsList qemu_common_drive_opts;
|
|
|
9bac43 |
extern QemuOptsList qemu_drive_opts;
|
|
|
9bac43 |
extern QemuOptsList bdrv_runtime_opts;
|
|
|
9bac43 |
+extern QemuOptsList qemu_simple_drive_opts;
|
|
|
9bac43 |
extern QemuOptsList qemu_chardev_opts;
|
|
|
9bac43 |
extern QemuOptsList qemu_device_opts;
|
|
|
9bac43 |
extern QemuOptsList qemu_netdev_opts;
|
|
|
9bac43 |
diff --git a/monitor.c b/monitor.c
|
|
|
357786 |
index c587f21..4f595ae 100644
|
|
|
9bac43 |
--- a/monitor.c
|
|
|
9bac43 |
+++ b/monitor.c
|
|
|
357786 |
@@ -1204,7 +1204,7 @@ static void monitor_init_qmp_commands(void)
|
|
|
9bac43 |
QCO_NO_OPTIONS);
|
|
|
9bac43 |
qmp_register_command(&qmp_commands, "netdev_add", qmp_netdev_add,
|
|
|
9bac43 |
QCO_NO_OPTIONS);
|
|
|
9bac43 |
- qmp_register_command(&qmp_commands, "__com.redhat_drive_add", simple_drive_add,
|
|
|
9bac43 |
+ qmp_register_command(&qmp_commands, "__com.redhat_drive_add", qmp_simple_drive_add,
|
|
|
9bac43 |
QCO_NO_OPTIONS);
|
|
|
9bac43 |
|
|
|
9bac43 |
qmp_unregister_commands_hack();
|
|
|
9bac43 |
diff --git a/vl.c b/vl.c
|
|
|
357786 |
index 03950fc..8dee9d0 100644
|
|
|
9bac43 |
--- a/vl.c
|
|
|
9bac43 |
+++ b/vl.c
|
|
|
357786 |
@@ -3078,6 +3078,7 @@ int main(int argc, char **argv, char **envp)
|
|
|
9bac43 |
qemu_add_drive_opts(&qemu_common_drive_opts);
|
|
|
9bac43 |
qemu_add_drive_opts(&qemu_drive_opts);
|
|
|
9bac43 |
qemu_add_drive_opts(&bdrv_runtime_opts);
|
|
|
9bac43 |
+ qemu_add_opts(&qemu_simple_drive_opts);
|
|
|
9bac43 |
qemu_add_opts(&qemu_chardev_opts);
|
|
|
9bac43 |
qemu_add_opts(&qemu_device_opts);
|
|
|
9bac43 |
qemu_add_opts(&qemu_netdev_opts);
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|