提交 bf735407 编写于 作者: D Daniel Veillard

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
上级 b3bff954
...@@ -71,6 +71,7 @@ typedef enum { ...@@ -71,6 +71,7 @@ typedef enum {
VIR_FROM_CPU, /* Error from CPU driver */ VIR_FROM_CPU, /* Error from CPU driver */
VIR_FROM_XENAPI, /* Error from XenAPI */ VIR_FROM_XENAPI, /* Error from XenAPI */
VIR_FROM_NWFILTER /* Error from network filter driver */ VIR_FROM_NWFILTER /* Error from network filter driver */
VIR_FROM_HOOK /* Error from Synchronous hooks */
} virErrorDomain; } virErrorDomain;
...@@ -181,6 +182,7 @@ typedef enum { ...@@ -181,6 +182,7 @@ typedef enum {
VIR_ERR_OPERATION_TIMEOUT, /* timeout occurred during operation */ VIR_ERR_OPERATION_TIMEOUT, /* timeout occurred during operation */
VIR_ERR_MIGRATE_PERSIST_FAILED, /* a migration worked, but making the VIR_ERR_MIGRATE_PERSIST_FAILED, /* a migration worked, but making the
VM persist on the dest host failed */ VM persist on the dest host failed */
VIR_ERR_HOOK_SCRIPT_FAILED, /* a synchronous hook script failed */
} virErrorNumber; } virErrorNumber;
/** /**
......
...@@ -180,6 +180,8 @@ static const char *virErrorDomainName(virErrorDomain domain) { ...@@ -180,6 +180,8 @@ static const char *virErrorDomainName(virErrorDomain domain) {
break; break;
case VIR_FROM_NWFILTER: case VIR_FROM_NWFILTER:
dom = "Network Filter"; dom = "Network Filter";
case VIR_FROM_HOOK:
dom = "Sync Hook ";
break; break;
} }
return(dom); return(dom);
...@@ -1144,6 +1146,11 @@ virErrorMsg(virErrorNumber error, const char *info) ...@@ -1144,6 +1146,11 @@ virErrorMsg(virErrorNumber error, const char *info)
errmsg = _("Failed to make domain persistent after migration"); errmsg = _("Failed to make domain persistent after migration");
else else
errmsg = _("Failed to make domain persistent after migration: %s"); 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; break;
} }
return (errmsg); return (errmsg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册