Patchwork [v9,08/10] Add migration capabilites

login
register
mail settings
Submitter Orit Wasserman
Date April 11, 2012, 6:49 p.m.
Message ID <1334170153-9503-9-git-send-email-owasserm@redhat.com>
Download mbox | patch
Permalink /patch/151855/
State New
Headers show

Comments

Orit Wasserman - April 11, 2012, 6:49 p.m.
Add migration capabiltes that can be queried by the management.
The managment can query to source and the destination in order to
verify both support some maigration capability (currently only XBZRLE).

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
---
 hmp.c            |   18 ++++++++++++++++++
 hmp.h            |    1 +
 migration.c      |   11 +++++++++++
 monitor.c        |    7 +++++++
 qapi-schema.json |   24 ++++++++++++++++++++++++
 qmp-commands.hx  |   24 ++++++++++++++++++++++++
 savevm.c         |    2 +-
 7 files changed, 86 insertions(+), 1 deletions(-)
Juan Quintela - April 18, 2012, 4:59 p.m.
Orit Wasserman <owasserm@redhat.com> wrote:
> Add migration capabiltes that can be queried by the management.
> The managment can query to source and the destination in order to
> verify both support some maigration capability (currently only XBZRLE).

s/maigration/migration.

ok with me.

> diff --git a/savevm.c b/savevm.c
> index fbf1903..3c0b7cc 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -1573,7 +1573,7 @@ int qemu_savevm_state_begin(QEMUFile *f,
>  	}
>          se->set_params(params, se->opaque);
>      }
> -    
> +
>      qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
>      qemu_put_be32(f, QEMU_VM_FILE_VERSION);

Thisk chunk is a cleanup that don2,t belong in this patch (that don't
touch that file at all).
Anthony Liguori - April 18, 2012, 5:36 p.m.
On 04/11/2012 01:49 PM, Orit Wasserman wrote:
> Add migration capabiltes that can be queried by the management.
> The managment can query to source and the destination in order to
> verify both support some maigration capability (currently only XBZRLE).
>
> Signed-off-by: Orit Wasserman<owasserm@redhat.com>

Ah, excellent.  I'd suggest moving this earlier in the series.

> ---
>   hmp.c            |   18 ++++++++++++++++++
>   hmp.h            |    1 +
>   migration.c      |   11 +++++++++++
>   monitor.c        |    7 +++++++
>   qapi-schema.json |   24 ++++++++++++++++++++++++
>   qmp-commands.hx  |   24 ++++++++++++++++++++++++
>   savevm.c         |    2 +-
>   7 files changed, 86 insertions(+), 1 deletions(-)
>
> diff --git a/hmp.c b/hmp.c
> index 891cac6..d681bfc 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -156,6 +156,24 @@ void hmp_info_migrate(Monitor *mon)
>       qapi_free_MigrationInfo(info);
>   }
>
> +void hmp_info_migration_caps(Monitor *mon)
> +{
> +    MigrationCapList *caps_list, *cap;
> +
> +    caps_list = qmp_query_migration_caps(NULL);
> +    if (!caps_list) {
> +        monitor_printf(mon, "No migration capabilities found\n");
> +        return;
> +    }
> +
> +    for (cap = caps_list; cap; cap = cap->next) {
> +        monitor_printf(mon, "%s\n", cap->value->name);
> +    }
> +
> +    qapi_free_MigrationCapList(caps_list);
> +
> +}
> +
>   void hmp_info_cpus(Monitor *mon)
>   {
>       CpuInfoList *cpu_list, *cpu;
> diff --git a/hmp.h b/hmp.h
> index 443b812..868bfb3 100644
> --- a/hmp.h
> +++ b/hmp.h
> @@ -25,6 +25,7 @@ void hmp_info_uuid(Monitor *mon);
>   void hmp_info_chardev(Monitor *mon);
>   void hmp_info_mice(Monitor *mon);
>   void hmp_info_migrate(Monitor *mon);
> +void hmp_info_migration_caps(Monitor *mon);
>   void hmp_info_cpus(Monitor *mon);
>   void hmp_info_block(Monitor *mon);
>   void hmp_info_blockstats(Monitor *mon);
> diff --git a/migration.c b/migration.c
> index cea75aa..7578163 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -162,6 +162,17 @@ MigrationInfo *qmp_query_migrate(Error **errp)
>       return info;
>   }
>
> +MigrationCapList *qmp_query_migration_caps(Error **errp)
> +{
> +    MigrationCapList *caps_list = g_malloc0(sizeof(*caps_list));
> +
> +    caps_list->value = g_malloc(sizeof(*caps_list->value));
> +    caps_list->value->name = g_strdup("uleb");
> +    caps_list->next = NULL;
> +
> +    return caps_list;
> +}
> +
>   /* shared migration helpers */
>
>   static int migrate_fd_cleanup(MigrationState *s)
> diff --git a/monitor.c b/monitor.c
> index 8946a10..ff434e0 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2558,6 +2558,13 @@ static mon_cmd_t info_cmds[] = {
>           .mhandler.info = hmp_info_migrate,
>       },
>       {
> +        .name       = "migration_caps",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show migration capabilties",
> +        .mhandler.info = hmp_info_migration_caps,
> +    },
> +    {
>           .name       = "balloon",
>           .args_type  = "",
>           .params     = "",
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 200e4fc..775fe56 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -276,6 +276,30 @@
>   { 'command': 'query-migrate', 'returns': 'MigrationInfo' }
>
>   ##
> +# @MigrationCap
> +#
> +# Information about current migration capabilites.
> +#
> +# @xbzrle: true if the current migration supports xbzrle
> +#
> +# Since: 1.1
> +##
> +{ 'type': 'MigrationCap',
> +  'data': { 'name': 'str'} }

Please make each cap a QAPI enumeration.

So:

{ 'enum': 'MigrationCapability',
   'data': ['xel'] }

{ 'command': 'query-migration-caps', 'returns': ['MigrationCapability'] }

No need to abbreviate btw.

> diff --git a/savevm.c b/savevm.c
> index fbf1903..3c0b7cc 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -1573,7 +1573,7 @@ int qemu_savevm_state_begin(QEMUFile *f,
>   	}
>           se->set_params(params, se->opaque);
>       }
> -
> +
>       qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
>       qemu_put_be32(f, QEMU_VM_FILE_VERSION);

Please drop this.

Regards,

Anthony Liguori
Orit Wasserman - April 19, 2012, 7:10 a.m.
On 04/18/2012 08:36 PM, Anthony Liguori wrote:
> On 04/11/2012 01:49 PM, Orit Wasserman wrote:
>> Add migration capabiltes that can be queried by the management.
>> The managment can query to source and the destination in order to
>> verify both support some maigration capability (currently only XBZRLE).
>>
>> Signed-off-by: Orit Wasserman<owasserm@redhat.com>
> 
> Ah, excellent.  I'd suggest moving this earlier in the series.
OK.
> 
>> ---
>>   hmp.c            |   18 ++++++++++++++++++
>>   hmp.h            |    1 +
>>   migration.c      |   11 +++++++++++
>>   monitor.c        |    7 +++++++
>>   qapi-schema.json |   24 ++++++++++++++++++++++++
>>   qmp-commands.hx  |   24 ++++++++++++++++++++++++
>>   savevm.c         |    2 +-
>>   7 files changed, 86 insertions(+), 1 deletions(-)
>>
>> diff --git a/hmp.c b/hmp.c
>> index 891cac6..d681bfc 100644
>> --- a/hmp.c
>> +++ b/hmp.c
>> @@ -156,6 +156,24 @@ void hmp_info_migrate(Monitor *mon)
>>       qapi_free_MigrationInfo(info);
>>   }
>>
>> +void hmp_info_migration_caps(Monitor *mon)
>> +{
>> +    MigrationCapList *caps_list, *cap;
>> +
>> +    caps_list = qmp_query_migration_caps(NULL);
>> +    if (!caps_list) {
>> +        monitor_printf(mon, "No migration capabilities found\n");
>> +        return;
>> +    }
>> +
>> +    for (cap = caps_list; cap; cap = cap->next) {
>> +        monitor_printf(mon, "%s\n", cap->value->name);
>> +    }
>> +
>> +    qapi_free_MigrationCapList(caps_list);
>> +
>> +}
>> +
>>   void hmp_info_cpus(Monitor *mon)
>>   {
>>       CpuInfoList *cpu_list, *cpu;
>> diff --git a/hmp.h b/hmp.h
>> index 443b812..868bfb3 100644
>> --- a/hmp.h
>> +++ b/hmp.h
>> @@ -25,6 +25,7 @@ void hmp_info_uuid(Monitor *mon);
>>   void hmp_info_chardev(Monitor *mon);
>>   void hmp_info_mice(Monitor *mon);
>>   void hmp_info_migrate(Monitor *mon);
>> +void hmp_info_migration_caps(Monitor *mon);
>>   void hmp_info_cpus(Monitor *mon);
>>   void hmp_info_block(Monitor *mon);
>>   void hmp_info_blockstats(Monitor *mon);
>> diff --git a/migration.c b/migration.c
>> index cea75aa..7578163 100644
>> --- a/migration.c
>> +++ b/migration.c
>> @@ -162,6 +162,17 @@ MigrationInfo *qmp_query_migrate(Error **errp)
>>       return info;
>>   }
>>
>> +MigrationCapList *qmp_query_migration_caps(Error **errp)
>> +{
>> +    MigrationCapList *caps_list = g_malloc0(sizeof(*caps_list));
>> +
>> +    caps_list->value = g_malloc(sizeof(*caps_list->value));
>> +    caps_list->value->name = g_strdup("uleb");
>> +    caps_list->next = NULL;
>> +
>> +    return caps_list;
>> +}
>> +
>>   /* shared migration helpers */
>>
>>   static int migrate_fd_cleanup(MigrationState *s)
>> diff --git a/monitor.c b/monitor.c
>> index 8946a10..ff434e0 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -2558,6 +2558,13 @@ static mon_cmd_t info_cmds[] = {
>>           .mhandler.info = hmp_info_migrate,
>>       },
>>       {
>> +        .name       = "migration_caps",
>> +        .args_type  = "",
>> +        .params     = "",
>> +        .help       = "show migration capabilties",
>> +        .mhandler.info = hmp_info_migration_caps,
>> +    },
>> +    {
>>           .name       = "balloon",
>>           .args_type  = "",
>>           .params     = "",
>> diff --git a/qapi-schema.json b/qapi-schema.json
>> index 200e4fc..775fe56 100644
>> --- a/qapi-schema.json
>> +++ b/qapi-schema.json
>> @@ -276,6 +276,30 @@
>>   { 'command': 'query-migrate', 'returns': 'MigrationInfo' }
>>
>>   ##
>> +# @MigrationCap
>> +#
>> +# Information about current migration capabilites.
>> +#
>> +# @xbzrle: true if the current migration supports xbzrle
>> +#
>> +# Since: 1.1
>> +##
>> +{ 'type': 'MigrationCap',
>> +  'data': { 'name': 'str'} }
> 
> Please make each cap a QAPI enumeration.
> 
> So:
> 
> { 'enum': 'MigrationCapability',
>   'data': ['xel'] }
> 
> { 'command': 'query-migration-caps', 'returns': ['MigrationCapability'] }
> 
> No need to abbreviate btw.
I will fix it
> 
>> diff --git a/savevm.c b/savevm.c
>> index fbf1903..3c0b7cc 100644
>> --- a/savevm.c
>> +++ b/savevm.c
>> @@ -1573,7 +1573,7 @@ int qemu_savevm_state_begin(QEMUFile *f,
>>       }
>>           se->set_params(params, se->opaque);
>>       }
>> -
>> +
>>       qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
>>       qemu_put_be32(f, QEMU_VM_FILE_VERSION);
> 
> Please drop this.
ok

Thanks,
Orit
> 
> Regards,
> 
> Anthony Liguori
> 
> 
>

Patch

diff --git a/hmp.c b/hmp.c
index 891cac6..d681bfc 100644
--- a/hmp.c
+++ b/hmp.c
@@ -156,6 +156,24 @@  void hmp_info_migrate(Monitor *mon)
     qapi_free_MigrationInfo(info);
 }
 
+void hmp_info_migration_caps(Monitor *mon)
+{
+    MigrationCapList *caps_list, *cap;
+
+    caps_list = qmp_query_migration_caps(NULL);
+    if (!caps_list) {
+        monitor_printf(mon, "No migration capabilities found\n");
+        return;
+    }
+
+    for (cap = caps_list; cap; cap = cap->next) {
+        monitor_printf(mon, "%s\n", cap->value->name);
+    }
+
+    qapi_free_MigrationCapList(caps_list);
+
+}
+
 void hmp_info_cpus(Monitor *mon)
 {
     CpuInfoList *cpu_list, *cpu;
diff --git a/hmp.h b/hmp.h
index 443b812..868bfb3 100644
--- a/hmp.h
+++ b/hmp.h
@@ -25,6 +25,7 @@  void hmp_info_uuid(Monitor *mon);
 void hmp_info_chardev(Monitor *mon);
 void hmp_info_mice(Monitor *mon);
 void hmp_info_migrate(Monitor *mon);
+void hmp_info_migration_caps(Monitor *mon);
 void hmp_info_cpus(Monitor *mon);
 void hmp_info_block(Monitor *mon);
 void hmp_info_blockstats(Monitor *mon);
diff --git a/migration.c b/migration.c
index cea75aa..7578163 100644
--- a/migration.c
+++ b/migration.c
@@ -162,6 +162,17 @@  MigrationInfo *qmp_query_migrate(Error **errp)
     return info;
 }
 
+MigrationCapList *qmp_query_migration_caps(Error **errp)
+{
+    MigrationCapList *caps_list = g_malloc0(sizeof(*caps_list));
+
+    caps_list->value = g_malloc(sizeof(*caps_list->value));
+    caps_list->value->name = g_strdup("uleb");
+    caps_list->next = NULL;
+
+    return caps_list;
+}
+
 /* shared migration helpers */
 
 static int migrate_fd_cleanup(MigrationState *s)
diff --git a/monitor.c b/monitor.c
index 8946a10..ff434e0 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2558,6 +2558,13 @@  static mon_cmd_t info_cmds[] = {
         .mhandler.info = hmp_info_migrate,
     },
     {
+        .name       = "migration_caps",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show migration capabilties",
+        .mhandler.info = hmp_info_migration_caps,
+    },
+    {
         .name       = "balloon",
         .args_type  = "",
         .params     = "",
diff --git a/qapi-schema.json b/qapi-schema.json
index 200e4fc..775fe56 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -276,6 +276,30 @@ 
 { 'command': 'query-migrate', 'returns': 'MigrationInfo' }
 
 ##
+# @MigrationCap
+#
+# Information about current migration capabilites.
+#
+# @xbzrle: true if the current migration supports xbzrle
+#
+# Since: 1.1
+##
+{ 'type': 'MigrationCap',
+  'data': { 'name': 'str'} }
+
+##
+# @query-migration-caps
+#
+# Returns information about current migration process capabilties.
+#
+# Returns: @MigrationCap
+#
+# Since: 1.1
+##
+{ 'command': 'query-migration-caps', 'returns': ['MigrationCap'] }
+
+
+##
 # @MouseInfo:
 #
 # Information about a mouse device.
diff --git a/qmp-commands.hx b/qmp-commands.hx
index f7a48de..b994951 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -2070,6 +2070,30 @@  EQMP
     },
 
 SQMP
+query-migration-caps
+-------
+
+Query migration capabilties
+
+- "xbzrle": xbzrle support
+
+Arguments:
+
+Example:
+
+-> { "execute": "query-migration-caps"}
+<- { "return": { "xbzrle" : true } }
+
+EQMP
+
+    {
+        .name       = "query_migration_caps",
+        .args_type  = "",
+	.mhandler.cmd_new = qmp_marshal_input_query_migration_caps,
+    },
+
+
+SQMP
 query-balloon
 -------------
 
diff --git a/savevm.c b/savevm.c
index fbf1903..3c0b7cc 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1573,7 +1573,7 @@  int qemu_savevm_state_begin(QEMUFile *f,
 	}
         se->set_params(params, se->opaque);
     }
-    
+
     qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
     qemu_put_be32(f, QEMU_VM_FILE_VERSION);