]> git.proxmox.com Git - qemu.git/blob - qerror.h
qerror: drop qerror_table and qerror_format()
[qemu.git] / qerror.h
1 /*
2 * QError Module
3 *
4 * Copyright (C) 2009 Red Hat Inc.
5 *
6 * Authors:
7 * Luiz Capitulino <lcapitulino@redhat.com>
8 *
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
11 */
12 #ifndef QERROR_H
13 #define QERROR_H
14
15 #include "qdict.h"
16 #include "qstring.h"
17 #include "qemu-error.h"
18 #include "error.h"
19 #include "qapi-types.h"
20 #include <stdarg.h>
21
22 typedef struct QError {
23 QObject_HEAD;
24 QDict *error;
25 Location loc;
26 char *err_msg;
27 ErrorClass err_class;
28 } QError;
29
30 QString *qerror_human(const QError *qerror);
31 void qerror_report(ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
32 void qerror_report_err(Error *err);
33 void assert_no_error(Error *err);
34
35 /*
36 * QError class list
37 * Please keep the definitions in alphabetical order.
38 * Use scripts/check-qerror.sh to check.
39 */
40 #define QERR_ADD_CLIENT_FAILED \
41 ERROR_CLASS_GENERIC_ERROR, "Could not add client"
42
43 #define QERR_AMBIGUOUS_PATH \
44 ERROR_CLASS_GENERIC_ERROR, "Path '%s' does not uniquely identify an object"
45
46 #define QERR_BAD_BUS_FOR_DEVICE \
47 ERROR_CLASS_GENERIC_ERROR, "Device '%s' can't go on a %s bus"
48
49 #define QERR_BASE_NOT_FOUND \
50 ERROR_CLASS_GENERIC_ERROR, "Base '%s' not found"
51
52 #define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
53 ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by device '%s' does not support feature '%s'"
54
55 #define QERR_BUFFER_OVERRUN \
56 ERROR_CLASS_GENERIC_ERROR, "An internal buffer overran"
57
58 #define QERR_BUS_NO_HOTPLUG \
59 ERROR_CLASS_GENERIC_ERROR, "Bus '%s' does not support hotplugging"
60
61 #define QERR_BUS_NOT_FOUND \
62 ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not found"
63
64 #define QERR_COMMAND_DISABLED \
65 ERROR_CLASS_GENERIC_ERROR, "The command %s has been disabled for this instance"
66
67 #define QERR_COMMAND_NOT_FOUND \
68 ERROR_CLASS_COMMAND_NOT_FOUND, "The command %s has not been found"
69
70 #define QERR_DEVICE_ENCRYPTED \
71 ERROR_CLASS_DEVICE_ENCRYPTED, "'%s' (%s) is encrypted"
72
73 #define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \
74 ERROR_CLASS_GENERIC_ERROR, "Migration is disabled when using feature '%s' in device '%s'"
75
76 #define QERR_DEVICE_HAS_NO_MEDIUM \
77 ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium"
78
79 #define QERR_DEVICE_INIT_FAILED \
80 ERROR_CLASS_GENERIC_ERROR, "Device '%s' could not be initialized"
81
82 #define QERR_DEVICE_IN_USE \
83 ERROR_CLASS_GENERIC_ERROR, "Device '%s' is in use"
84
85 #define QERR_DEVICE_IS_READ_ONLY \
86 ERROR_CLASS_GENERIC_ERROR, "Device '%s' is read only"
87
88 #define QERR_DEVICE_LOCKED \
89 ERROR_CLASS_GENERIC_ERROR, "Device '%s' is locked"
90
91 #define QERR_DEVICE_MULTIPLE_BUSSES \
92 ERROR_CLASS_GENERIC_ERROR, "Device '%s' has multiple child busses"
93
94 #define QERR_DEVICE_NO_BUS \
95 ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no child bus"
96
97 #define QERR_DEVICE_NO_HOTPLUG \
98 ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging"
99
100 #define QERR_DEVICE_NOT_ACTIVE \
101 ERROR_CLASS_DEVICE_NOT_ACTIVE, "Device '%s' has not been activated"
102
103 #define QERR_DEVICE_NOT_ENCRYPTED \
104 ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not encrypted"
105
106 #define QERR_DEVICE_NOT_FOUND \
107 ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found"
108
109 #define QERR_DEVICE_NOT_REMOVABLE \
110 ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not removable"
111
112 #define QERR_DUPLICATE_ID \
113 ERROR_CLASS_GENERIC_ERROR, "Duplicate ID '%s' for %s"
114
115 #define QERR_FD_NOT_FOUND \
116 ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found"
117
118 #define QERR_FD_NOT_SUPPLIED \
119 ERROR_CLASS_GENERIC_ERROR, "No file descriptor supplied via SCM_RIGHTS"
120
121 #define QERR_FEATURE_DISABLED \
122 ERROR_CLASS_GENERIC_ERROR, "The feature '%s' is not enabled"
123
124 #define QERR_INVALID_BLOCK_FORMAT \
125 ERROR_CLASS_GENERIC_ERROR, "Invalid block format '%s'"
126
127 #define QERR_INVALID_OPTION_GROUP \
128 ERROR_CLASS_GENERIC_ERROR, "There is no option group '%s'"
129
130 #define QERR_INVALID_PARAMETER \
131 ERROR_CLASS_GENERIC_ERROR, "Invalid parameter '%s'"
132
133 #define QERR_INVALID_PARAMETER_COMBINATION \
134 ERROR_CLASS_GENERIC_ERROR, "Invalid parameter combination"
135
136 #define QERR_INVALID_PARAMETER_TYPE \
137 ERROR_CLASS_GENERIC_ERROR, "Invalid parameter type for '%s', expected: %s"
138
139 #define QERR_INVALID_PARAMETER_VALUE \
140 ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' expects %s"
141
142 #define QERR_INVALID_PASSWORD \
143 ERROR_CLASS_GENERIC_ERROR, "Password incorrect"
144
145 #define QERR_IO_ERROR \
146 ERROR_CLASS_GENERIC_ERROR, "An IO error has occurred"
147
148 #define QERR_JSON_PARSE_ERROR \
149 ERROR_CLASS_GENERIC_ERROR, "JSON parse error, %s"
150
151 #define QERR_JSON_PARSING \
152 ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax"
153
154 #define QERR_KVM_MISSING_CAP \
155 ERROR_CLASS_K_V_M_MISSING_CAP, "Using KVM without %s, %s unavailable"
156
157 #define QERR_MIGRATION_ACTIVE \
158 ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress"
159
160 #define QERR_MIGRATION_NOT_SUPPORTED \
161 ERROR_CLASS_GENERIC_ERROR, "State blocked by non-migratable device '%s'"
162
163 #define QERR_MIGRATION_EXPECTED \
164 ERROR_CLASS_MIGRATION_EXPECTED, "An incoming migration is expected before this command can be executed"
165
166 #define QERR_MISSING_PARAMETER \
167 ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing"
168
169 #define QERR_NO_BUS_FOR_DEVICE \
170 ERROR_CLASS_GENERIC_ERROR, "No '%s' bus found for device '%s'"
171
172 #define QERR_NOT_SUPPORTED \
173 ERROR_CLASS_GENERIC_ERROR, "Not supported"
174
175 #define QERR_OPEN_FILE_FAILED \
176 ERROR_CLASS_GENERIC_ERROR, "Could not open '%s'"
177
178 #define QERR_PERMISSION_DENIED \
179 ERROR_CLASS_GENERIC_ERROR, "Insufficient permission to perform this operation"
180
181 #define QERR_PROPERTY_NOT_FOUND \
182 ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' not found"
183
184 #define QERR_PROPERTY_VALUE_BAD \
185 ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' doesn't take value '%s'"
186
187 #define QERR_PROPERTY_VALUE_IN_USE \
188 ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' can't take value '%s', it's in use"
189
190 #define QERR_PROPERTY_VALUE_NOT_FOUND \
191 ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' can't find value '%s'"
192
193 #define QERR_PROPERTY_VALUE_NOT_POWER_OF_2 \
194 ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value '%" PRId64 "', it's not a power of 2"
195
196 #define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
197 ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
198
199 #define QERR_QGA_COMMAND_FAILED \
200 ERROR_CLASS_GENERIC_ERROR, "Guest agent command failed, error was '%s'"
201
202 #define QERR_QGA_LOGGING_FAILED \
203 ERROR_CLASS_GENERIC_ERROR, "Guest agent failed to log non-optional log statement"
204
205 #define QERR_QMP_BAD_INPUT_OBJECT \
206 ERROR_CLASS_GENERIC_ERROR, "Expected '%s' in QMP input"
207
208 #define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
209 ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' expects '%s'"
210
211 #define QERR_QMP_EXTRA_MEMBER \
212 ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' is unexpected"
213
214 #define QERR_RESET_REQUIRED \
215 ERROR_CLASS_GENERIC_ERROR, "Resetting the Virtual Machine is required"
216
217 #define QERR_SET_PASSWD_FAILED \
218 ERROR_CLASS_GENERIC_ERROR, "Could not set password"
219
220 #define QERR_TOO_MANY_FILES \
221 ERROR_CLASS_GENERIC_ERROR, "Too many open files"
222
223 #define QERR_UNDEFINED_ERROR \
224 ERROR_CLASS_GENERIC_ERROR, "An undefined error has occurred"
225
226 #define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
227 ERROR_CLASS_GENERIC_ERROR, "'%s' uses a %s feature which is not supported by this qemu version: %s"
228
229 #define QERR_UNSUPPORTED \
230 ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
231
232 #define QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION \
233 ERROR_CLASS_GENERIC_ERROR, "Migration is disabled when VirtFS export path '%s' is mounted in the guest using mount_tag '%s'"
234
235 #define QERR_VNC_SERVER_FAILED \
236 ERROR_CLASS_GENERIC_ERROR, "Could not start VNC server on %s"
237
238 #define QERR_SOCKET_CONNECT_FAILED \
239 ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket"
240
241 #define QERR_SOCKET_LISTEN_FAILED \
242 ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode"
243
244 #define QERR_SOCKET_BIND_FAILED \
245 ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket"
246
247 #define QERR_SOCKET_CREATE_FAILED \
248 ERROR_CLASS_GENERIC_ERROR, "Failed to create socket"
249
250 #endif /* QERROR_H */