[libvirt] [PATCH 03/10] util: error: Add error message versions with info for some error codes

Peter Krempa pkrempa at redhat.com
Wed Dec 5 16:47:44 UTC 2018


Few error codes were missing the version of the message with additional
info. In case of the modified messages it's not very likely they'll ever
report any additional data, but for the sake of consistency we'll
provide them.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/virerror.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/util/virerror.c b/src/util/virerror.c
index 5d515bde57..64be00dc75 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -926,7 +926,10 @@ virErrorMsg(virErrorNumber error, const char *info)
               errmsg = _("internal error");
             break;
         case VIR_ERR_NO_MEMORY:
-            errmsg = _("out of memory");
+            if (info == NULL)
+                errmsg = _("out of memory");
+            else
+                errmsg = _("out of memory: %s");
             break;
         case VIR_ERR_NO_SUPPORT:
             if (info == NULL)
@@ -1019,7 +1022,10 @@ virErrorMsg(virErrorNumber error, const char *info)
                 errmsg = _("unknown OS type %s");
             break;
         case VIR_ERR_NO_KERNEL:
-            errmsg = _("missing kernel information");
+            if (info == NULL)
+                errmsg = _("missing kernel information");
+            else
+                errmsg = _("missing kernel information: %s");
             break;
         case VIR_ERR_NO_ROOT:
             if (info == NULL)
@@ -1472,7 +1478,10 @@ virErrorMsg(virErrorNumber error, const char *info)
                 errmsg = _("XML document failed to validate against schema: %s");
             break;
         case VIR_ERR_MIGRATE_FINISH_OK:
-            errmsg = _("migration successfully aborted");
+            if (info == NULL)
+                errmsg = _("migration successfully aborted");
+            else
+                errmsg = _("migration successfully aborted: %s");
             break;
         case VIR_ERR_NO_SERVER:
             if (info == NULL)
-- 
2.19.2




More information about the libvir-list mailing list