[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Remove task.error_code -- it's redundant, as we can use the first element of



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1175776554 -3600
# Node ID f1509862f3e6190e383871ef179d9ef5e6e01099
# Parent  4de01232447731f73171ec574ea4f94b83aec7f2
Remove task.error_code -- it's redundant, as we can use the first element of
task.error_info instead.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex |   33 ---------------------------------
 tools/python/xen/xend/XendAPI.py  |    5 -----
 tools/python/xen/xend/XendTask.py |   10 +++-------
 3 files changed, 3 insertions(+), 45 deletions(-)

diff -r 4de012324477 -r f1509862f3e6 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Thu Apr 05 11:58:02 2007 +0100
+++ b/docs/xen-api/xenapi-datamodel.tex Thu Apr 05 13:35:54 2007 +0100
@@ -512,7 +512,6 @@ Quals & Field & Type & Description \\
 $\mathit{RO}_\mathit{run}$ &  {\tt progress} & int & if the task is still 
pending, this field contains the estimated percentage complete (0-100). If task 
has completed (successfully or unsuccessfully) this should be 100. \\
 $\mathit{RO}_\mathit{run}$ &  {\tt type} & string & if the task has completed 
successfully, this field contains the type of the encoded result (i.e. name of 
the class whose reference is in the result field). Undefined otherwise. \\
 $\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
@@ -826,38 +825,6 @@ Get the result field of the given task.
  \noindent {\bf Return Type:} 
 {\tt 
 string
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_error\_code}
-
-{\bf Overview:} 
-Get the error\_code field of the given task.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} int get_error_code (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 
-int
 }
 
 
diff -r 4de012324477 -r f1509862f3e6 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Thu Apr 05 11:58:02 2007 +0100
+++ b/tools/python/xen/xend/XendAPI.py  Thu Apr 05 13:35:54 2007 +0100
@@ -789,7 +789,6 @@ class XendAPI(object):
                     'progress',
                     'type',
                     'result',
-                    'error_code',
                     'error_info',
                     'allowed_operations',
                     'session'
@@ -823,10 +822,6 @@ class XendAPI(object):
     def task_get_result(self, session, task_ref):
         task = XendTaskManager.get_task(task_ref)
         return xen_api_success(task.result)
-
-    def task_get_error_code(self, session, task_ref):
-        task = XendTaskManager.get_task(task_ref)
-        return xen_api_success(task.error_code)
 
     def task_get_error_info(self, session, task_ref):
         task = XendTaskManager.get_task(task_ref)
diff -r 4de012324477 -r f1509862f3e6 tools/python/xen/xend/XendTask.py
--- a/tools/python/xen/xend/XendTask.py Thu Apr 05 11:58:02 2007 +0100
+++ b/tools/python/xen/xend/XendTask.py Thu Apr 05 13:35:54 2007 +0100
@@ -24,7 +24,7 @@ class XendTask(threading.Thread):
     """Represents a Asynchronous Task used by Xen API.
 
     Basically proxies the callable object in a thread and returns the
-    results via self.{type,result,error_code,error_info}.
+    results via self.{type,result,error_info}.
 
     @cvar task_progress: Thread local storage for progress tracking.
                          It is a dict indexed by thread_id. Note that the
@@ -71,7 +71,6 @@ class XendTask(threading.Thread):
         self.uuid = uuid
         
         self.result = None
-        self.error_code = ''
         self.error_info = []
         
         self.name_label = label or func.__name__
@@ -118,13 +117,11 @@ class XendTask(threading.Thread):
                 self.result = result['Value']
                 self.set_status(XEN_API_TASK_STATUS_TYPE[1])
             else:
-                self.error_code = result['ErrorDescription'][0]
-                self.error_info = result['ErrorDescription'][1:]
+                self.error_info = result['ErrorDescription']
                 self.set_status(XEN_API_TASK_STATUS_TYPE[2])                
         except Exception, e:
             log.exception('Error running Async Task')
-            self.error_code = 'INTERNAL ERROR'
-            self.error_info = [str(e)]
+            self.error_info = ['INTERNAL ERROR', str(e)]
             self.set_status(XEN_API_TASK_STATUS_TYPE[2])
 
         self.task_progress_lock.acquire()
@@ -144,7 +141,6 @@ class XendTask(threading.Thread):
             'progress': self.get_progress(),
             'type': self.type,
             'result': self.result,
-            'error_code': self.error_code,
             'error_info': self.error_info,
             'allowed_operations': {},
             'session': self.session,

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.