]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Introduce VIR_ERR_DEVICE_MISSING
authorChen Hanxiao <chenhanxiao@gmail.com>
Tue, 23 Jan 2018 04:24:43 +0000 (12:24 +0800)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 1 Feb 2018 12:17:01 +0000 (07:17 -0500)
Add new error code to be able to allow consumers (such as Nova) to be
able to key of a specific error code rather than needing to search the
error message."

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
include/libvirt/virterror.h
src/util/virerror.c

index 91ba2978433198aed3b755ccb2700a7d3b86a9e5..3e7c7a02c7c45e0b208f9645db9c01261eb11db8 100644 (file)
@@ -320,6 +320,7 @@ typedef enum {
     VIR_ERR_AGENT_UNSYNCED = 97,        /* guest agent replies with wrong id
                                            to guest-sync command (DEPRECATED)*/
     VIR_ERR_LIBSSH = 98,                /* error in libssh transport driver */
+    VIR_ERR_DEVICE_MISSING = 99,        /* fail to find the desired device */
 } virErrorNumber;
 
 /**
index 562c3bc61d94acad42e480fdc47e63d6f3e462be..c000b004368f9dc72b810ca7495b1d0c9596a887 100644 (file)
@@ -1453,6 +1453,12 @@ virErrorMsg(virErrorNumber error, const char *info)
             else
                 errmsg = _("libssh transport error: %s");
             break;
+        case VIR_ERR_DEVICE_MISSING:
+            if (info == NULL)
+                errmsg = _("device not found");
+            else
+                errmsg = _("device not found: %s");
+            break;
     }
     return errmsg;
 }