qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: hangaohuai@huawei.com, quintela@redhat.com, armbru@redhat.com,
	lcapitulino@redhat.com, amit.shah@redhat.com,
	peter.huangpeng@huawei.com, dgilbert@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] migration: Convert 'status' of MigrationInfo to use an enum type
Date: Sat, 28 Feb 2015 10:54:15 +0800	[thread overview]
Message-ID: <54F12DD7.6080208@huawei.com> (raw)
In-Reply-To: <54F09FFB.2070008@redhat.com>

On 2015/2/28 0:48, Eric Blake wrote:
> On 02/26/2015 11:19 PM, zhanghailiang wrote:
>> The original 'status' is an open-coded 'str' type, convert it to use an
>> enum type.
>> This conversion is backwards compatible, better documented and
>> more convenient for future extensibility.
>>
>> In addition, Fix a typo for qapi-schema.json: comppleted -> completed
>>
>> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> ---
>> v2:
>> - Remove '(since xyz)' strings. (Eric Blake)
>> ---
>>   hmp.c                 |  7 ++++---
>>   migration/migration.c | 37 +++++++++++++++----------------------
>>   qapi-schema.json      | 37 ++++++++++++++++++++++++++++++++-----
>>   3 files changed, 51 insertions(+), 30 deletions(-)
>
>>       case MIG_STATE_ACTIVE:
>>       case MIG_STATE_CANCELLING:
>>           info->has_status = true;
>> -        info->status = g_strdup("active");
>> +        /* Note: when the real state of migration is 'cancelling',
>> +         we still return 'active' status to user, it makes no difference
>> +         for user. */
>
> Rather than pollute the user-exposed enum with a state that we will
> never report, can we come up with some internal-only method for tracking
> cancelling separate from the enum?
>
>
>> +++ b/qapi-schema.json
>> @@ -411,18 +411,45 @@
>>              'overflow': 'int' } }
>>
>>   ##
>> +# @MigState:
>
> Do we have to abbreviate?  I guess leaving it like this makes the rest
> of the existing code base have less churn (since it matches the spelling
> of the enum that was previous interanl only), but it might look nicer as

Yes, this is the reason ..., agreed, i don't like the abbreviate,
But there is already a 'MigrationState' type defined:

typedef struct MigrationState MigrationState;

struct MigrationState
{
     int64_t bandwidth_limit;
     size_t bytes_xfer;
     size_t xfer_limit;
     QemuThread thread;
     QEMUBH *cleanup_bh;
     QEMUFile *file;

     ...

So, what about MigrationStatus ? ;)

> MigrationState.  If you do decide to go with a longer name, it might be
> nice to split this into a series, one patch that does only renames to
> migration.c (but no code additions outside of that file), and the other
> that moves the (now-correctly-named) enum into the public qapi file.
>
>> +#
>> +# An enumeration of migration status.
>> +#
>> +# @failed: some error occurred during migration process.
>> +#
>> +# @none: no migration has ever happened.
>> +#
>> +# @setup: migration process has been initiated.
>> +#
>> +# @cancelling: in the process of cancelling migration.
>> +#
>
> If the user can never see this state, I'd rather we think about a
> solution that avoids advertising the state in the public api...
>
>> +# @cancelled: cancelling migration is finished.
>> +#
>> +# @active: in the process of doing migration.
>> +#
>> +# @completed: migration is finished.
>> +#
>> +# Since: 2.3
>> +#
>> +# Notes: @cancelling is only used internally, and return @active to user
>> +#        instead of @cancelling, it make no difference for users.
>
> ...rather than needing this note to air our dirty laundry.
>

  parent reply	other threads:[~2015-02-28  2:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-27  6:19 [Qemu-devel] [PATCH v2] migration: Convert 'status' of MigrationInfo to use an enum type zhanghailiang
2015-02-27 16:48 ` Eric Blake
2015-02-27 17:07   ` Dr. David Alan Gilbert
2015-02-27 17:42     ` Eric Blake
2015-02-28  3:09       ` zhanghailiang
2015-03-02 15:57         ` Eric Blake
2015-02-28  2:54   ` zhanghailiang [this message]
2015-03-02 15:56     ` Eric Blake
2015-03-03  7:15       ` zhanghailiang
2015-03-03  8:59         ` Dr. David Alan Gilbert
2015-03-04 12:37           ` zhanghailiang
2015-03-04 12:50             ` Dr. David Alan Gilbert
2015-03-04 13:01               ` zhanghailiang
2015-03-03 17:21         ` Eric Blake
2015-03-04  7:48           ` Markus Armbruster
2015-03-04  8:55             ` zhanghailiang
2015-03-04  8:52           ` 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=54F12DD7.6080208@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=hangaohuai@huawei.com \
    --cc=lcapitulino@redhat.com \
    --cc=peter.huangpeng@huawei.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).