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