From: Ewan Mellor Date: Sun, 28 Jan 2007 18:05:13 +0000 (+0000) Subject: Add task.allowed_operations field, and task.cancel message. The X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15368^2~60 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=063417a54b01f00991d56d6c8d87b4103b0772ff;p=xen.git 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 --- diff --git a/docs/xen-api/xenapi-datamodel.tex b/docs/xen-api/xenapi-datamodel.tex index 64a9741b3d..9d2a5ddc28 100644 --- a/docs/xen-api/xenapi-datamodel.tex +++ b/docs/xen-api/xenapi-datamodel.tex @@ -134,6 +134,15 @@ The following enumeration types are used: \hline \end{longtable} +\vspace{1cm} +\begin{longtable}{|ll|} +\hline +{\tt enum task\_allowed\_operations} & \\ +\hline +\hspace{0.5cm}{\tt Cancel} & Cancel \\ +\hline +\end{longtable} + \vspace{1cm} \begin{longtable}{|ll|} \hline @@ -142,6 +151,8 @@ The following enumeration types are used: \hspace{0.5cm}{\tt pending} & task is in progress \\ \hspace{0.5cm}{\tt success} & task was completed successfully \\ \hspace{0.5cm}{\tt failure} & task has failed \\ +\hspace{0.5cm}{\tt cancelling} & task is being cancelled \\ +\hspace{0.5cm}{\tt cancelled} & task has been cancelled \\ \hline \end{longtable} @@ -558,9 +569,48 @@ $\mathit{RO}_\mathit{run}$ & {\tt type} & string & if the task has completed su $\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. \\ $\mathit{RO}_\mathit{run}$ & {\tt error\_code} & int & if the task has failed, this field contains the error code. Undefined otherwise. \\ $\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. \\ +$\mathit{RO}_\mathit{run}$ & {\tt allowed\_operations} & (task\_allowed\_operations) Set & Operations allowed on this task \\ \hline \end{longtable} \subsection{Additional RPCs associated with class: task} +\subsubsection{RPC name:~cancel} + +{\bf Overview:} +Cancel this task. If task.allowed\_operations does not contain Cancel, +then this will fail with OPERATION\_NOT\_ALLOWED. The task will show the +status 'cancelling', and you should continue to check its status until it +shows 'cancelled'. There is no guarantee as to the time within which this +task will be cancelled. + + \noindent {\bf Signature:} +\begin{verbatim} void cancel (session_id s, task ref task)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt task ref } & task & The task \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +void +} + + + +\vspace{0.3cm} + +\noindent{\bf Possible Error Codes:} {\tt OPERATION\_NOT\_ALLOWED} + +\vspace{0.6cm} \subsubsection{RPC name:~get\_all} {\bf Overview:} @@ -866,6 +916,38 @@ string Set } +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_allowed\_operations} + +{\bf Overview:} +Get the allowed\_operations field of the given task. + + \noindent {\bf Signature:} +\begin{verbatim} ((task_allowed_operations) Set) get_allowed_operations (session_id s, task ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt task ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +(task\_allowed\_operations) Set +} + + value of the field \vspace{0.3cm} \vspace{0.3cm} @@ -10471,6 +10553,15 @@ already attached to some other PIF, and so the creation failed. \begin{verbatim}NETWORK_ALREADY_CONNECTED(network, connected PIF)\end{verbatim} \begin{center}\rule{10em}{0.1pt}\end{center} +\subsubsection{OPERATION\_NOT\_ALLOWED} + +You attempted an operation that was not allowed. + +\vspace{0.3cm} +{\bf Signature:} +\begin{verbatim}OPERATION_NOT_ALLOWED()\end{verbatim} +\begin{center}\rule{10em}{0.1pt}\end{center} + \subsubsection{PIF\_IS\_PHYSICAL} You tried to destroy a PIF, but it represents an aspect of the physical diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index c9ad48cb17..b11385036c 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -503,11 +503,22 @@ class XendAPI(object): 'type', 'result', 'error_code', - 'error_info'] + 'error_info', + 'allowed_operations', + ] task_attr_rw = [] - task_funcs = [('get_by_name_label', 'Set(task)')] + task_funcs = [('get_by_name_label', 'Set(task)'), + ('cancel', None)] + + def task_get_name_label(self, session, task_ref): + task = XendTaskManager.get_task(task_ref) + return xen_api_success(task.name_label) + + def task_get_name_description(self, session, task_ref): + task = XendTaskManager.get_task(task_ref) + return xen_api_success(task.name_description) def task_get_status(self, session, task_ref): task = XendTaskManager.get_task(task_ref) @@ -533,13 +544,8 @@ class XendAPI(object): task = XendTaskManager.get_task(task_ref) return xen_api_success(task.error_info) - def task_get_name_label(self, session, task_ref): - task = XendTaskManager.get_task(task_ref) - return xen_api_success(task.name_label) - - def task_get_name_description(self, session, task_ref): - task = XendTaskManager.get_task(task_ref) - return xen_api_success(task.name_description) + def task_get_allowed_operations(self, session, task_ref): + return xen_api_success({}) def task_get_all(self, session): tasks = XendTaskManager.get_all_tasks() @@ -549,6 +555,9 @@ class XendAPI(object): task = XendTaskManager.get_task(task_ref) return xen_api_success(task.get_record()) + def task_cancel(self, session, task_ref): + return xen_api_error('OPERATION_NOT_ALLOWED') + def task_get_by_name_label(self, session, name): return xen_api_success(XendTaskManager.get_task_by_name(name)) diff --git a/tools/python/xen/xm/messages/en/xen-xm.po b/tools/python/xen/xm/messages/en/xen-xm.po index 9778b17031..345f770002 100644 --- a/tools/python/xen/xm/messages/en/xen-xm.po +++ b/tools/python/xen/xm/messages/en/xen-xm.po @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: Xen-xm 3.0\n" -"PO-Revision-Date: 2007-01-28 12:59+0000\n" +"PO-Revision-Date: 2007-01-28 18:02+0000\n" "Last-Translator: Ewan Mellor \n" "Language-Team: xen-devel \n" "MIME-Version: 1.0\n" @@ -65,6 +65,9 @@ msgstr "The VM handle %(1)s is invalid." msgid "VTPM_HANDLE_INVALID" msgstr "The VTPM handle %(1)s is invalid." +msgid "OPERATION_NOT_ALLOWED" +msgstr "You attempted an operation that was not allowed." + msgid "NETWORK_ALREADY_CONNECTED" msgstr "The network you specified already has a PIF attached to it, and so another one may not be attached."