76daa3
From c590551b1615b5c263437bb1c34fefc543d3546d Mon Sep 17 00:00:00 2001
76daa3
From: Jeffrey Cody <jcody@redhat.com>
76daa3
Date: Mon, 31 Jul 2017 16:25:58 +0200
76daa3
Subject: [PATCH 16/17] RHEL Diff.: Disable live block operations in HMP
76daa3
 monitor
76daa3
76daa3
RH-Author: Jeffrey Cody <jcody@redhat.com>
76daa3
Message-id: <1b8c30b6d2cfbe225b34da89668b2f3f5a3de612.1501517983.git.jcody@redhat.com>
76daa3
Patchwork-id: 75875
76daa3
O-Subject: [Pegas-1.0 qemu-kvm PATCH v4 3/4] RHEL Diff.: Disable live block operations in HMP monitor
76daa3
Bugzilla: 1418532
76daa3
RH-Acked-by: Eric Blake <eblake@redhat.com>
76daa3
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
76daa3
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
76daa3
76daa3
Signed-off-by: Jeff Cody <jcody@redhat.com>
76daa3
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
76daa3
---
76daa3
 hmp-commands-info.hx |  4 ++++
76daa3
 hmp-commands.hx      | 12 ++++++++++++
76daa3
 hmp.c                | 12 ++++++++++++
76daa3
 3 files changed, 28 insertions(+)
76daa3
76daa3
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
76daa3
index a53f105..194c930 100644
76daa3
--- a/hmp-commands-info.hx
76daa3
+++ b/hmp-commands-info.hx
76daa3
@@ -84,6 +84,8 @@ STEXI
76daa3
 Show block device statistics.
76daa3
 ETEXI
76daa3
 
76daa3
+#ifdef CONFIG_LIVE_BLOCK_OPS
76daa3
+
76daa3
     {
76daa3
         .name       = "block-jobs",
76daa3
         .args_type  = "",
76daa3
@@ -98,6 +100,8 @@ STEXI
76daa3
 Show progress of ongoing block device operations.
76daa3
 ETEXI
76daa3
 
76daa3
+#endif /* CONFIG_LIVE_BLOCK_OPS */
76daa3
+
76daa3
     {
76daa3
         .name       = "registers",
76daa3
         .args_type  = "",
76daa3
diff --git a/hmp-commands.hx b/hmp-commands.hx
76daa3
index f8b2b1c..f76b4d9 100644
76daa3
--- a/hmp-commands.hx
76daa3
+++ b/hmp-commands.hx
76daa3
@@ -73,6 +73,8 @@ but should be used with extreme caution.  Note that this command only
76daa3
 resizes image files, it can not resize block devices like LVM volumes.
76daa3
 ETEXI
76daa3
 
76daa3
+#ifdef CONFIG_LIVE_BLOCK_OPS
76daa3
+
76daa3
     {
76daa3
         .name       = "block_stream",
76daa3
         .args_type  = "device:B,speed:o?,base:s?",
76daa3
@@ -159,6 +161,8 @@ STEXI
76daa3
 Resume a paused block streaming operation.
76daa3
 ETEXI
76daa3
 
76daa3
+#endif /* CONFIG_LIVE_BLOCK_OPS */
76daa3
+
76daa3
     {
76daa3
         .name       = "eject",
76daa3
         .args_type  = "force:-f,device:B",
76daa3
@@ -1167,6 +1171,8 @@ STEXI
76daa3
 Save guest storage keys to a file.
76daa3
 ETEXI
76daa3
 
76daa3
+#ifdef CONFIG_LIVE_BLOCK_OPS
76daa3
+
76daa3
     {
76daa3
         .name       = "snapshot_blkdev",
76daa3
         .args_type  = "reuse:-n,device:B,snapshot-file:s?,format:s?",
76daa3
@@ -1188,6 +1194,8 @@ STEXI
76daa3
 Snapshot device, using snapshot file as target if provided
76daa3
 ETEXI
76daa3
 
76daa3
+#endif /* CONFIG_LIVE_BLOCK_OPS */
76daa3
+
76daa3
     {
76daa3
         .name       = "snapshot_blkdev_internal",
76daa3
         .args_type  = "device:B,name:s",
76daa3
@@ -1222,6 +1230,8 @@ STEXI
76daa3
 Delete an internal snapshot on device if it support
76daa3
 ETEXI
76daa3
 
76daa3
+#ifdef CONFIG_LIVE_BLOCK_OPS
76daa3
+
76daa3
     {
76daa3
         .name       = "drive_mirror",
76daa3
         .args_type  = "reuse:-n,full:-f,device:B,target:s,format:s?",
76daa3
@@ -1265,6 +1275,8 @@ STEXI
76daa3
 Start a point-in-time copy of a block device to a specificed target.
76daa3
 ETEXI
76daa3
 
76daa3
+#endif /* CONFIG_LIVE_BLOCK_OPS */
76daa3
+
76daa3
     {
76daa3
         .name       = "drive_add",
76daa3
         .args_type  = "node:-n,pci_addr:s,opts:s",
76daa3
diff --git a/hmp.c b/hmp.c
76daa3
index 33ee308..3e621f0 100644
76daa3
--- a/hmp.c
76daa3
+++ b/hmp.c
76daa3
@@ -893,6 +893,8 @@ void hmp_info_pci(Monitor *mon, const QDict *qdict)
76daa3
     qapi_free_PciInfoList(info_list);
76daa3
 }
76daa3
 
76daa3
+#ifdef CONFIG_LIVE_BLOCK_OPS
76daa3
+
76daa3
 void hmp_info_block_jobs(Monitor *mon, const QDict *qdict)
76daa3
 {
76daa3
     BlockJobInfoList *list;
76daa3
@@ -931,6 +933,8 @@ void hmp_info_block_jobs(Monitor *mon, const QDict *qdict)
76daa3
     qapi_free_BlockJobInfoList(list);
76daa3
 }
76daa3
 
76daa3
+#endif /* CONFIG_LIVE_BLOCK_OPS */
76daa3
+
76daa3
 void hmp_info_tpm(Monitor *mon, const QDict *qdict)
76daa3
 {
76daa3
     TPMInfoList *info_list, *info;
76daa3
@@ -1164,6 +1168,8 @@ void hmp_block_resize(Monitor *mon, const QDict *qdict)
76daa3
     hmp_handle_error(mon, &err;;
76daa3
 }
76daa3
 
76daa3
+#ifdef CONFIG_LIVE_BLOCK_OPS
76daa3
+
76daa3
 void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
76daa3
 {
76daa3
     const char *filename = qdict_get_str(qdict, "target");
76daa3
@@ -1247,6 +1253,8 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
76daa3
     hmp_handle_error(mon, &err;;
76daa3
 }
76daa3
 
76daa3
+#endif /* CONFIG_LIVE_BLOCK_OPS */
76daa3
+
76daa3
 void hmp_snapshot_blkdev_internal(Monitor *mon, const QDict *qdict)
76daa3
 {
76daa3
     const char *device = qdict_get_str(qdict, "device");
76daa3
@@ -1571,6 +1579,8 @@ void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict)
76daa3
     hmp_handle_error(mon, &err;;
76daa3
 }
76daa3
 
76daa3
+#ifdef CONFIG_LIVE_BLOCK_OPS
76daa3
+
76daa3
 void hmp_block_stream(Monitor *mon, const QDict *qdict)
76daa3
 {
76daa3
     Error *error = NULL;
76daa3
@@ -1637,6 +1647,8 @@ void hmp_block_job_complete(Monitor *mon, const QDict *qdict)
76daa3
     hmp_handle_error(mon, &error);
76daa3
 }
76daa3
 
76daa3
+#endif /* CONFIG_LIVE_BLOCK_OPS */
76daa3
+
76daa3
 typedef struct HMPMigrationStatus
76daa3
 {
76daa3
     QEMUTimer *timer;
76daa3
-- 
76daa3
1.8.3.1
76daa3