[Qemu-devel] [PATCH v2 03/11] migration: export capabilities to props

Peter Xu posted 11 patches 8 years, 6 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v2 03/11] migration: export capabilities to props
Posted by Peter Xu 8 years, 6 months ago
Do the same thing to migration capabilities, just like what we did in
previous patch for migration parameters.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/migration.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index ad2505c..3208162 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2001,6 +2001,9 @@ void migration_global_dump(Monitor *mon)
                    ms->send_configuration, ms->send_section_footer);
 }
 
+#define DEFINE_PROP_MIG_CAP(name, x)             \
+    DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false)
+
 static Property migration_properties[] = {
     DEFINE_PROP_BOOL("store-global-state", MigrationState,
                      store_global_state, true),
@@ -2034,6 +2037,20 @@ static Property migration_properties[] = {
     DEFINE_PROP_INT64("x-checkpoint-delay", MigrationState,
                       parameters.x_checkpoint_delay,
                       DEFAULT_MIGRATE_X_CHECKPOINT_DELAY),
+
+    /* Migration capabilities */
+    DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
+    DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL),
+    DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVERGE),
+    DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS),
+    DEFINE_PROP_MIG_CAP("x-compress", MIGRATION_CAPABILITY_COMPRESS),
+    DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS),
+    DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RAM),
+    DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO),
+    DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM),
+    DEFINE_PROP_MIG_CAP("x-block", MIGRATION_CAPABILITY_BLOCK),
+    DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH),
+
     DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
2.7.4


Re: [Qemu-devel] [PATCH v2 03/11] migration: export capabilities to props
Posted by Juan Quintela 8 years, 6 months ago
Peter Xu <peterx@redhat.com> wrote:
> Do the same thing to migration capabilities, just like what we did in
> previous patch for migration parameters.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>


A pitty that the preprocessor is not able to pass to uppercase ...

> +#define DEFINE_PROP_MIG_CAP(name, x)             \
> +    DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false)

#define DEFINE_PROP_MIG_CAP(name)             \
    DEFINE_PROP_BOOL(#name, MigrationState,
    enabled_capabilities[MIGRATION_CAPABILITY_##name], false)

Re: [Qemu-devel] [PATCH v2 03/11] migration: export capabilities to props
Posted by Peter Xu 8 years, 6 months ago
On Mon, Jul 17, 2017 at 06:58:44PM +0200, Juan Quintela wrote:
> Peter Xu <peterx@redhat.com> wrote:
> > Do the same thing to migration capabilities, just like what we did in
> > previous patch for migration parameters.
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> 
> Reviewed-by: Juan Quintela <quintela@redhat.com>

Thanks!

> 
> 
> A pitty that the preprocessor is not able to pass to uppercase ...
> 
> > +#define DEFINE_PROP_MIG_CAP(name, x)             \
> > +    DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false)
> 
> #define DEFINE_PROP_MIG_CAP(name)             \
>     DEFINE_PROP_BOOL(#name, MigrationState,
>     enabled_capabilities[MIGRATION_CAPABILITY_##name], false)

Yes a pity, this is more beautiful (though this may let the grepping
of specific MIGRATION_CAPABILITY_* slightly harder since it breaks the
macro).

-- 
Peter Xu

Re: [Qemu-devel] [PATCH v2 03/11] migration: export capabilities to props
Posted by Eduardo Habkost 8 years, 6 months ago
On Mon, Jul 17, 2017 at 04:26:03PM +0800, Peter Xu wrote:
> Do the same thing to migration capabilities, just like what we did in
> previous patch for migration parameters.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  migration/migration.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index ad2505c..3208162 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2001,6 +2001,9 @@ void migration_global_dump(Monitor *mon)
>                     ms->send_configuration, ms->send_section_footer);
>  }
>  
> +#define DEFINE_PROP_MIG_CAP(name, x)             \
> +    DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false)
> +

Maybe for the future: have you considered replacing the
enabled_capabilities array with a uint32_t and using
DEFINE_PROP_BIT?

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>


>  static Property migration_properties[] = {
>      DEFINE_PROP_BOOL("store-global-state", MigrationState,
>                       store_global_state, true),
> @@ -2034,6 +2037,20 @@ static Property migration_properties[] = {
>      DEFINE_PROP_INT64("x-checkpoint-delay", MigrationState,
>                        parameters.x_checkpoint_delay,
>                        DEFAULT_MIGRATE_X_CHECKPOINT_DELAY),
> +
> +    /* Migration capabilities */
> +    DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
> +    DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL),
> +    DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVERGE),
> +    DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS),
> +    DEFINE_PROP_MIG_CAP("x-compress", MIGRATION_CAPABILITY_COMPRESS),
> +    DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS),
> +    DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RAM),
> +    DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO),
> +    DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM),
> +    DEFINE_PROP_MIG_CAP("x-block", MIGRATION_CAPABILITY_BLOCK),
> +    DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH),
> +
>      DEFINE_PROP_END_OF_LIST(),
>  };
>  
> -- 
> 2.7.4
> 

-- 
Eduardo

Re: [Qemu-devel] [PATCH v2 03/11] migration: export capabilities to props
Posted by Peter Xu 8 years, 6 months ago
On Mon, Jul 17, 2017 at 02:52:31PM -0300, Eduardo Habkost wrote:
> On Mon, Jul 17, 2017 at 04:26:03PM +0800, Peter Xu wrote:
> > Do the same thing to migration capabilities, just like what we did in
> > previous patch for migration parameters.
> > 
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> >  migration/migration.c | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> > 
> > diff --git a/migration/migration.c b/migration/migration.c
> > index ad2505c..3208162 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -2001,6 +2001,9 @@ void migration_global_dump(Monitor *mon)
> >                     ms->send_configuration, ms->send_section_footer);
> >  }
> >  
> > +#define DEFINE_PROP_MIG_CAP(name, x)             \
> > +    DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false)
> > +
> 
> Maybe for the future: have you considered replacing the
> enabled_capabilities array with a uint32_t and using
> DEFINE_PROP_BIT?

Yes, this sounds reasonable.  Noted.

> 
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

Thanks!

-- 
Peter Xu