From: Chen Hanxiao Date: Tue, 23 Jan 2018 04:24:43 +0000 (+0800) Subject: qemu: Introduce VIR_ERR_DEVICE_MISSING X-Git-Tag: v4.1.0-rc1~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb189c8e8c93f115c13fa3bfffdf64498f3f0ce1;p=thirdparty%2Flibvirt.git 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 --- 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; }