From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0ozH-0003Pg-EG for qemu-devel@nongnu.org; Fri, 05 Jun 2015 06:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0ozB-0000JY-VS for qemu-devel@nongnu.org; Fri, 05 Jun 2015 06:36:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0omK-0004QJ-AV for qemu-devel@nongnu.org; Fri, 05 Jun 2015 06:23:08 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 032DD2D1266 for ; Fri, 5 Jun 2015 10:23:08 +0000 (UTC) Date: Fri, 5 Jun 2015 11:23:04 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20150605102303.GC2139@work-vm> References: <20150605095004.GB2139@work-vm> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150605095004.GB2139@work-vm> Subject: Re: [Qemu-devel] Adding new migration-parameters - any easier way? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, armbru@redhat.com, quintela@redhat.com * Dr. David Alan Gilbert (dgilbert@redhat.com) wrote: > 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 oh, and don't forget to: 8) add the entries to qmp_query_migrate_parameters (I forgot). Dave > > > 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 -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK