ia64/xen-unstable
changeset 13708:58344c358aa0
Add task.allowed_operations field, and task.cancel message. The
task_status_type enum has gained cancelling and cancelled values.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
task_status_type enum has gained cancelling and cancelled values.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author | Ewan Mellor <ewan@xensource.com> |
---|---|
date | Sun Jan 28 18:05:13 2007 +0000 (2007-01-28) |
parents | 9521974ea1fa |
children | a7fc9cc9a51f |
files | docs/xen-api/xenapi-datamodel.tex tools/python/xen/xend/XendAPI.py tools/python/xen/xm/messages/en/xen-xm.po |
line diff
1.1 --- a/docs/xen-api/xenapi-datamodel.tex Sun Jan 28 17:33:50 2007 +0000 1.2 +++ b/docs/xen-api/xenapi-datamodel.tex Sun Jan 28 18:05:13 2007 +0000 1.3 @@ -137,11 +137,22 @@ The following enumeration types are used 1.4 \vspace{1cm} 1.5 \begin{longtable}{|ll|} 1.6 \hline 1.7 +{\tt enum task\_allowed\_operations} & \\ 1.8 +\hline 1.9 +\hspace{0.5cm}{\tt Cancel} & Cancel \\ 1.10 +\hline 1.11 +\end{longtable} 1.12 + 1.13 +\vspace{1cm} 1.14 +\begin{longtable}{|ll|} 1.15 +\hline 1.16 {\tt enum task\_status\_type} & \\ 1.17 \hline 1.18 \hspace{0.5cm}{\tt pending} & task is in progress \\ 1.19 \hspace{0.5cm}{\tt success} & task was completed successfully \\ 1.20 \hspace{0.5cm}{\tt failure} & task has failed \\ 1.21 +\hspace{0.5cm}{\tt cancelling} & task is being cancelled \\ 1.22 +\hspace{0.5cm}{\tt cancelled} & task has been cancelled \\ 1.23 \hline 1.24 \end{longtable} 1.25 1.26 @@ -558,9 +569,48 @@ Quals & Field & Type & Description \\ 1.27 $\mathit{RO}_\mathit{run}$ & {\tt result} & string & if the task has completed successfully, this field contains the result value (either Void or an object reference). Undefined otherwise. \\ 1.28 $\mathit{RO}_\mathit{run}$ & {\tt error\_code} & int & if the task has failed, this field contains the error code. Undefined otherwise. \\ 1.29 $\mathit{RO}_\mathit{run}$ & {\tt error\_info} & string Set & if the task has failed, this field contains the set of associated error strings. Undefined otherwise. \\ 1.30 +$\mathit{RO}_\mathit{run}$ & {\tt allowed\_operations} & (task\_allowed\_operations) Set & Operations allowed on this task \\ 1.31 \hline 1.32 \end{longtable} 1.33 \subsection{Additional RPCs associated with class: task} 1.34 +\subsubsection{RPC name:~cancel} 1.35 + 1.36 +{\bf Overview:} 1.37 +Cancel this task. If task.allowed\_operations does not contain Cancel, 1.38 +then this will fail with OPERATION\_NOT\_ALLOWED. The task will show the 1.39 +status 'cancelling', and you should continue to check its status until it 1.40 +shows 'cancelled'. There is no guarantee as to the time within which this 1.41 +task will be cancelled. 1.42 + 1.43 + \noindent {\bf Signature:} 1.44 +\begin{verbatim} void cancel (session_id s, task ref task)\end{verbatim} 1.45 + 1.46 + 1.47 +\noindent{\bf Arguments:} 1.48 + 1.49 + 1.50 +\vspace{0.3cm} 1.51 +\begin{tabular}{|c|c|p{7cm}|} 1.52 + \hline 1.53 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.54 +{\tt task ref } & task & The task \\ \hline 1.55 + 1.56 +\end{tabular} 1.57 + 1.58 +\vspace{0.3cm} 1.59 + 1.60 + \noindent {\bf Return Type:} 1.61 +{\tt 1.62 +void 1.63 +} 1.64 + 1.65 + 1.66 + 1.67 +\vspace{0.3cm} 1.68 + 1.69 +\noindent{\bf Possible Error Codes:} {\tt OPERATION\_NOT\_ALLOWED} 1.70 + 1.71 +\vspace{0.6cm} 1.72 \subsubsection{RPC name:~get\_all} 1.73 1.74 {\bf Overview:} 1.75 @@ -870,6 +920,38 @@ value of the field 1.76 \vspace{0.3cm} 1.77 \vspace{0.3cm} 1.78 \vspace{0.3cm} 1.79 +\subsubsection{RPC name:~get\_allowed\_operations} 1.80 + 1.81 +{\bf Overview:} 1.82 +Get the allowed\_operations field of the given task. 1.83 + 1.84 + \noindent {\bf Signature:} 1.85 +\begin{verbatim} ((task_allowed_operations) Set) get_allowed_operations (session_id s, task ref self)\end{verbatim} 1.86 + 1.87 + 1.88 +\noindent{\bf Arguments:} 1.89 + 1.90 + 1.91 +\vspace{0.3cm} 1.92 +\begin{tabular}{|c|c|p{7cm}|} 1.93 + \hline 1.94 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.95 +{\tt task ref } & self & reference to the object \\ \hline 1.96 + 1.97 +\end{tabular} 1.98 + 1.99 +\vspace{0.3cm} 1.100 + 1.101 + \noindent {\bf Return Type:} 1.102 +{\tt 1.103 +(task\_allowed\_operations) Set 1.104 +} 1.105 + 1.106 + 1.107 +value of the field 1.108 +\vspace{0.3cm} 1.109 +\vspace{0.3cm} 1.110 +\vspace{0.3cm} 1.111 \subsubsection{RPC name:~get\_by\_uuid} 1.112 1.113 {\bf Overview:} 1.114 @@ -10471,6 +10553,15 @@ already attached to some other PIF, and 1.115 \begin{verbatim}NETWORK_ALREADY_CONNECTED(network, connected PIF)\end{verbatim} 1.116 \begin{center}\rule{10em}{0.1pt}\end{center} 1.117 1.118 +\subsubsection{OPERATION\_NOT\_ALLOWED} 1.119 + 1.120 +You attempted an operation that was not allowed. 1.121 + 1.122 +\vspace{0.3cm} 1.123 +{\bf Signature:} 1.124 +\begin{verbatim}OPERATION_NOT_ALLOWED()\end{verbatim} 1.125 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.126 + 1.127 \subsubsection{PIF\_IS\_PHYSICAL} 1.128 1.129 You tried to destroy a PIF, but it represents an aspect of the physical
2.1 --- a/tools/python/xen/xend/XendAPI.py Sun Jan 28 17:33:50 2007 +0000 2.2 +++ b/tools/python/xen/xend/XendAPI.py Sun Jan 28 18:05:13 2007 +0000 2.3 @@ -503,11 +503,22 @@ class XendAPI(object): 2.4 'type', 2.5 'result', 2.6 'error_code', 2.7 - 'error_info'] 2.8 + 'error_info', 2.9 + 'allowed_operations', 2.10 + ] 2.11 2.12 task_attr_rw = [] 2.13 2.14 - task_funcs = [('get_by_name_label', 'Set(task)')] 2.15 + task_funcs = [('get_by_name_label', 'Set(task)'), 2.16 + ('cancel', None)] 2.17 + 2.18 + def task_get_name_label(self, session, task_ref): 2.19 + task = XendTaskManager.get_task(task_ref) 2.20 + return xen_api_success(task.name_label) 2.21 + 2.22 + def task_get_name_description(self, session, task_ref): 2.23 + task = XendTaskManager.get_task(task_ref) 2.24 + return xen_api_success(task.name_description) 2.25 2.26 def task_get_status(self, session, task_ref): 2.27 task = XendTaskManager.get_task(task_ref) 2.28 @@ -533,13 +544,8 @@ class XendAPI(object): 2.29 task = XendTaskManager.get_task(task_ref) 2.30 return xen_api_success(task.error_info) 2.31 2.32 - def task_get_name_label(self, session, task_ref): 2.33 - task = XendTaskManager.get_task(task_ref) 2.34 - return xen_api_success(task.name_label) 2.35 - 2.36 - def task_get_name_description(self, session, task_ref): 2.37 - task = XendTaskManager.get_task(task_ref) 2.38 - return xen_api_success(task.name_description) 2.39 + def task_get_allowed_operations(self, session, task_ref): 2.40 + return xen_api_success({}) 2.41 2.42 def task_get_all(self, session): 2.43 tasks = XendTaskManager.get_all_tasks() 2.44 @@ -549,6 +555,9 @@ class XendAPI(object): 2.45 task = XendTaskManager.get_task(task_ref) 2.46 return xen_api_success(task.get_record()) 2.47 2.48 + def task_cancel(self, session, task_ref): 2.49 + return xen_api_error('OPERATION_NOT_ALLOWED') 2.50 + 2.51 def task_get_by_name_label(self, session, name): 2.52 return xen_api_success(XendTaskManager.get_task_by_name(name)) 2.53
3.1 --- a/tools/python/xen/xm/messages/en/xen-xm.po Sun Jan 28 17:33:50 2007 +0000 3.2 +++ b/tools/python/xen/xm/messages/en/xen-xm.po Sun Jan 28 18:05:13 2007 +0000 3.3 @@ -19,7 +19,7 @@ 3.4 msgid "" 3.5 msgstr "" 3.6 "Project-Id-Version: Xen-xm 3.0\n" 3.7 -"PO-Revision-Date: 2007-01-28 12:59+0000\n" 3.8 +"PO-Revision-Date: 2007-01-28 18:02+0000\n" 3.9 "Last-Translator: Ewan Mellor <ewan@xensource.com>\n" 3.10 "Language-Team: xen-devel <xen-devel@lists.xensource.com>\n" 3.11 "MIME-Version: 1.0\n" 3.12 @@ -65,6 +65,9 @@ msgstr "The VM handle %(1)s is invalid." 3.13 msgid "VTPM_HANDLE_INVALID" 3.14 msgstr "The VTPM handle %(1)s is invalid." 3.15 3.16 +msgid "OPERATION_NOT_ALLOWED" 3.17 +msgstr "You attempted an operation that was not allowed." 3.18 + 3.19 msgid "NETWORK_ALREADY_CONNECTED" 3.20 msgstr "The network you specified already has a PIF attached to it, and so another one may not be attached." 3.21