]> xenbits.xensource.com Git - libvirt.git/commitdiff
migration: Add more specific error code/message on migration abort
authorPeter Krempa <pkrempa@redhat.com>
Fri, 16 Dec 2011 13:58:38 +0000 (14:58 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 16 Dec 2011 15:38:26 +0000 (16:38 +0100)
A generic error code was returned, if the user aborted a migration job.
This made it hard to distinguish between a user requested abort and an
error that might have occured. This patch introduces a new error code,
which is returned in the specific case of a user abort, while leaving
all other failures with their existing code. This makes it easier to
distinguish between failure while mirgrating and an user requested
abort.

 * include/libvirt/virterror.h: - add new error code
 * src/util/virterror.c: - add message for the new error code
 * src/qemu/qemu_migration.h: - Emit operation aborted error instead of
                                operation failed, on migration abort

include/libvirt/virterror.h
src/qemu/qemu_migration.c
src/util/virterror.c

index 7063ef6a8ed0c0faf43c6b2cf2456dc1b74a1f3e..e896d67ce2c633d2b2e5460bae43958cbf048afb 100644 (file)
@@ -241,6 +241,8 @@ typedef enum {
     VIR_ERR_STORAGE_POOL_BUILT = 76,   /* storage pool already built */
     VIR_ERR_SNAPSHOT_REVERT_RISKY = 77,        /* force was not requested for a
                                            risky domain snapshot revert */
+    VIR_ERR_OPERATION_ABORTED = 78,     /* operation on a domain was
+                                           canceled/aborted by user */
 } virErrorNumber;
 
 /**
index 8c4ecc804482d68c178e979b9892bd7e3941feee..7e4135b1e4c6ea41043734deaa22007556965237 100644 (file)
@@ -905,7 +905,7 @@ qemuMigrationUpdateJobStatus(struct qemud_driver *driver,
 
     case QEMU_MONITOR_MIGRATION_STATUS_CANCELLED:
         priv->job.info.type = VIR_DOMAIN_JOB_CANCELLED;
-        qemuReportError(VIR_ERR_OPERATION_FAILED,
+        qemuReportError(VIR_ERR_OPERATION_ABORTED,
                         _("%s: %s"), job, _("canceled by client"));
         break;
     }
index 44a276a9db5c9829ae9b16e9a0ffc17f4f0fe246..380dc56bed95d47a5495c480b263db44cc2d25d1 100644 (file)
@@ -1213,6 +1213,12 @@ virErrorMsg(virErrorNumber error, const char *info)
             else
                 errmsg = _("revert requires force: %s");
             break;
+        case VIR_ERR_OPERATION_ABORTED:
+            if (info == NULL)
+                errmsg = _("operation aborted");
+            else
+                errmsg = _("operation aborted: %s");
+            break;
     }
     return (errmsg);
 }