From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nuqzy-0003XJ-9e for qemu-devel@nongnu.org; Thu, 25 Mar 2010 13:37:38 -0400 Received: from [140.186.70.92] (port=48968 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nuqzs-0003Sx-Cw for qemu-devel@nongnu.org; Thu, 25 Mar 2010 13:37:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nuqzp-0003sO-LZ for qemu-devel@nongnu.org; Thu, 25 Mar 2010 13:37:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1026) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nuqzp-0003sI-C2 for qemu-devel@nongnu.org; Thu, 25 Mar 2010 13:37:29 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2PHbSxq014130 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Mar 2010 13:37:28 -0400 From: Markus Armbruster References: <1269367641-6241-1-git-send-email-armbru@redhat.com> <1269367641-6241-4-git-send-email-armbru@redhat.com> <20100324164018.713345f6@redhat.com> Date: Thu, 25 Mar 2010 18:37:25 +0100 In-Reply-To: <20100324164018.713345f6@redhat.com> (Luiz Capitulino's message of "Wed, 24 Mar 2010 16:40:18 -0300") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH 3/3] monitor: Convert do_migrate() to QError List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel@nongnu.org Luiz Capitulino writes: > On Tue, 23 Mar 2010 19:07:21 +0100 > Markus Armbruster wrote: > >> Human monitor error message changes from "unknown migration protocol: >> FOO" to "Invalid parameter uri". >> >> The conversion is shallow: the FOO_start_outgoing_migration() aren't >> converted. Converting them is a big job for relatively little >> practical benefit, so leave it for later. >> >> Signed-off-by: Markus Armbruster >> --- >> migration.c | 9 +++++---- >> 1 files changed, 5 insertions(+), 4 deletions(-) >> >> diff --git a/migration.c b/migration.c >> index 05f6cc5..47d2ab5 100644 >> --- a/migration.c >> +++ b/migration.c >> @@ -56,14 +56,14 @@ void qemu_start_incoming_migration(const char *uri) >> >> int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) >> { >> - MigrationState *s = NULL; >> + MigrationState *s; >> const char *p; >> int detach = qdict_get_int(qdict, "detach"); >> const char *uri = qdict_get_str(qdict, "uri"); >> >> if (current_migration && >> current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { >> - monitor_printf(mon, "migration already in progress\n"); >> + qerror_report(QERR_MIGRATION_IN_PROGRESS); >> return -1; >> } > > What about QERR_OPERATION_IN_PROGRESS? So that we have: > > "Operation already in progress: migration". We'd get an error argument "activity": "migration". Fine with me. >> @@ -86,12 +86,13 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) >> (int)qdict_get_int(qdict, "inc")); >> #endif >> } else { >> - monitor_printf(mon, "unknown migration protocol: %s\n", uri); >> + qerror_report(QERR_INVALID_PARAMETER, "uri"); >> return -1; >> } >> >> if (s == NULL) { >> - monitor_printf(mon, "migration failed\n"); >> + /* TODO push error reporting into the FOO_start_outgoing_migration() */ >> + qerror_report(QERR_MIGRATION_FAILED); >> return -1; >> } > > I think this one is no better than the automatic UndefinedError > which is going to be triggered. I would only touch this when/if > we get the migration functions converted. I feel it is a bit better, because: * It doesn't dilute the nice "this is a bug, and I should report it" property of UndefinedError. * It avoids the "returned failure but did not pass an error" message. Minor, because it's under CONFIG_DEBUG_MONITOR. But I'm not particular about it.