2009-11-19 04:05:30 +03:00
|
|
|
/*
|
2010-05-12 23:34:42 +04:00
|
|
|
* QError Module
|
2009-11-19 04:05:30 +03:00
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Red Hat Inc.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Luiz Capitulino <lcapitulino@redhat.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
|
|
|
* See the COPYING.LIB file in the top-level directory.
|
|
|
|
*/
|
|
|
|
#ifndef QERROR_H
|
|
|
|
#define QERROR_H
|
|
|
|
|
2012-12-17 21:19:43 +04:00
|
|
|
#include "qapi/qmp/qstring.h"
|
2012-12-17 21:20:00 +04:00
|
|
|
#include "qemu/error-report.h"
|
2012-12-17 21:19:43 +04:00
|
|
|
#include "qapi/error.h"
|
2012-07-27 21:09:29 +04:00
|
|
|
#include "qapi-types.h"
|
2009-11-19 04:05:30 +03:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
typedef struct QError {
|
|
|
|
QObject_HEAD;
|
2010-02-18 21:46:49 +03:00
|
|
|
Location loc;
|
2012-07-20 19:02:58 +04:00
|
|
|
char *err_msg;
|
2012-07-27 21:09:29 +04:00
|
|
|
ErrorClass err_class;
|
2009-11-19 04:05:30 +03:00
|
|
|
} QError;
|
|
|
|
|
2009-12-07 23:37:16 +03:00
|
|
|
QString *qerror_human(const QError *qerror);
|
2012-07-27 21:09:29 +04:00
|
|
|
void qerror_report(ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
|
2011-09-02 21:34:45 +04:00
|
|
|
void qerror_report_err(Error *err);
|
2009-11-19 04:05:30 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* QError class list
|
2010-03-25 19:22:30 +03:00
|
|
|
* Please keep the definitions in alphabetical order.
|
2012-01-05 02:23:32 +04:00
|
|
|
* Use scripts/check-qerror.sh to check.
|
2009-11-19 04:05:30 +03:00
|
|
|
*/
|
2012-01-18 18:40:52 +04:00
|
|
|
#define QERR_BASE_NOT_FOUND \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Base '%s' not found"
|
2012-01-18 18:40:52 +04:00
|
|
|
|
2012-09-28 19:22:44 +04:00
|
|
|
#define QERR_BLOCK_JOB_NOT_ACTIVE \
|
|
|
|
ERROR_CLASS_DEVICE_NOT_ACTIVE, "No active block job on device '%s'"
|
|
|
|
|
2012-10-18 18:49:21 +04:00
|
|
|
#define QERR_BLOCK_JOB_NOT_READY \
|
|
|
|
ERROR_CLASS_GENERIC_ERROR, "The active block job for device '%s' cannot be completed"
|
|
|
|
|
2011-11-15 01:09:47 +04:00
|
|
|
#define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by device '%s' does not support feature '%s'"
|
2011-11-15 01:09:47 +04:00
|
|
|
|
2010-02-19 21:53:36 +03:00
|
|
|
#define QERR_BUS_NO_HOTPLUG \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Bus '%s' does not support hotplugging"
|
2010-02-19 21:53:36 +03:00
|
|
|
|
2012-01-04 21:38:22 +04:00
|
|
|
#define QERR_BUS_NOT_FOUND \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not found"
|
2009-11-27 03:58:57 +03:00
|
|
|
|
2012-01-04 21:38:22 +04:00
|
|
|
#define QERR_COMMAND_NOT_FOUND \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_COMMAND_NOT_FOUND, "The command %s has not been found"
|
2012-01-04 21:38:22 +04:00
|
|
|
|
2009-12-07 23:36:59 +03:00
|
|
|
#define QERR_DEVICE_ENCRYPTED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_DEVICE_ENCRYPTED, "'%s' (%s) is encrypted"
|
2009-11-19 04:05:30 +03:00
|
|
|
|
2012-01-05 02:23:34 +04:00
|
|
|
#define QERR_DEVICE_HAS_NO_MEDIUM \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium"
|
2012-01-05 02:23:34 +04:00
|
|
|
|
2010-02-19 21:53:54 +03:00
|
|
|
#define QERR_DEVICE_INIT_FAILED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Device '%s' could not be initialized"
|
2010-02-19 21:53:54 +03:00
|
|
|
|
2010-03-25 19:22:39 +03:00
|
|
|
#define QERR_DEVICE_IN_USE \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Device '%s' is in use"
|
2010-03-25 19:22:39 +03:00
|
|
|
|
2012-01-05 02:23:34 +04:00
|
|
|
#define QERR_DEVICE_IS_READ_ONLY \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Device '%s' is read only"
|
2012-01-05 02:23:34 +04:00
|
|
|
|
2012-01-04 21:38:22 +04:00
|
|
|
#define QERR_DEVICE_NO_HOTPLUG \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging"
|
2012-01-04 21:38:22 +04:00
|
|
|
|
2009-11-19 04:05:34 +03:00
|
|
|
#define QERR_DEVICE_NOT_ACTIVE \
|
2014-02-25 11:10:05 +04:00
|
|
|
ERROR_CLASS_DEVICE_NOT_ACTIVE, "No %s device has been activated"
|
2009-12-07 23:37:02 +03:00
|
|
|
|
2010-03-25 19:22:30 +03:00
|
|
|
#define QERR_DEVICE_NOT_ENCRYPTED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not encrypted"
|
2010-03-25 19:22:30 +03:00
|
|
|
|
2009-12-07 23:37:02 +03:00
|
|
|
#define QERR_DEVICE_NOT_FOUND \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found"
|
2009-11-19 04:05:34 +03:00
|
|
|
|
2009-12-07 23:37:10 +03:00
|
|
|
#define QERR_FD_NOT_FOUND \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found"
|
2009-12-07 23:37:10 +03:00
|
|
|
|
2009-12-07 23:37:12 +03:00
|
|
|
#define QERR_FD_NOT_SUPPLIED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "No file descriptor supplied via SCM_RIGHTS"
|
2009-12-07 23:37:12 +03:00
|
|
|
|
2012-01-04 21:38:22 +04:00
|
|
|
#define QERR_FEATURE_DISABLED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "The feature '%s' is not enabled"
|
2012-01-04 21:38:22 +04:00
|
|
|
|
2009-12-07 23:37:06 +03:00
|
|
|
#define QERR_INVALID_BLOCK_FORMAT \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Invalid block format '%s'"
|
2009-12-07 23:37:06 +03:00
|
|
|
|
2009-12-07 23:37:13 +03:00
|
|
|
#define QERR_INVALID_PARAMETER \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Invalid parameter '%s'"
|
2009-12-07 23:37:13 +03:00
|
|
|
|
2009-11-27 03:58:57 +03:00
|
|
|
#define QERR_INVALID_PARAMETER_TYPE \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Invalid parameter type for '%s', expected: %s"
|
2009-11-27 03:58:57 +03:00
|
|
|
|
2010-03-25 19:22:33 +03:00
|
|
|
#define QERR_INVALID_PARAMETER_VALUE \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' expects %s"
|
2010-03-25 19:22:33 +03:00
|
|
|
|
2009-12-04 20:24:08 +03:00
|
|
|
#define QERR_INVALID_PASSWORD \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Password incorrect"
|
2009-12-07 23:37:02 +03:00
|
|
|
|
2011-11-22 22:29:52 +04:00
|
|
|
#define QERR_IO_ERROR \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "An IO error has occurred"
|
2011-11-22 22:29:52 +04:00
|
|
|
|
2012-01-04 21:38:22 +04:00
|
|
|
#define QERR_JSON_PARSING \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax"
|
2011-07-19 23:50:33 +04:00
|
|
|
|
2009-11-19 04:05:35 +03:00
|
|
|
#define QERR_KVM_MISSING_CAP \
|
2014-03-05 06:44:40 +04:00
|
|
|
ERROR_CLASS_KVM_MISSING_CAP, "Using KVM without %s, %s unavailable"
|
2009-11-19 04:05:35 +03:00
|
|
|
|
2011-12-02 20:58:12 +04:00
|
|
|
#define QERR_MIGRATION_ACTIVE \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress"
|
2011-12-02 20:58:12 +04:00
|
|
|
|
2009-11-27 03:58:57 +03:00
|
|
|
#define QERR_MISSING_PARAMETER \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing"
|
2009-11-27 03:58:57 +03:00
|
|
|
|
2011-12-13 00:29:26 +04:00
|
|
|
#define QERR_PERMISSION_DENIED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Insufficient permission to perform this operation"
|
2011-12-13 00:29:26 +04:00
|
|
|
|
2010-02-19 15:17:58 +03:00
|
|
|
#define QERR_PROPERTY_VALUE_BAD \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' doesn't take value '%s'"
|
2010-02-19 15:17:58 +03:00
|
|
|
|
2011-12-18 20:05:08 +04:00
|
|
|
#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
|
2011-12-18 20:05:08 +04:00
|
|
|
|
2012-01-04 21:38:22 +04:00
|
|
|
#define QERR_QGA_COMMAND_FAILED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Guest agent command failed, error was '%s'"
|
2012-01-04 21:38:22 +04:00
|
|
|
|
2009-11-27 03:58:57 +03:00
|
|
|
#define QERR_QMP_BAD_INPUT_OBJECT \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Expected '%s' in QMP input"
|
2009-11-27 03:58:57 +03:00
|
|
|
|
2010-04-07 21:46:33 +04:00
|
|
|
#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' expects '%s'"
|
2010-04-07 21:46:33 +04:00
|
|
|
|
2010-06-01 23:15:23 +04:00
|
|
|
#define QERR_QMP_EXTRA_MEMBER \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' is unexpected"
|
2010-06-01 23:15:23 +04:00
|
|
|
|
2009-12-07 23:37:07 +03:00
|
|
|
#define QERR_SET_PASSWD_FAILED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Could not set password"
|
2009-12-07 23:37:07 +03:00
|
|
|
|
2010-02-19 19:42:46 +03:00
|
|
|
#define QERR_UNDEFINED_ERROR \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "An undefined error has occurred"
|
2010-02-19 19:42:46 +03:00
|
|
|
|
2011-02-09 13:09:38 +03:00
|
|
|
#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "'%s' uses a %s feature which is not supported by this qemu version: %s"
|
2011-02-09 13:09:38 +03:00
|
|
|
|
2012-01-04 21:38:22 +04:00
|
|
|
#define QERR_UNSUPPORTED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
|
2012-01-04 21:38:22 +04:00
|
|
|
|
2012-05-10 20:28:08 +04:00
|
|
|
#define QERR_SOCKET_CONNECT_FAILED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket"
|
2012-05-10 20:28:08 +04:00
|
|
|
|
|
|
|
#define QERR_SOCKET_LISTEN_FAILED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode"
|
2012-05-10 20:28:08 +04:00
|
|
|
|
|
|
|
#define QERR_SOCKET_BIND_FAILED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket"
|
2012-05-10 20:28:08 +04:00
|
|
|
|
|
|
|
#define QERR_SOCKET_CREATE_FAILED \
|
2012-07-28 00:51:03 +04:00
|
|
|
ERROR_CLASS_GENERIC_ERROR, "Failed to create socket"
|
2012-05-10 20:28:08 +04:00
|
|
|
|
2009-11-19 04:05:30 +03:00
|
|
|
#endif /* QERROR_H */
|