Statistics
| Branch: | Revision:

root / qerror.h @ 6d3f0dbb

History | View | Annotate | Download (8 kB)

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
    Location loc;
25
    char *err_msg;
26
    ErrorClass err_class;
27
} QError;
28

    
29
QString *qerror_human(const QError *qerror);
30
void qerror_report(ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
31
void qerror_report_err(Error *err);
32
void assert_no_error(Error *err);
33

    
34
/*
35
 * QError class list
36
 * Please keep the definitions in alphabetical order.
37
 * Use scripts/check-qerror.sh to check.
38
 */
39
#define QERR_ADD_CLIENT_FAILED \
40
    ERROR_CLASS_GENERIC_ERROR, "Could not add client"
41

    
42
#define QERR_AMBIGUOUS_PATH \
43
    ERROR_CLASS_GENERIC_ERROR, "Path '%s' does not uniquely identify an object"
44

    
45
#define QERR_BAD_BUS_FOR_DEVICE \
46
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' can't go on a %s bus"
47

    
48
#define QERR_BASE_NOT_FOUND \
49
    ERROR_CLASS_GENERIC_ERROR, "Base '%s' not found"
50

    
51
#define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
52
    ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by device '%s' does not support feature '%s'"
53

    
54
#define QERR_BUFFER_OVERRUN \
55
    ERROR_CLASS_GENERIC_ERROR, "An internal buffer overran"
56

    
57
#define QERR_BUS_NO_HOTPLUG \
58
    ERROR_CLASS_GENERIC_ERROR, "Bus '%s' does not support hotplugging"
59

    
60
#define QERR_BUS_NOT_FOUND \
61
    ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not found"
62

    
63
#define QERR_COMMAND_DISABLED \
64
    ERROR_CLASS_GENERIC_ERROR, "The command %s has been disabled for this instance"
65

    
66
#define QERR_COMMAND_NOT_FOUND \
67
    ERROR_CLASS_COMMAND_NOT_FOUND, "The command %s has not been found"
68

    
69
#define QERR_DEVICE_ENCRYPTED \
70
    ERROR_CLASS_DEVICE_ENCRYPTED, "'%s' (%s) is encrypted"
71

    
72
#define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \
73
    ERROR_CLASS_GENERIC_ERROR, "Migration is disabled when using feature '%s' in device '%s'"
74

    
75
#define QERR_DEVICE_HAS_NO_MEDIUM \
76
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium"
77

    
78
#define QERR_DEVICE_INIT_FAILED \
79
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' could not be initialized"
80

    
81
#define QERR_DEVICE_IN_USE \
82
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' is in use"
83

    
84
#define QERR_DEVICE_IS_READ_ONLY \
85
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' is read only"
86

    
87
#define QERR_DEVICE_LOCKED \
88
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' is locked"
89

    
90
#define QERR_DEVICE_MULTIPLE_BUSSES \
91
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' has multiple child busses"
92

    
93
#define QERR_DEVICE_NO_BUS \
94
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no child bus"
95

    
96
#define QERR_DEVICE_NO_HOTPLUG \
97
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging"
98

    
99
#define QERR_DEVICE_NOT_ACTIVE \
100
    ERROR_CLASS_DEVICE_NOT_ACTIVE, "Device '%s' has not been activated"
101

    
102
#define QERR_DEVICE_NOT_ENCRYPTED \
103
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not encrypted"
104

    
105
#define QERR_DEVICE_NOT_FOUND \
106
    ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found"
107

    
108
#define QERR_DEVICE_NOT_REMOVABLE \
109
    ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not removable"
110

    
111
#define QERR_DUPLICATE_ID \
112
    ERROR_CLASS_GENERIC_ERROR, "Duplicate ID '%s' for %s"
113

    
114
#define QERR_FD_NOT_FOUND \
115
    ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found"
116

    
117
#define QERR_FD_NOT_SUPPLIED \
118
    ERROR_CLASS_GENERIC_ERROR, "No file descriptor supplied via SCM_RIGHTS"
119

    
120
#define QERR_FEATURE_DISABLED \
121
    ERROR_CLASS_GENERIC_ERROR, "The feature '%s' is not enabled"
122

    
123
#define QERR_INVALID_BLOCK_FORMAT \
124
    ERROR_CLASS_GENERIC_ERROR, "Invalid block format '%s'"
125

    
126
#define QERR_INVALID_OPTION_GROUP \
127
    ERROR_CLASS_GENERIC_ERROR, "There is no option group '%s'"
128

    
129
#define QERR_INVALID_PARAMETER \
130
    ERROR_CLASS_GENERIC_ERROR, "Invalid parameter '%s'"
131

    
132
#define QERR_INVALID_PARAMETER_COMBINATION \
133
    ERROR_CLASS_GENERIC_ERROR, "Invalid parameter combination"
134

    
135
#define QERR_INVALID_PARAMETER_TYPE \
136
    ERROR_CLASS_GENERIC_ERROR, "Invalid parameter type for '%s', expected: %s"
137

    
138
#define QERR_INVALID_PARAMETER_VALUE \
139
    ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' expects %s"
140

    
141
#define QERR_INVALID_PASSWORD \
142
    ERROR_CLASS_GENERIC_ERROR, "Password incorrect"
143

    
144
#define QERR_IO_ERROR \
145
    ERROR_CLASS_GENERIC_ERROR, "An IO error has occurred"
146

    
147
#define QERR_JSON_PARSE_ERROR \
148
    ERROR_CLASS_GENERIC_ERROR, "JSON parse error, %s"
149

    
150
#define QERR_JSON_PARSING \
151
    ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax"
152

    
153
#define QERR_KVM_MISSING_CAP \
154
    ERROR_CLASS_K_V_M_MISSING_CAP, "Using KVM without %s, %s unavailable"
155

    
156
#define QERR_MIGRATION_ACTIVE \
157
    ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress"
158

    
159
#define QERR_MIGRATION_NOT_SUPPORTED \
160
    ERROR_CLASS_GENERIC_ERROR, "State blocked by non-migratable device '%s'"
161

    
162
#define QERR_MIGRATION_EXPECTED \
163
    ERROR_CLASS_MIGRATION_EXPECTED, "An incoming migration is expected before this command can be executed"
164

    
165
#define QERR_MISSING_PARAMETER \
166
    ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing"
167

    
168
#define QERR_NO_BUS_FOR_DEVICE \
169
    ERROR_CLASS_GENERIC_ERROR, "No '%s' bus found for device '%s'"
170

    
171
#define QERR_NOT_SUPPORTED \
172
    ERROR_CLASS_GENERIC_ERROR, "Not supported"
173

    
174
#define QERR_OPEN_FILE_FAILED \
175
    ERROR_CLASS_GENERIC_ERROR, "Could not open '%s'"
176

    
177
#define QERR_PERMISSION_DENIED \
178
    ERROR_CLASS_GENERIC_ERROR, "Insufficient permission to perform this operation"
179

    
180
#define QERR_PROPERTY_NOT_FOUND \
181
    ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' not found"
182

    
183
#define QERR_PROPERTY_VALUE_BAD \
184
    ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' doesn't take value '%s'"
185

    
186
#define QERR_PROPERTY_VALUE_IN_USE \
187
    ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' can't take value '%s', it's in use"
188

    
189
#define QERR_PROPERTY_VALUE_NOT_FOUND \
190
    ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' can't find value '%s'"
191

    
192
#define QERR_PROPERTY_VALUE_NOT_POWER_OF_2 \
193
    ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value '%" PRId64 "', it's not a power of 2"
194

    
195
#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
196
    ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
197

    
198
#define QERR_QGA_COMMAND_FAILED \
199
    ERROR_CLASS_GENERIC_ERROR, "Guest agent command failed, error was '%s'"
200

    
201
#define QERR_QGA_LOGGING_FAILED \
202
    ERROR_CLASS_GENERIC_ERROR, "Guest agent failed to log non-optional log statement"
203

    
204
#define QERR_QMP_BAD_INPUT_OBJECT \
205
    ERROR_CLASS_GENERIC_ERROR, "Expected '%s' in QMP input"
206

    
207
#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
208
    ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' expects '%s'"
209

    
210
#define QERR_QMP_EXTRA_MEMBER \
211
    ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' is unexpected"
212

    
213
#define QERR_RESET_REQUIRED \
214
    ERROR_CLASS_GENERIC_ERROR, "Resetting the Virtual Machine is required"
215

    
216
#define QERR_SET_PASSWD_FAILED \
217
    ERROR_CLASS_GENERIC_ERROR, "Could not set password"
218

    
219
#define QERR_TOO_MANY_FILES \
220
    ERROR_CLASS_GENERIC_ERROR, "Too many open files"
221

    
222
#define QERR_UNDEFINED_ERROR \
223
    ERROR_CLASS_GENERIC_ERROR, "An undefined error has occurred"
224

    
225
#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
226
    ERROR_CLASS_GENERIC_ERROR, "'%s' uses a %s feature which is not supported by this qemu version: %s"
227

    
228
#define QERR_UNSUPPORTED \
229
    ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
230

    
231
#define QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION \
232
    ERROR_CLASS_GENERIC_ERROR, "Migration is disabled when VirtFS export path '%s' is mounted in the guest using mount_tag '%s'"
233

    
234
#define QERR_VNC_SERVER_FAILED \
235
    ERROR_CLASS_GENERIC_ERROR, "Could not start VNC server on %s"
236

    
237
#define QERR_SOCKET_CONNECT_FAILED \
238
    ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket"
239

    
240
#define QERR_SOCKET_LISTEN_FAILED \
241
    ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode"
242

    
243
#define QERR_SOCKET_BIND_FAILED \
244
    ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket"
245

    
246
#define QERR_SOCKET_CREATE_FAILED \
247
    ERROR_CLASS_GENERIC_ERROR, "Failed to create socket"
248

    
249
#endif /* QERROR_H */