[libvirt] [PATCH 05/21] virerror: Introduce new error type NO_SERVER

Martin Kletzander mkletzan at redhat.com
Thu Mar 10 04:53:54 UTC 2016


This serves the same purpose as VIR_ERR_NO_xxx where xxx is any object
that API can be called upon.  Only this partucular one is used for
daemon's servers.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 include/libvirt/virterror.h | 1 +
 src/util/virerror.c         | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index 83f76d84cbbc..1f0702b5890a 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -311,6 +311,7 @@ typedef enum {
     VIR_ERR_XML_INVALID_SCHEMA = 92,    /* XML document doesn't validate against schema */
     VIR_ERR_MIGRATE_FINISH_OK = 93,     /* Finish API succeeded but it is expected to return NULL */
     VIR_ERR_AUTH_UNAVAILABLE = 94,	/* authentication unavailable */
+    VIR_ERR_NO_SERVER = 95,             /* Server was not found */
 } virErrorNumber;

 /**
diff --git a/src/util/virerror.c b/src/util/virerror.c
index 377c2b11a2c2..61b9ea016032 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -1380,6 +1380,12 @@ virErrorMsg(virErrorNumber error, const char *info)
         case VIR_ERR_MIGRATE_FINISH_OK:
             errmsg = _("migration successfully aborted");
             break;
+        case VIR_ERR_NO_SERVER:
+            if (info == NULL)
+                errmsg = _("Server not found");
+            else
+                errmsg = _("Server not found: %s");
+            break;
     }
     return errmsg;
 }
-- 
2.7.2




More information about the libvir-list mailing list