]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add an error module and message for the hooks subsystem
authorDaniel Veillard <veillard@redhat.com>
Fri, 26 Mar 2010 10:53:19 +0000 (11:53 +0100)
committerDaniel Veillard <veillard@redhat.com>
Mon, 29 Mar 2010 16:21:04 +0000 (18:21 +0200)
* include/libvirt/virterror.h: add VIR_FROM_HOOK and VIR_ERR_HOOK_SCRIPT_FAILED
* src/util/virterror.c: associated strings

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

index 8cf30be373c7e60f9a40e8c7b154c86df5ed3267..28fafc291ffe6b06441fb6195ee4352f373654b3 100644 (file)
@@ -71,6 +71,7 @@ typedef enum {
     VIR_FROM_CPU,       /* Error from CPU driver */
     VIR_FROM_XENAPI,    /* Error from XenAPI */
     VIR_FROM_NWFILTER   /* Error from network filter driver */
+    VIR_FROM_HOOK       /* Error from Synchronous hooks */
 } virErrorDomain;
 
 
@@ -181,6 +182,7 @@ typedef enum {
     VIR_ERR_OPERATION_TIMEOUT, /* timeout occurred during operation */
     VIR_ERR_MIGRATE_PERSIST_FAILED, /* a migration worked, but making the
                                        VM persist on the dest host failed */
+    VIR_ERR_HOOK_SCRIPT_FAILED, /* a synchronous hook script failed */
 } virErrorNumber;
 
 /**
index d82c2c6dfe4886e77302addcf4817f914bc9a5a0..12dfeb7dc06a463df540a64d27322f3a52346e7f 100644 (file)
@@ -180,6 +180,8 @@ static const char *virErrorDomainName(virErrorDomain domain) {
             break;
         case VIR_FROM_NWFILTER:
             dom = "Network Filter";
+        case VIR_FROM_HOOK:
+            dom = "Sync Hook ";
             break;
     }
     return(dom);
@@ -1144,6 +1146,11 @@ virErrorMsg(virErrorNumber error, const char *info)
                 errmsg = _("Failed to make domain persistent after migration");
             else
                 errmsg = _("Failed to make domain persistent after migration: %s");
+        case VIR_ERR_HOOK_SCRIPT_FAILED:
+            if (info == NULL)
+                errmsg = _("Hook script execution failed");
+            else
+                errmsg = _("Hook script execution failed: %s");
             break;
     }
     return (errmsg);