qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH 3/3] monitor: Convert do_migrate() to QError
Date: Tue, 23 Mar 2010 19:07:21 +0100	[thread overview]
Message-ID: <1269367641-6241-4-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1269367641-6241-1-git-send-email-armbru@redhat.com>

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 <armbru@redhat.com>
---
 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;
     }
 
@@ -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;
     }
 
-- 
1.6.6.1

  parent reply	other threads:[~2010-03-23 18:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23 18:07 [Qemu-devel] [PATCH 0/3] Convert do_migrate() to QError Markus Armbruster
2010-03-23 18:07 ` [Qemu-devel] [PATCH 1/3] QError: New QERR_MIGRATION_IN_PROGRESS Markus Armbruster
2010-03-23 18:07 ` [Qemu-devel] [PATCH 2/3] QError: New QERR_MIGRATION_FAILED Markus Armbruster
2010-03-23 18:07 ` Markus Armbruster [this message]
2010-03-24 19:40   ` [Qemu-devel] Re: [PATCH 3/3] monitor: Convert do_migrate() to QError Luiz Capitulino
2010-03-25 17:37     ` Markus Armbruster
2010-03-25 17:49       ` Luiz Capitulino
2010-03-25 19:30         ` Markus Armbruster
2010-03-26 12:31           ` Luiz Capitulino
2010-03-29 12:38             ` Markus Armbruster
2010-03-29 13:31               ` Luiz Capitulino

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=1269367641-6241-4-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).