[libvirt] [PATCH v3 1/3] virerror: Introduce VIR_ERR_OPERATION_UNSAFE

Peter Krempa pkrempa at redhat.com
Fri Mar 24 13:05:40 UTC 2017


Similarly to VIR_ERR_MIGRATION_UNSAFE add a error code which will be
reported when an operation is possible with the hypervisor but may lead
to data loss or other problems in certain cases. This error code
notifies the user that the operation can be forced using a specific
flag.
---
 include/libvirt/virterror.h | 1 +
 src/util/virerror.c         | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index 2efee8f0c..04fea2e34 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -319,6 +319,7 @@ typedef enum {
     VIR_ERR_AGENT_UNSYNCED = 97,        /* guest agent replies with wrong id
                                            to guest-sync command */
     VIR_ERR_LIBSSH = 98,                /* error in libssh transport driver */
+    VIR_ERR_OPERATION_UNSAFE = 99,      /* unsafe operation requiring override */
 } virErrorNumber;

 /**
diff --git a/src/util/virerror.c b/src/util/virerror.c
index ef17fb5e6..1437cf02b 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -1407,6 +1407,11 @@ virErrorMsg(virErrorNumber error, const char *info)
             else
                 errmsg = _("libssh transport error: %s");
             break;
+        case VIR_ERR_OPERATION_UNSAFE:
+            if (info == NULL)
+                errmsg = _("operation unsafe");
+            else
+                errmsg = _("operation unsafe: %s");
     }
     return errmsg;
 }
-- 
2.12.1




More information about the libvir-list mailing list