ia64/xen-unstable
changeset 15566:73290f6fe70a
Xen API specification improvements.
Move the error list to be more prominent, and explicitly document
which generic error codes can be returned by all methods.
Mark host CPU flags/features return value as unspecified.
Document PERMISSION_DENIED.
Document error returns of session.login_with_password.
Signed-off-by: John Levon <john.levon@sun.com>
Move the error list to be more prominent, and explicitly document
which generic error codes can be returned by all methods.
Mark host CPU flags/features return value as unspecified.
Document PERMISSION_DENIED.
Document error returns of session.login_with_password.
Signed-off-by: John Levon <john.levon@sun.com>
author | kfraser@localhost.localdomain |
---|---|
date | Tue Jul 10 10:22:41 2007 +0100 (2007-07-10) |
parents | 80099a459d7a |
children | 1f348e70a5af |
files | docs/xen-api/xenapi-datamodel.tex |
line diff
1.1 --- a/docs/xen-api/xenapi-datamodel.tex Tue Jul 10 10:15:01 2007 +0100 1.2 +++ b/docs/xen-api/xenapi-datamodel.tex Tue Jul 10 10:22:41 2007 +0100 1.3 @@ -225,6 +225,249 @@ The following enumeration types are used 1.4 \end{longtable} 1.5 1.6 \vspace{1cm} 1.7 +\newpage 1.8 +\section{Error Handling} 1.9 +When a low-level transport error occurs, or a request is malformed at the HTTP 1.10 +or XML-RPC level, the server may send an XML-RPC Fault response, or the client 1.11 +may simulate the same. The client must be prepared to handle these errors, 1.12 +though they may be treated as fatal. On the wire, these are transmitted in a 1.13 +form similar to this: 1.14 + 1.15 +\begin{verbatim} 1.16 + <methodResponse> 1.17 + <fault> 1.18 + <value> 1.19 + <struct> 1.20 + <member> 1.21 + <name>faultCode</name> 1.22 + <value><int>-1</int></value> 1.23 + </member> 1.24 + <member> 1.25 + <name>faultString</name> 1.26 + <value><string>Malformed request</string></value> 1.27 + </member> 1.28 + </struct> 1.29 + </value> 1.30 + </fault> 1.31 + </methodResponse> 1.32 +\end{verbatim} 1.33 + 1.34 +All other failures are reported with a more structured error response, to 1.35 +allow better automatic response to failures, proper internationalisation of 1.36 +any error message, and easier debugging. On the wire, these are transmitted 1.37 +like this: 1.38 + 1.39 +\begin{verbatim} 1.40 + <struct> 1.41 + <member> 1.42 + <name>Status</name> 1.43 + <value>Failure</value> 1.44 + </member> 1.45 + <member> 1.46 + <name>ErrorDescription</name> 1.47 + <value> 1.48 + <array> 1.49 + <data> 1.50 + <value>MAP_DUPLICATE_KEY</value> 1.51 + <value>Customer</value> 1.52 + <value>eSpeil Inc.</value> 1.53 + <value>eSpeil Incorporated</value> 1.54 + </data> 1.55 + </array> 1.56 + </value> 1.57 + </member> 1.58 + </struct> 1.59 +\end{verbatim} 1.60 + 1.61 +Note that {\tt ErrorDescription} value is an array of string values. The 1.62 +first element of the array is an error code; the remainder of the array are 1.63 +strings representing error parameters relating to that code. In this case, 1.64 +the client has attempted to add the mapping {\tt Customer $\rightarrow$ 1.65 +eSpiel Incorporated} to a Map, but it already contains the mapping 1.66 +{\tt Customer $\rightarrow$ eSpiel Inc.}, and so the request has failed. 1.67 + 1.68 +The reference below lists each possible error returned by each method. 1.69 +As well as the errors explicitly listed, any method may return low-level 1.70 +errors as described above, or any of the following generic errors: 1.71 + 1.72 +\begin{itemize} 1.73 +\item HANDLE\_INVALID 1.74 +\item INTERNAL\_ERROR 1.75 +\item MAP\_DUPLICATE\_KEY 1.76 +\item MESSAGE\_METHOD\_UNKNOWN 1.77 +\item MESSAGE\_PARAMETER\_COUNT\_MISMATCH 1.78 +\item OPERATION\_NOT\_ALLOWED 1.79 +\item PERMISSION\_DENIED 1.80 +\item SESSION\_INVALID 1.81 +\end{itemize} 1.82 + 1.83 +Each possible error code is documented in the following section. 1.84 + 1.85 +\subsection{Error Codes} 1.86 + 1.87 +\subsubsection{HANDLE\_INVALID} 1.88 + 1.89 +You gave an invalid handle. The object may have recently been deleted. 1.90 +The class parameter gives the type of reference given, and the handle 1.91 +parameter echoes the bad value given. 1.92 + 1.93 +\vspace{0.3cm} 1.94 +{\bf Signature:} 1.95 +\begin{verbatim}HANDLE_INVALID(class, handle)\end{verbatim} 1.96 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.97 + 1.98 +\subsubsection{INTERNAL\_ERROR} 1.99 + 1.100 +The server failed to handle your request, due to an internal error. The 1.101 +given message may give details useful for debugging the problem. 1.102 + 1.103 +\vspace{0.3cm} 1.104 +{\bf Signature:} 1.105 +\begin{verbatim}INTERNAL_ERROR(message)\end{verbatim} 1.106 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.107 + 1.108 +\subsubsection{MAP\_DUPLICATE\_KEY} 1.109 + 1.110 +You tried to add a key-value pair to a map, but that key is already there. 1.111 +The key, current value, and the new value that you tried to set are all 1.112 +echoed. 1.113 + 1.114 +\vspace{0.3cm} 1.115 +{\bf Signature:} 1.116 +\begin{verbatim}MAP_DUPLICATE_KEY(key, current value, new value)\end{verbatim} 1.117 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.118 + 1.119 +\subsubsection{MESSAGE\_METHOD\_UNKNOWN} 1.120 + 1.121 +You tried to call a method that does not exist. The method name that you 1.122 +used is echoed. 1.123 + 1.124 +\vspace{0.3cm} 1.125 +{\bf Signature:} 1.126 +\begin{verbatim}MESSAGE_METHOD_UNKNOWN(method)\end{verbatim} 1.127 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.128 + 1.129 +\subsubsection{MESSAGE\_PARAMETER\_COUNT\_MISMATCH} 1.130 + 1.131 +You tried to call a method with the incorrect number of parameters. The 1.132 +fully-qualified method name that you used, and the number of received and 1.133 +expected parameters are returned. 1.134 + 1.135 +\vspace{0.3cm} 1.136 +{\bf Signature:} 1.137 +\begin{verbatim}MESSAGE_PARAMETER_COUNT_MISMATCH(method, expected, received)\end{verbatim} 1.138 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.139 + 1.140 +\subsubsection{NETWORK\_ALREADY\_CONNECTED} 1.141 + 1.142 +You tried to create a PIF, but the network you tried to attach it to is 1.143 +already attached to some other PIF, and so the creation failed. 1.144 + 1.145 +\vspace{0.3cm} 1.146 +{\bf Signature:} 1.147 +\begin{verbatim}NETWORK_ALREADY_CONNECTED(network, connected PIF)\end{verbatim} 1.148 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.149 + 1.150 +\subsubsection{OPERATION\_NOT\_ALLOWED} 1.151 + 1.152 +You attempted an operation that was not allowed. 1.153 + 1.154 +\vspace{0.3cm} 1.155 +No parameters. 1.156 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.157 + 1.158 +\subsubsection{PERMISSION\_DENIED} 1.159 + 1.160 +You do not have the required permissions to perform the operation. 1.161 + 1.162 +\vspace{0.3cm} 1.163 +No parameters. 1.164 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.165 + 1.166 +\subsubsection{PIF\_IS\_PHYSICAL} 1.167 + 1.168 +You tried to destroy a PIF, but it represents an aspect of the physical 1.169 +host configuration, and so cannot be destroyed. The parameter echoes the 1.170 +PIF handle you gave. 1.171 + 1.172 +\vspace{0.3cm} 1.173 +{\bf Signature:} 1.174 +\begin{verbatim}PIF_IS_PHYSICAL(PIF)\end{verbatim} 1.175 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.176 + 1.177 +\subsubsection{SESSION\_AUTHENTICATION\_FAILED} 1.178 + 1.179 +The credentials given by the user are incorrect, so access has been denied, 1.180 +and you have not been issued a session handle. 1.181 + 1.182 +\vspace{0.3cm} 1.183 +No parameters. 1.184 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.185 + 1.186 +\subsubsection{SESSION\_INVALID} 1.187 + 1.188 +You gave an invalid session handle. It may have been invalidated by a 1.189 +server restart, or timed out. You should get a new session handle, using 1.190 +one of the session.login\_ calls. This error does not invalidate the 1.191 +current connection. The handle parameter echoes the bad value given. 1.192 + 1.193 +\vspace{0.3cm} 1.194 +{\bf Signature:} 1.195 +\begin{verbatim}SESSION_INVALID(handle)\end{verbatim} 1.196 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.197 + 1.198 +\subsubsection{SESSION\_NOT\_REGISTERED} 1.199 + 1.200 +This session is not registered to receive events. You must call 1.201 +event.register before event.next. The session handle you are using is 1.202 +echoed. 1.203 + 1.204 +\vspace{0.3cm} 1.205 +{\bf Signature:} 1.206 +\begin{verbatim}SESSION_NOT_REGISTERED(handle)\end{verbatim} 1.207 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.208 + 1.209 +\subsubsection{VALUE\_NOT\_SUPPORTED} 1.210 + 1.211 +You attempted to set a value that is not supported by this implementation. 1.212 +The fully-qualified field name and the value that you tried to set are 1.213 +returned. Also returned is a developer-only diagnostic reason. 1.214 + 1.215 +\vspace{0.3cm} 1.216 +{\bf Signature:} 1.217 +\begin{verbatim}VALUE_NOT_SUPPORTED(field, value, reason)\end{verbatim} 1.218 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.219 + 1.220 +\subsubsection{VLAN\_TAG\_INVALID} 1.221 + 1.222 +You tried to create a VLAN, but the tag you gave was invalid -- it mmust be 1.223 +between 0 and 4095. The parameter echoes the VLAN tag you gave. 1.224 + 1.225 +\vspace{0.3cm} 1.226 +{\bf Signature:} 1.227 +\begin{verbatim}VLAN_TAG_INVALID(VLAN)\end{verbatim} 1.228 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.229 + 1.230 +\subsubsection{VM\_BAD\_POWER\_STATE} 1.231 + 1.232 +You attempted an operation on a VM that was not in an appropriate power 1.233 +state at the time; for example, you attempted to start a VM that was 1.234 +already running. The parameters returned are the VM's handle, and the 1.235 +expected and actual VM state at the time of the call. 1.236 + 1.237 +\vspace{0.3cm} 1.238 +{\bf Signature:} 1.239 +\begin{verbatim}VM_BAD_POWER_STATE(vm, expected, actual)\end{verbatim} 1.240 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.241 + 1.242 +\subsubsection{VM\_HVM\_REQUIRED} 1.243 + 1.244 +HVM is required for this operation 1.245 + 1.246 +\vspace{0.3cm} 1.247 +{\bf Signature:} 1.248 +\begin{verbatim}VM_HVM_REQUIRED(vm)\end{verbatim} 1.249 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.250 1.251 \newpage 1.252 \section{Class: session} 1.253 @@ -275,6 +518,11 @@ session ref 1.254 1.255 1.256 ID of newly created session 1.257 + 1.258 +\vspace{0.3cm} 1.259 + 1.260 +\noindent{\bf Possible Error Codes:} {\tt SESSION\_AUTHENTICATION\_FAILED} 1.261 + 1.262 \vspace{0.3cm} 1.263 \vspace{0.3cm} 1.264 \vspace{0.3cm} 1.265 @@ -7100,7 +7348,9 @@ value of the field 1.266 \subsubsection{RPC name:~get\_flags} 1.267 1.268 {\bf Overview:} 1.269 -Get the flags field of the given host\_cpu. 1.270 +Get the flags field of the given host\_cpu. As of this version of the 1.271 +API, the semantics of the returned string are explicitly unspecified, 1.272 +and may change in the future. 1.273 1.274 \noindent {\bf Signature:} 1.275 \begin{verbatim} string get_flags (session_id s, host_cpu ref self)\end{verbatim} 1.276 @@ -7132,7 +7382,9 @@ value of the field 1.277 \subsubsection{RPC name:~get\_features} 1.278 1.279 {\bf Overview:} 1.280 -Get the features field of the given host\_cpu. 1.281 +Get the features field of the given host\_cpu. As of this version of the 1.282 +API, the semantics of the returned string are explicitly unspecified, 1.283 +and may change in the future. 1.284 1.285 \noindent {\bf Signature:} 1.286 \begin{verbatim} string get_features (session_id s, host_cpu ref self)\end{verbatim} 1.287 @@ -14192,224 +14444,3 @@ all fields from the object 1.288 \vspace{0.3cm} 1.289 \vspace{0.3cm} 1.290 1.291 -\vspace{1cm} 1.292 -\newpage 1.293 -\section{Error Handling} 1.294 -When a low-level transport error occurs, or a request is malformed at the HTTP 1.295 -or XML-RPC level, the server may send an XML-RPC Fault response, or the client 1.296 -may simulate the same. The client must be prepared to handle these errors, 1.297 -though they may be treated as fatal. On the wire, these are transmitted in a 1.298 -form similar to this: 1.299 - 1.300 -\begin{verbatim} 1.301 - <methodResponse> 1.302 - <fault> 1.303 - <value> 1.304 - <struct> 1.305 - <member> 1.306 - <name>faultCode</name> 1.307 - <value><int>-1</int></value> 1.308 - </member> 1.309 - <member> 1.310 - <name>faultString</name> 1.311 - <value><string>Malformed request</string></value> 1.312 - </member> 1.313 - </struct> 1.314 - </value> 1.315 - </fault> 1.316 - </methodResponse> 1.317 -\end{verbatim} 1.318 - 1.319 -All other failures are reported with a more structured error response, to 1.320 -allow better automatic response to failures, proper internationalisation of 1.321 -any error message, and easier debugging. On the wire, these are transmitted 1.322 -like this: 1.323 - 1.324 -\begin{verbatim} 1.325 - <struct> 1.326 - <member> 1.327 - <name>Status</name> 1.328 - <value>Failure</value> 1.329 - </member> 1.330 - <member> 1.331 - <name>ErrorDescription</name> 1.332 - <value> 1.333 - <array> 1.334 - <data> 1.335 - <value>MAP_DUPLICATE_KEY</value> 1.336 - <value>Customer</value> 1.337 - <value>eSpeil Inc.</value> 1.338 - <value>eSpeil Incorporated</value> 1.339 - </data> 1.340 - </array> 1.341 - </value> 1.342 - </member> 1.343 - </struct> 1.344 -\end{verbatim} 1.345 - 1.346 -Note that {\tt ErrorDescription} value is an array of string values. The 1.347 -first element of the array is an error code; the remainder of the array are 1.348 -strings representing error parameters relating to that code. In this case, 1.349 -the client has attempted to add the mapping {\tt Customer $\rightarrow$ 1.350 -eSpiel Incorporated} to a Map, but it already contains the mapping 1.351 -{\tt Customer $\rightarrow$ eSpiel Inc.}, and so the request has failed. 1.352 - 1.353 -Each possible error code is documented in the following section. 1.354 - 1.355 -\subsection{Error Codes} 1.356 - 1.357 -\subsubsection{HANDLE\_INVALID} 1.358 - 1.359 -You gave an invalid handle. The object may have recently been deleted. 1.360 -The class parameter gives the type of reference given, and the handle 1.361 -parameter echoes the bad value given. 1.362 - 1.363 -\vspace{0.3cm} 1.364 -{\bf Signature:} 1.365 -\begin{verbatim}HANDLE_INVALID(class, handle)\end{verbatim} 1.366 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.367 - 1.368 -\subsubsection{INTERNAL\_ERROR} 1.369 - 1.370 -The server failed to handle your request, due to an internal error. The 1.371 -given message may give details useful for debugging the problem. 1.372 - 1.373 -\vspace{0.3cm} 1.374 -{\bf Signature:} 1.375 -\begin{verbatim}INTERNAL_ERROR(message)\end{verbatim} 1.376 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.377 - 1.378 -\subsubsection{MAP\_DUPLICATE\_KEY} 1.379 - 1.380 -You tried to add a key-value pair to a map, but that key is already there. 1.381 -The key, current value, and the new value that you tried to set are all 1.382 -echoed. 1.383 - 1.384 -\vspace{0.3cm} 1.385 -{\bf Signature:} 1.386 -\begin{verbatim}MAP_DUPLICATE_KEY(key, current value, new value)\end{verbatim} 1.387 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.388 - 1.389 -\subsubsection{MESSAGE\_METHOD\_UNKNOWN} 1.390 - 1.391 -You tried to call a method that does not exist. The method name that you 1.392 -used is echoed. 1.393 - 1.394 -\vspace{0.3cm} 1.395 -{\bf Signature:} 1.396 -\begin{verbatim}MESSAGE_METHOD_UNKNOWN(method)\end{verbatim} 1.397 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.398 - 1.399 -\subsubsection{MESSAGE\_PARAMETER\_COUNT\_MISMATCH} 1.400 - 1.401 -You tried to call a method with the incorrect number of parameters. The 1.402 -fully-qualified method name that you used, and the number of received and 1.403 -expected parameters are returned. 1.404 - 1.405 -\vspace{0.3cm} 1.406 -{\bf Signature:} 1.407 -\begin{verbatim}MESSAGE_PARAMETER_COUNT_MISMATCH(method, expected, received)\end{verbatim} 1.408 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.409 - 1.410 -\subsubsection{NETWORK\_ALREADY\_CONNECTED} 1.411 - 1.412 -You tried to create a PIF, but the network you tried to attach it to is 1.413 -already attached to some other PIF, and so the creation failed. 1.414 - 1.415 -\vspace{0.3cm} 1.416 -{\bf Signature:} 1.417 -\begin{verbatim}NETWORK_ALREADY_CONNECTED(network, connected PIF)\end{verbatim} 1.418 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.419 - 1.420 -\subsubsection{OPERATION\_NOT\_ALLOWED} 1.421 - 1.422 -You attempted an operation that was not allowed. 1.423 - 1.424 -\vspace{0.3cm} 1.425 -No parameters. 1.426 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.427 - 1.428 -\subsubsection{PIF\_IS\_PHYSICAL} 1.429 - 1.430 -You tried to destroy a PIF, but it represents an aspect of the physical 1.431 -host configuration, and so cannot be destroyed. The parameter echoes the 1.432 -PIF handle you gave. 1.433 - 1.434 -\vspace{0.3cm} 1.435 -{\bf Signature:} 1.436 -\begin{verbatim}PIF_IS_PHYSICAL(PIF)\end{verbatim} 1.437 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.438 - 1.439 -\subsubsection{SESSION\_AUTHENTICATION\_FAILED} 1.440 - 1.441 -The credentials given by the user are incorrect, so access has been denied, 1.442 -and you have not been issued a session handle. 1.443 - 1.444 -\vspace{0.3cm} 1.445 -No parameters. 1.446 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.447 - 1.448 -\subsubsection{SESSION\_INVALID} 1.449 - 1.450 -You gave an invalid session handle. It may have been invalidated by a 1.451 -server restart, or timed out. You should get a new session handle, using 1.452 -one of the session.login\_ calls. This error does not invalidate the 1.453 -current connection. The handle parameter echoes the bad value given. 1.454 - 1.455 -\vspace{0.3cm} 1.456 -{\bf Signature:} 1.457 -\begin{verbatim}SESSION_INVALID(handle)\end{verbatim} 1.458 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.459 - 1.460 -\subsubsection{SESSION\_NOT\_REGISTERED} 1.461 - 1.462 -This session is not registered to receive events. You must call 1.463 -event.register before event.next. The session handle you are using is 1.464 -echoed. 1.465 - 1.466 -\vspace{0.3cm} 1.467 -{\bf Signature:} 1.468 -\begin{verbatim}SESSION_NOT_REGISTERED(handle)\end{verbatim} 1.469 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.470 - 1.471 -\subsubsection{VALUE\_NOT\_SUPPORTED} 1.472 - 1.473 -You attempted to set a value that is not supported by this implementation. 1.474 -The fully-qualified field name and the value that you tried to set are 1.475 -returned. Also returned is a developer-only diagnostic reason. 1.476 - 1.477 -\vspace{0.3cm} 1.478 -{\bf Signature:} 1.479 -\begin{verbatim}VALUE_NOT_SUPPORTED(field, value, reason)\end{verbatim} 1.480 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.481 - 1.482 -\subsubsection{VLAN\_TAG\_INVALID} 1.483 - 1.484 -You tried to create a VLAN, but the tag you gave was invalid -- it mmust be 1.485 -between 0 and 4095. The parameter echoes the VLAN tag you gave. 1.486 - 1.487 -\vspace{0.3cm} 1.488 -{\bf Signature:} 1.489 -\begin{verbatim}VLAN_TAG_INVALID(VLAN)\end{verbatim} 1.490 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.491 - 1.492 -\subsubsection{VM\_BAD\_POWER\_STATE} 1.493 - 1.494 -You attempted an operation on a VM that was not in an appropriate power 1.495 -state at the time; for example, you attempted to start a VM that was 1.496 -already running. The parameters returned are the VM's handle, and the 1.497 -expected and actual VM state at the time of the call. 1.498 - 1.499 -\vspace{0.3cm} 1.500 -{\bf Signature:} 1.501 -\begin{verbatim}VM_BAD_POWER_STATE(vm, expected, actual)\end{verbatim} 1.502 -\begin{center}\rule{10em}{0.1pt}\end{center} 1.503 - 1.504 -\subsubsection{VM\_HVM\_REQUIRED} 1.505 - 1.506 -HVM is required for this operation 1.507 - 1.508 -\vspace{0.3cm} 1.509 -{\bf Signature:} 1.510 -\begin{verbatim}VM_HVM_REQUIRED(vm)\end{verbatim} 1.511 -\begin{center}\rule{10em}{0.1pt}\end{center}