From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQY8a-0005UT-4v for qemu-devel@nongnu.org; Wed, 25 Feb 2015 04:20:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQY8V-0002rD-Ql for qemu-devel@nongnu.org; Wed, 25 Feb 2015 04:20:12 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:25934) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQY8U-0002Vr-Qo for qemu-devel@nongnu.org; Wed, 25 Feb 2015 04:20:07 -0500 Message-ID: <54ED93AD.3000600@huawei.com> Date: Wed, 25 Feb 2015 17:19:41 +0800 From: zhanghailiang MIME-Version: 1.0 References: <1423711034-5340-1-git-send-email-zhang.zhanghailiang@huawei.com> <1423711034-5340-3-git-send-email-zhang.zhanghailiang@huawei.com> <54E267D0.1010203@redhat.com> In-Reply-To: <54E267D0.1010203@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC v3 02/27] migration: Introduce capability 'colo' to migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: hangaohuai@huawei.com, Lai Jiangshan , yunhong.jiang@intel.com, eddie.dong@intel.com, peter.huangpeng@huawei.com, dgilbert@redhat.com, Gonglei , stefanha@redhat.com, pbonzini@redhat.com, Yang Hongyang On 2015/2/17 5:57, Eric Blake wrote: > On 02/11/2015 08:16 PM, zhanghailiang wrote: >> This capability allows Primary VM (PVM) to be continuously checkpointed >> to secondary VM. >> >> Signed-off-by: zhanghailiang >> Signed-off-by: Yang Hongyang >> Signed-off-by: Gonglei >> Signed-off-by: Lai Jiangshan >> --- >> include/migration/migration.h | 1 + >> migration/migration.c | 15 +++++++++++++++ >> qapi-schema.json | 5 ++++- >> 3 files changed, 20 insertions(+), 1 deletion(-) >> > >> +++ b/migration/migration.c >> @@ -276,6 +276,15 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, >> } >> >> for (cap = params; cap; cap = cap->next) { >> +#ifndef CONFIG_COLO >> + if (cap->value->capability == MIGRATION_CAPABILITY_COLO && >> + cap->value->state) { >> + error_setg(errp, "COLO is not currently supported, please" >> + " configure with --enable-colo option in order to" >> + " support COLO feature"); >> + continue; >> + } >> +#endif >> s->enabled_capabilities[cap->value->capability] = cap->value->state; >> } > > Yuck. This means that probing whether colo is supported requires a > usage test (try setting the capability with migrate-set-capabilities and > see if it fails) instead of a query test (list the current capabilities; > if colo is in the set then it is supported). Can you figure out a way > to avoid exposing the colo capability if !CONFIG_COLO, so that > query-migate-capabilities is sufficient to learn if colo is supported? > What about using colo_supported() function to instead of compile macro ? Like what we have done in v2 version: in colo.c bool colo_supported(void) { return true; } in stubs/migration-colo.c bool colo_supported(void) { return false; } And then we call this function in qmp_migrate_set_capabilities @@ -292,15 +295,13 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, } for (cap = params; cap; cap = cap->next) { -#ifndef CONFIG_COLO if (cap->value->capability == MIGRATION_CAPABILITY_COLO && - cap->value->state) { + cap->value->state && !colo_supported()) { error_setg(errp, "COLO is not currently supported, please" " configure with --enable-colo option in order to" " support COLO feature"); continue; } -#endif s->enabled_capabilities[cap->value->capability] = cap->value->state; } } For qmp_query_migrate_capabilities we call it like: @@ -158,6 +158,9 @@ MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) caps = NULL; /* silence compiler warning */ for (i = 0; i < MIGRATION_CAPABILITY_MAX; i++) { + if (i == MIGRATION_CAPABILITY_COLO && !colo_supported()) { + continue; + } Thanks, zhanghailiang