qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, eblake@redhat.com, armbru@redhat.com
Cc: amit.shah@redhat.com, quintela@redhat.com
Subject: [Qemu-devel] Adding new migration-parameters - any easier way?
Date: Fri, 5 Jun 2015 10:50:05 +0100	[thread overview]
Message-ID: <20150605095004.GB2139@work-vm> (raw)

Hi,
  Is there any way that we could make it easier to add new migration
parameters? The current way is complicated and error prone;
as far as I can tell, to add a new parameter we need to:

  1) qapi-schema.json
    a) Add to 'MigrationParameter' enum, include comment
    b) Add to migrate-set-parameters
    c) Add to MigrationParameters
  2) Define the 'default' macro at the top of migration.c
  3) Add the initialisation to migrate_get_current to set the default
  4) qmp_migrate_set_parameters:
    a) Add the 'has' and value arguments to qmp_migrate_set_parameters
       *** Make really sure this matches the order in migrate-set-parameters!
    b) Add a bounds check on the value
    c) Set the value in the array if the has_ is true
  5) Fixup migrate_init to preserve the parameter around the init
  6) Add a bool and case entry to hmp_migrate_set_parameter and
    pass to qmp_migrate_set_parameters
       *** Make sure you get the order to qmp_migrate_set_parameters right
  7) Fixup hmp_info_migrate_parameters


The three separate changes needed in the qapi-schema.json seem odd,
and the 'has'/value pairs on qmp_migrate_set_parameters is just a nightmare
because there's nothing to check the ordering, and it's just getting
a silly number of arguments to the function now (I've got 10
parameters in one of my dev worlds, so that function has 21 arguments).

In my ideal world there would be:
   a) One thing to add to qapi-schema.json
   b) qmp_migrate_set_parameters would take an array pointer indexed
      by the enum
   c) A way to define the bounds so that we didn't have to manually
      add the bound checking.
   d) Something where I defined the default value

(I'm fairly sure earlier versions of migrate parameters patches
managed (a) and possibly (b)).

Dave
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

             reply	other threads:[~2015-06-05  9:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05  9:50 Dr. David Alan Gilbert [this message]
2015-06-05 10:23 ` [Qemu-devel] Adding new migration-parameters - any easier way? Dr. David Alan Gilbert
2015-06-05 12:30 ` Eric Blake
2015-06-05 14:00   ` Dr. David Alan Gilbert
2015-06-08 12:48     ` Markus Armbruster
2015-06-08 14:57       ` Dr. David Alan Gilbert
2015-06-09  6:36         ` Markus Armbruster
2015-06-09  8:42         ` [Qemu-devel] qapi: What does "'gen': false" actually do, and when should I use it? (was: Adding new migration-parameters - any easier way?) Markus Armbruster
2015-06-19 10:40           ` [Qemu-devel] qapi: What does "'gen': false" actually do, and when should I use it? Paolo Bonzini
2015-07-02 12:07             ` Markus Armbruster
2015-07-02 12:32           ` Markus Armbruster
2015-06-17 10:46 ` [Qemu-devel] Adding new migration-parameters - any easier way? zhanghailiang
2015-06-19  8:11   ` Markus Armbruster
2015-06-23  1:43     ` zhanghailiang
2015-06-23  7:50       ` Markus Armbruster
2015-06-23  8:03         ` zhanghailiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150605095004.GB2139@work-vm \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).