diff mbox series

[2/4] hmp: introduce 'writeconfig' command

Message ID 20171023151310.6462-3-vadim.galitsyn@profitbricks.com
State New
Headers show
Series [1/4] qmp: introduce 'writeconfig' command | expand

Commit Message

Vadim Galitsyn Oct. 23, 2017, 3:13 p.m. UTC
Add 'writeconfig' command for HMP monitor. This command is a
sibling of QMP command 'writeconfig'.

This is a simple way to keep track of current state of VM
after series of hotplugs and/or hotunplugs of different devices.

Signed-off-by: Vadim Galitsyn <vadim.galitsyn@profitbricks.com>
Signed-off-by: Eduardo Otubo <eduardo.otubo@profitbricks.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org
---
 hmp.h           |  1 +
 hmp.c           |  9 +++++++++
 hmp-commands.hx | 17 +++++++++++++++++
 3 files changed, 27 insertions(+)

Comments

Dr. David Alan Gilbert Oct. 24, 2017, 10:41 a.m. UTC | #1
* Vadim Galitsyn (vadim.galitsyn@profitbricks.com) wrote:
> Add 'writeconfig' command for HMP monitor. This command is a
> sibling of QMP command 'writeconfig'.
> 
> This is a simple way to keep track of current state of VM
> after series of hotplugs and/or hotunplugs of different devices.
> 
> Signed-off-by: Vadim Galitsyn <vadim.galitsyn@profitbricks.com>
> Signed-off-by: Eduardo Otubo <eduardo.otubo@profitbricks.com>
> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Cc: qemu-devel@nongnu.org

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  hmp.h           |  1 +
>  hmp.c           |  9 +++++++++
>  hmp-commands.hx | 17 +++++++++++++++++
>  3 files changed, 27 insertions(+)
> 
> diff --git a/hmp.h b/hmp.h
> index 3605003e4c..2730b7f7b9 100644
> --- a/hmp.h
> +++ b/hmp.h
> @@ -146,5 +146,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict);
>  void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
>  void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
>  void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict);
> +void hmp_writeconfig(Monitor *mon, const QDict *qdict);
>  
>  #endif
> diff --git a/hmp.c b/hmp.c
> index ec61329ebb..20af8ab870 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -2901,3 +2901,12 @@ void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict)
>      }
>      hmp_handle_error(mon, &err);
>  }
> +
> +void hmp_writeconfig(Monitor *mon, const QDict *qdict)
> +{
> +     const char *file = qdict_get_str(qdict, "file");
> +     Error *err = NULL;
> +
> +     qmp_writeconfig(file, &err);
> +     hmp_handle_error(mon, &err);
> +}
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index 1941e19932..98a3dc4b66 100644
> --- a/hmp-commands.hx
> +++ b/hmp-commands.hx
> @@ -1858,6 +1858,23 @@ ETEXI
>          .sub_table  = info_cmds,
>      },
>  
> +    {
> +        .name       = "writeconfig",
> +        .args_type  = "file:F",
> +        .params     = "file",
> +        .help       = "dump current configuration into specified file",
> +        .cmd        = hmp_writeconfig,
> +    },
> +
> +STEXI
> +@item writeconfig @var{file}
> +@findex writeconfig
> +Dump current configuration into specified @var{file}.
> +@example
> +(qemu) writeconfig /tmp/qemu.conf
> +@end example
> +ETEXI
> +
>  STEXI
>  @end table
>  ETEXI
> -- 
> 2.13.1.394.g41dd433
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Eduardo Otubo Oct. 25, 2017, 12:04 p.m. UTC | #2
On Mon, Oct 23, 2017 at 05:13:08PM +0200, Vadim Galitsyn wrote:
> Add 'writeconfig' command for HMP monitor. This command is a
> sibling of QMP command 'writeconfig'.
> 
> This is a simple way to keep track of current state of VM
> after series of hotplugs and/or hotunplugs of different devices.
> 
> Signed-off-by: Vadim Galitsyn <vadim.galitsyn@profitbricks.com>
> Signed-off-by: Eduardo Otubo <eduardo.otubo@profitbricks.com>
> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  hmp.h           |  1 +
>  hmp.c           |  9 +++++++++
>  hmp-commands.hx | 17 +++++++++++++++++
>  3 files changed, 27 insertions(+)
> 
> diff --git a/hmp.h b/hmp.h
> index 3605003e4c..2730b7f7b9 100644
> --- a/hmp.h
> +++ b/hmp.h
> @@ -146,5 +146,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict);
>  void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
>  void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
>  void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict);
> +void hmp_writeconfig(Monitor *mon, const QDict *qdict);
>  
>  #endif
> diff --git a/hmp.c b/hmp.c
> index ec61329ebb..20af8ab870 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -2901,3 +2901,12 @@ void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict)
>      }
>      hmp_handle_error(mon, &err);
>  }
> +
> +void hmp_writeconfig(Monitor *mon, const QDict *qdict)
> +{
> +     const char *file = qdict_get_str(qdict, "file");
> +     Error *err = NULL;
> +
> +     qmp_writeconfig(file, &err);
> +     hmp_handle_error(mon, &err);
> +}
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index 1941e19932..98a3dc4b66 100644
> --- a/hmp-commands.hx
> +++ b/hmp-commands.hx
> @@ -1858,6 +1858,23 @@ ETEXI
>          .sub_table  = info_cmds,
>      },
>  
> +    {
> +        .name       = "writeconfig",
> +        .args_type  = "file:F",
> +        .params     = "file",
> +        .help       = "dump current configuration into specified file",
> +        .cmd        = hmp_writeconfig,
> +    },
> +
> +STEXI
> +@item writeconfig @var{file}
> +@findex writeconfig
> +Dump current configuration into specified @var{file}.
> +@example
> +(qemu) writeconfig /tmp/qemu.conf
> +@end example
> +ETEXI
> +
>  STEXI
>  @end table
>  ETEXI
> -- 
> 2.13.1.394.g41dd433
> 
> 
Reviewed-by: Eduardo Otubo <otubo@redhat.com>
diff mbox series

Patch

diff --git a/hmp.h b/hmp.h
index 3605003e4c..2730b7f7b9 100644
--- a/hmp.h
+++ b/hmp.h
@@ -146,5 +146,6 @@  void hmp_info_ramblock(Monitor *mon, const QDict *qdict);
 void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
 void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
 void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict);
+void hmp_writeconfig(Monitor *mon, const QDict *qdict);
 
 #endif
diff --git a/hmp.c b/hmp.c
index ec61329ebb..20af8ab870 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2901,3 +2901,12 @@  void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict)
     }
     hmp_handle_error(mon, &err);
 }
+
+void hmp_writeconfig(Monitor *mon, const QDict *qdict)
+{
+     const char *file = qdict_get_str(qdict, "file");
+     Error *err = NULL;
+
+     qmp_writeconfig(file, &err);
+     hmp_handle_error(mon, &err);
+}
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 1941e19932..98a3dc4b66 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1858,6 +1858,23 @@  ETEXI
         .sub_table  = info_cmds,
     },
 
+    {
+        .name       = "writeconfig",
+        .args_type  = "file:F",
+        .params     = "file",
+        .help       = "dump current configuration into specified file",
+        .cmd        = hmp_writeconfig,
+    },
+
+STEXI
+@item writeconfig @var{file}
+@findex writeconfig
+Dump current configuration into specified @var{file}.
+@example
+(qemu) writeconfig /tmp/qemu.conf
+@end example
+ETEXI
+
 STEXI
 @end table
 ETEXI