[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Better error reporting for failed migration.



The comment in the code says most of it, but when the destination
hostname resolution is screwed up, print a proper error instead
of the very unhelpful "unknown error".

Note that I'm not overly fond of the wording in the error message,
so I'm open to suggestions.

Signed-off-by: Chris Lalancette <clalance redhat com>
---
 src/qemu/qemu_driver.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d37b184..02bb5cb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6288,6 +6288,22 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
             goto cleanup;
         }
 
+        /* Remember that we are running on the destination.  The hostname that
+         * we resolve here will be used on the source machine in the "migrate"
+         * monitor command.  Because of that, localhost is almost always the
+         * wrong thing.  Adding this check explicitly breaks localhost
+         * migration, but only for those machines that have improperly
+         * configured hostname resolution.
+         */
+        if (STREQ(hostname, "localhost")) {
+            VIR_FREE(hostname);
+            qemudReportError(dconn, NULL, NULL, VIR_ERR_INVALID_ARG, "%s",
+                             _("Could not resolve destination hostname; "
+                               "either fix destination to resolve hostname, "
+                               "or use the optional URI migration parameter"));
+            goto cleanup;
+        }
+
         /* XXX this really should have been a properly well-formed
          * URI, but we can't add in tcp:// now without breaking
          * compatability with old targets. We at least make the
-- 
1.6.0.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]