From: Eric Blake <eblake@redhat.com>
To: Ashijeet Acharya <ashijeetacharya@gmail.com>, lcapitulino@redhat.com
Cc: quintela@redhat.com, amit.shah@redhat.com, armbru@redhat.com,
dgilbert@redhat.com, pbonzini@redhat.com, berrange@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4] Move max-bandwidth and downtime-limit into migrate_set_parameter for both hmp and qmp
Date: Thu, 8 Sep 2016 13:32:36 -0500 [thread overview]
Message-ID: <c4be1d28-94ec-d1ed-3be8-6da96f82ad05@redhat.com> (raw)
In-Reply-To: <1473350399-29210-1-git-send-email-ashijeetacharya@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4769 bytes --]
On 09/08/2016 10:59 AM, Ashijeet Acharya wrote:
Long subject line; we strive to stay below 70 bytes so that you can
prepend commit ids and still stay in an 80-column window. Also, you can
look at 'git shortlog -30' to get a feel for average length. Better
might be:
migrate: move max-bandwidth and downtime-limit to migrate_set_parameter
> Mark old-commands for speed and downtime as deprecated.
> Move max-bandwidth and downtime-limit into migrate-set-parameters for
> setting maximum migration speed and expected downtime limit parameters
> respectively.
> Change downtime units to milliseconds (only for new-command) and update
> the query part in both hmp and qmp qemu control interfaces.
>
> Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com>
> ---
> hmp.c | 26 ++++++++++
Between the --- and diffstat is a nice place to tell us how v4 differs
from v3, to focus the attention of reviewers that have already seen this
once.
> +++ b/hmp.c
> @@ -304,6 +304,12 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
> monitor_printf(mon, " %s: '%s'",
> MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME],
> params->tls_hostname ? : "");
> + monitor_printf(mon, " %s: %" PRId64,
> + MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH],
> + params->max_bandwidth);
Worth including a unit (bytes/second, right?) in the output here?
> + monitor_printf(mon, " %s: %" PRId64,
> + MigrationParameter_lookup[MIGRATION_PARAMETER_DOWNTIME_LIMIT],
> + params->downtime_limit);
and here (milliseconds, right)? Particularly since the two are on
different scales.
> monitor_printf(mon, "\n");
> }
>
> @@ -1193,6 +1199,7 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qdict)
> hmp_handle_error(mon, &err);
> }
>
> +/* Kept for old-commands compatibility */
> void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict)
s/old-commands/backwards/
> {
> double value = qdict_get_double(qdict, "value");
> @@ -1211,6 +1218,7 @@ void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict)
> }
> }
>
> +/* Kept for old-commands compatibility */
> void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict)
and again
> @@ -773,6 +779,10 @@ void qmp_migrate_set_parameters(bool has_compress_level,
> const char *tls_creds,
> bool has_tls_hostname,
> const char *tls_hostname,
> + bool has_max_bandwidth,
> + int64_t max_bandwidth,
> + bool has_downtime_limit,
> + int64_t downtime_limit,
> Error **errp)
> {
> + if (has_downtime_limit) {
> + downtime_limit *= 1000000; /* convert to nanoseconds */
> +
Still risks overflow on user-provided input. You should validate that
the user's input is reasonable, rather than accidentally setting a
too-small limit when the user meant for something so long as to appear
infinite.
> +void qmp_migrate_set_speed(int64_t valuebw, Error **errp)
> +{
> + bool has_compress_level = false;
> + bool has_compress_threads = false;
> + bool has_decompress_threads = false;
> + bool has_cpu_throttle_initial = false;
> + bool has_cpu_throttle_increment = false;
> + bool has_tls_creds = false;
> + bool has_tls_hostname = false;
> + bool has_max_bandwidth = true;
> + bool has_downtime_limit = false;
> + const char *valuestr = NULL;
> + long valueint = 0;
> + Error *err = NULL;
> +
> + qmp_migrate_set_parameters(has_compress_level, valueint,
> + has_compress_threads, valueint,
> + has_decompress_threads, valueint,
> + has_cpu_throttle_initial, valueint,
> + has_cpu_throttle_increment, valueint,
> + has_tls_creds, valuestr,
> + has_tls_hostname, valuestr,
> + has_max_bandwidth, valuebw,
> + has_downtime_limit, valueint,
> + &err);
> +
And you may want to wait for v5 until after I post my patch later today,
so you can see what I meant in the v4 discussion about using the qapi
features for shorter code.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-09-08 18:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 15:59 [Qemu-devel] [PATCH v4] Move max-bandwidth and downtime-limit into migrate_set_parameter for both hmp and qmp Ashijeet Acharya
2016-09-08 18:32 ` Eric Blake [this message]
2016-09-08 18:58 ` Ashijeet Acharya
2016-09-09 3:11 ` Eric Blake
2016-09-09 14:02 ` Ashijeet Acharya
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=c4be1d28-94ec-d1ed-3be8-6da96f82ad05@redhat.com \
--to=eblake@redhat.com \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=ashijeetacharya@gmail.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@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).