Statistics
| Branch: | Revision:

root / qerror.h @ c28fa5a0

History | View | Annotate | Download (8.1 kB)

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