WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Add task.allowed_operations field, and ta

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Add task.allowed_operations field, and task.cancel message. The
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 30 Jan 2007 06:00:50 -0800
Delivery-date: Tue, 30 Jan 2007 06:03:05 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1170007513 0
# Node ID 58344c358aa0a1c89da5e592ae36f9067f63602d
# Parent  9521974ea1fa3461d05796e8e95a18773d18dd72
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@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex         |   91 ++++++++++++++++++++++++++++++
 tools/python/xen/xend/XendAPI.py          |   27 +++++---
 tools/python/xen/xm/messages/en/xen-xm.po |    5 +
 3 files changed, 113 insertions(+), 10 deletions(-)

diff -r 9521974ea1fa -r 58344c358aa0 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Sun Jan 28 17:33:50 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Sun Jan 28 18:05:13 2007 +0000
@@ -137,11 +137,22 @@ The following enumeration types are used
 \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
 {\tt enum task\_status\_type} & \\
 \hline
 \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 @@ Quals & Field & Type & Description \\
 $\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:} 
@@ -863,6 +913,38 @@ Get the error\_info field of the given t
  \noindent {\bf Return Type:} 
 {\tt 
 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
 }
 
 
@@ -10471,6 +10553,15 @@ already attached to some other PIF, and 
 \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 -r 9521974ea1fa -r 58344c358aa0 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Sun Jan 28 17:33:50 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Sun Jan 28 18:05:13 2007 +0000
@@ -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()
@@ -548,6 +554,9 @@ class XendAPI(object):
     def task_get_record(self, session, task_ref):
         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 -r 9521974ea1fa -r 58344c358aa0 tools/python/xen/xm/messages/en/xen-xm.po
--- a/tools/python/xen/xm/messages/en/xen-xm.po Sun Jan 28 17:33:50 2007 +0000
+++ b/tools/python/xen/xm/messages/en/xen-xm.po Sun Jan 28 18:05:13 2007 +0000
@@ -19,7 +19,7 @@ msgid ""
 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 <ewan@xxxxxxxxxxxxx>\n"
 "Language-Team: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>\n"
 "MIME-Version: 1.0\n"
@@ -65,6 +65,9 @@ msgid "VTPM_HANDLE_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."
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Add task.allowed_operations field, and task.cancel message. The, Xen patchbot-unstable <=