From bb189c8e8c93f115c13fa3bfffdf64498f3f0ce1 Mon Sep 17 00:00:00 2001 From: Chen Hanxiao Date: Tue, 23 Jan 2018 12:24:43 +0800 Subject: [PATCH] qemu: Introduce VIR_ERR_DEVICE_MISSING 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 Reviewed-by: John Ferlan --- 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 91ba297843..3e7c7a02c7 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -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; /** diff --git a/src/util/virerror.c b/src/util/virerror.c index 562c3bc61d..c000b00436 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -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; } -- 2.47.2