diff mbox

[v6,10/10] migration: hmp: dump globals

Message ID 1498536619-14548-11-git-send-email-peterx@redhat.com
State New
Headers show

Commit Message

Peter Xu June 27, 2017, 4:10 a.m. UTC
Now we have some globals that can be configured for migration. Dump them
in HMP info migration for better debugging.

(we can also use this to monitor whether COMPAT fields are applied
correctly on compatible machines)

Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 hmp.c                    |  3 +++
 include/migration/misc.h |  1 +
 migration/migration.c    | 11 +++++++++++
 3 files changed, 15 insertions(+)

Comments

Eduardo Habkost June 28, 2017, 5:12 p.m. UTC | #1
On Tue, Jun 27, 2017 at 12:10:19PM +0800, Peter Xu wrote:
> Now we have some globals that can be configured for migration. Dump them
> in HMP info migration for better debugging.
> 
> (we can also use this to monitor whether COMPAT fields are applied
> correctly on compatible machines)
> 
> Reviewed-by: Juan Quintela <quintela@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
[...]
> +void migration_global_dump(Monitor *mon)
> +{
> +    MigrationState *ms = migrate_get_current();
> +
> +    monitor_printf(mon, "globals: store-global-state=%d, only_migratable=%d, "
> +                   "send-configuration=%d, send-section-footer=%d\n",
> +                   ms->store_global_state, ms->only_migratable,
> +                   ms->send_configuration, ms->send_section_footer);

I wouldn't call them "globals", I would just call them "properties" (or
maybe just "settings").  They happen to be affected by global properties
if the accel/machine/user sets them, but they are just plain old QOM
properties.


> +}
> +
>  static Property migration_properties[] = {
>      DEFINE_PROP_BOOL("store-global-state", MigrationState,
>                       store_global_state, true),
> -- 
> 2.7.4
>
Peter Xu June 30, 2017, 6:22 a.m. UTC | #2
On Wed, Jun 28, 2017 at 02:12:44PM -0300, Eduardo Habkost wrote:
> On Tue, Jun 27, 2017 at 12:10:19PM +0800, Peter Xu wrote:
> > Now we have some globals that can be configured for migration. Dump them
> > in HMP info migration for better debugging.
> > 
> > (we can also use this to monitor whether COMPAT fields are applied
> > correctly on compatible machines)
> > 
> > Reviewed-by: Juan Quintela <quintela@redhat.com>
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> [...]
> > +void migration_global_dump(Monitor *mon)
> > +{
> > +    MigrationState *ms = migrate_get_current();
> > +
> > +    monitor_printf(mon, "globals: store-global-state=%d, only_migratable=%d, "
> > +                   "send-configuration=%d, send-section-footer=%d\n",
> > +                   ms->store_global_state, ms->only_migratable,
> > +                   ms->send_configuration, ms->send_section_footer);
> 
> I wouldn't call them "globals", I would just call them "properties" (or
> maybe just "settings").  They happen to be affected by global properties
> if the accel/machine/user sets them, but they are just plain old QOM
> properties.

Yes, "properties" seems better. Considering that the patch is already
merged, I am just afraid it's too trivial to send a single patch to
fix this, so I'll just temporarily skip this one. Anyway, please let
me know if you still want me to do this, I'd be glad to. Thanks,
diff mbox

Patch

diff --git a/hmp.c b/hmp.c
index 8c72c58..4c41cac 100644
--- a/hmp.c
+++ b/hmp.c
@@ -43,6 +43,7 @@ 
 #include "exec/ramlist.h"
 #include "hw/intc/intc.h"
 #include "migration/snapshot.h"
+#include "migration/misc.h"
 
 #ifdef CONFIG_SPICE
 #include <spice/enums.h>
@@ -164,6 +165,8 @@  void hmp_info_migrate(Monitor *mon, const QDict *qdict)
     info = qmp_query_migrate(NULL);
     caps = qmp_query_migrate_capabilities(NULL);
 
+    migration_global_dump(mon);
+
     /* do not display parameters during setup */
     if (info->has_status && caps) {
         monitor_printf(mon, "capabilities: ");
diff --git a/include/migration/misc.h b/include/migration/misc.h
index 854c28d..2255121 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -54,5 +54,6 @@  bool migration_has_failed(MigrationState *);
 /* ...and after the device transmission */
 bool migration_in_postcopy_after_devices(MigrationState *);
 void migration_only_migratable_set(void);
+void migration_global_dump(Monitor *mon);
 
 #endif
diff --git a/migration/migration.c b/migration/migration.c
index e7e6cf3..b1b0825 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -43,6 +43,7 @@ 
 #include "io/channel-buffer.h"
 #include "migration/colo.h"
 #include "hw/boards.h"
+#include "monitor/monitor.h"
 
 #define MAX_THROTTLE  (32 << 20)      /* Migration transfer speed throttling */
 
@@ -1993,6 +1994,16 @@  void migrate_fd_connect(MigrationState *s)
     s->migration_thread_running = true;
 }
 
+void migration_global_dump(Monitor *mon)
+{
+    MigrationState *ms = migrate_get_current();
+
+    monitor_printf(mon, "globals: store-global-state=%d, only_migratable=%d, "
+                   "send-configuration=%d, send-section-footer=%d\n",
+                   ms->store_global_state, ms->only_migratable,
+                   ms->send_configuration, ms->send_section_footer);
+}
+
 static Property migration_properties[] = {
     DEFINE_PROP_BOOL("store-global-state", MigrationState,
                      store_global_state, true),