Received: from eggs.gnu.org ([2001:4830:134:3::10]:38005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW0OD-0005aH-FX for qemu-devel@nongnu.org; Thu, 12 Mar 2015 06:30:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YW0O9-0007Kl-F4 for qemu-devel@nongnu.org; Thu, 12 Mar 2015 06:30:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56160) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW0O9-0007Kc-3G for qemu-devel@nongnu.org; Thu, 12 Mar 2015 06:30:49 -0400 From: Markus Armbruster References: <1423623986-590-1-git-send-email-liang.z.li@intel.com> <1423623986-590-13-git-send-email-liang.z.li@intel.com> Date: Thu, 12 Mar 2015 11:30:45 +0100 In-Reply-To: <1423623986-590-13-git-send-email-liang.z.li@intel.com> (Liang Li's message of "Wed, 11 Feb 2015 11:06:26 +0800") Message-ID: <87385aqzhm.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [v5 12/12] migration: Add commands to set and query parameter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liang Li Cc: quintela@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, amit.shah@redhat.com, Yang Zhang , dgilbert@redhat.com Copying Eric for additional QAPI design expertise. I'm going to review just the QAPI schema changes. Liang Li writes: > Add the qmp and hmp commands to tune and query the parameters used in > live migration. > > Signed-off-by: Liang Li > Signed-off-by: Yang Zhang [...] > diff --git a/qapi-schema.json b/qapi-schema.json > index 0dfc4ce..5bf21fe 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -541,6 +541,92 @@ > ## > { 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabilityStatus']} > > +# @MigrationParameter > +# > +# Migration parameters enumeration > +# > +# @compress-level: Set the compression level to be used in live migration, > +# the compression level is an integer between 0 and 9, where 0 means > +# no compression, 1 means the best compression speed, and 9 means best > +# compression ratio which will consume more CPU. > +# > +# @compress-threads: Set compression thread count to be used in live migration, > +# the compression thread count is an integer between 1 and 255. > +# > +# @decompress-threads: Set decompression thread count to be used in live > +# migration, the decompression thread count is an integer between 1 > +# and 255. Usually, decompression is at least 4 times as fast as > +# compression, so set the decompress-threads to the number about 1/4 > +# of compress-threads is adequate. > +# > +# Since: 2.3 > +## > +{ 'enum': 'MigrationParameter', > + 'data': ['compress-level', 'compress-threads', 'decompress-threads'] } > +## > +# @MigrationParameterBase > +# > +# Migration parameter information > +# > +# @parameter: the parameter of migration > +# > +# Since: 2.3 > +## > +{ 'type': 'MigrationParameterBase', > + 'data': {'parameter': 'MigrationParameter'} } > +## > +# @MigrationParameterInt > +# > +# Migration parameter information > +# > +# @value: parameter int > +# > +# Since: 2.3 > +## > +{ 'type': 'MigrationParameterInt', > + 'data': {'value': 'int'} } > +## > +# @MigrationParameterStatus > +# > +# Migration parameter information > +# > +# @compress-level: compression level > +# > +# @compress-threads: compression thread count > +# > +# @decompress-threads: decompression thread count > +# > +# Since: 2.3 > +## > +{ 'union': 'MigrationParameterStatus', > + 'base': 'MigrationParameterBase', > + 'discriminator': 'parameter', > + 'data': { 'compress-level': 'MigrationParameterInt', > + 'compress-threads': 'MigrationParameterInt', > + 'decompress-threads': 'MigrationParameterInt'} } > +# > +# @migrate-set-parameters > +# > +# Set the following migration parameters (like compress-level) > +# > +# @parameters: json array of parameter modifications to make > +# > +# Since: 2.3 > +## > +{ 'command': 'migrate-set-parameters', > + 'data': { 'parameters': ['MigrationParameterStatus'] } } The command takes a list of key-value pairs. Looks like this (example stolen from your patch to qmp-commands.hx): { "execute": "migrate-set-parameters", "arguments": { "parameters": [ { "parameter": "compress-level", "value": 1 } ] } } Awkward. I'd very much prefer { "execute": "migrate-set-parameters", "arguments": { "compress-level", 1 } } I.e. the command simply takes the parameters as optional arguments. Simpler, and a natural use of the schema language. > +## > +# @query-migrate-parameters > +# > +# Returns information about the current migration parameters status > +# > +# Returns: @MigrationParametersStatus > +# > +# Since: 2.3 > +## > +{ 'command': 'query-migrate-parameters', > + 'returns': ['MigrationParameterStatus'] } > +## > ## > # @MouseInfo: > # Produces a list of key-value pairs. Looks like this (stolen from the same place): { "return": [ { "parameter": "compress-level", "value": 1 }, { "parameter": "compress-threads", "value": 8 }, { "parameter": "decompress-threads", "value": 2 } ] } I'd very much prefer a simple object instead: { "return": { "compress-level": 1, "compress-threads": 8, "decompress-threads": 2 } } [...]