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 <chenhanxiao@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Chen Hanxiao 2018-01-23 12:24:43 +08:00 committed by John Ferlan
parent f0f2a5ec21
commit bb189c8e8c
2 changed files with 7 additions and 0 deletions

View 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;
/**

View 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;
}