[libvirt] [PATCH] [2/6] Add an error module and message for the hooks subsystem

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

 



Add an error module and message for the hooks subsystem

* include/libvirt/virterror.h: add VIR_FROM_HOOK and VIR_ERR_HOOK_SCRIPT_FAILED
* src/util/virterror.c: associated strings

diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index d298447..b35ea6c 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -69,7 +69,8 @@ typedef enum {
     VIR_FROM_PHYP,      /* Error from IBM power hypervisor */
     VIR_FROM_SECRET,    /* Error from secret storage */
     VIR_FROM_CPU,       /* Error from CPU driver */
-    VIR_FROM_XENAPI     /* Error from XenAPI */
+    VIR_FROM_XENAPI,    /* Error from XenAPI */
+    VIR_FROM_HOOK       /* Error from Synchronous hooks */
 } virErrorDomain;
 
 
@@ -176,6 +177,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;
 
 /**
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 0e8bdb3..50ced0f 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -178,6 +178,9 @@ static const char *virErrorDomainName(virErrorDomain domain) {
         case VIR_FROM_CPU:
             dom = "CPU ";
             break;
+        case VIR_FROM_HOOK:
+            dom = "Sync Hook ";
+            break;
     }
     return(dom);
 }
@@ -1117,6 +1120,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);

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]