ia64/xen-unstable

changeset 14744:f1509862f3e6

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@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Apr 05 13:35:54 2007 +0100 (2007-04-05)
parents 4de012324477
children 95f329bf49ec
files docs/xen-api/xenapi-datamodel.tex tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendTask.py
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Thu Apr 05 11:58:02 2007 +0100
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Thu Apr 05 13:35:54 2007 +0100
     1.3 @@ -512,7 +512,6 @@ Quals & Field & Type & Description \\
     1.4  $\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. \\
     1.5  $\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. \\
     1.6  $\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.7 -$\mathit{RO}_\mathit{run}$ &  {\tt error\_code} & int & if the task has failed, this field contains the error code. Undefined otherwise. \\
     1.8  $\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.9  $\mathit{RO}_\mathit{run}$ &  {\tt allowed\_operations} & (task\_allowed\_operations) Set & Operations allowed on this task \\
    1.10  \hline
    1.11 @@ -833,38 +832,6 @@ value of the field
    1.12  \vspace{0.3cm}
    1.13  \vspace{0.3cm}
    1.14  \vspace{0.3cm}
    1.15 -\subsubsection{RPC name:~get\_error\_code}
    1.16 -
    1.17 -{\bf Overview:} 
    1.18 -Get the error\_code field of the given task.
    1.19 -
    1.20 - \noindent {\bf Signature:} 
    1.21 -\begin{verbatim} int get_error_code (session_id s, task ref self)\end{verbatim}
    1.22 -
    1.23 -
    1.24 -\noindent{\bf Arguments:}
    1.25 -
    1.26 - 
    1.27 -\vspace{0.3cm}
    1.28 -\begin{tabular}{|c|c|p{7cm}|}
    1.29 - \hline
    1.30 -{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.31 -{\tt task ref } & self & reference to the object \\ \hline 
    1.32 -
    1.33 -\end{tabular}
    1.34 -
    1.35 -\vspace{0.3cm}
    1.36 -
    1.37 - \noindent {\bf Return Type:} 
    1.38 -{\tt 
    1.39 -int
    1.40 -}
    1.41 -
    1.42 -
    1.43 -value of the field
    1.44 -\vspace{0.3cm}
    1.45 -\vspace{0.3cm}
    1.46 -\vspace{0.3cm}
    1.47  \subsubsection{RPC name:~get\_error\_info}
    1.48  
    1.49  {\bf Overview:} 
     2.1 --- a/tools/python/xen/xend/XendAPI.py	Thu Apr 05 11:58:02 2007 +0100
     2.2 +++ b/tools/python/xen/xend/XendAPI.py	Thu Apr 05 13:35:54 2007 +0100
     2.3 @@ -789,7 +789,6 @@ class XendAPI(object):
     2.4                      'progress',
     2.5                      'type',
     2.6                      'result',
     2.7 -                    'error_code',
     2.8                      'error_info',
     2.9                      'allowed_operations',
    2.10                      'session'
    2.11 @@ -824,10 +823,6 @@ class XendAPI(object):
    2.12          task = XendTaskManager.get_task(task_ref)
    2.13          return xen_api_success(task.result)
    2.14  
    2.15 -    def task_get_error_code(self, session, task_ref):
    2.16 -        task = XendTaskManager.get_task(task_ref)
    2.17 -        return xen_api_success(task.error_code)
    2.18 -
    2.19      def task_get_error_info(self, session, task_ref):
    2.20          task = XendTaskManager.get_task(task_ref)
    2.21          return xen_api_success(task.error_info)
     3.1 --- a/tools/python/xen/xend/XendTask.py	Thu Apr 05 11:58:02 2007 +0100
     3.2 +++ b/tools/python/xen/xend/XendTask.py	Thu Apr 05 13:35:54 2007 +0100
     3.3 @@ -24,7 +24,7 @@ class XendTask(threading.Thread):
     3.4      """Represents a Asynchronous Task used by Xen API.
     3.5  
     3.6      Basically proxies the callable object in a thread and returns the
     3.7 -    results via self.{type,result,error_code,error_info}.
     3.8 +    results via self.{type,result,error_info}.
     3.9  
    3.10      @cvar task_progress: Thread local storage for progress tracking.
    3.11                           It is a dict indexed by thread_id. Note that the
    3.12 @@ -71,7 +71,6 @@ class XendTask(threading.Thread):
    3.13          self.uuid = uuid
    3.14          
    3.15          self.result = None
    3.16 -        self.error_code = ''
    3.17          self.error_info = []
    3.18          
    3.19          self.name_label = label or func.__name__
    3.20 @@ -118,13 +117,11 @@ class XendTask(threading.Thread):
    3.21                  self.result = result['Value']
    3.22                  self.set_status(XEN_API_TASK_STATUS_TYPE[1])
    3.23              else:
    3.24 -                self.error_code = result['ErrorDescription'][0]
    3.25 -                self.error_info = result['ErrorDescription'][1:]
    3.26 +                self.error_info = result['ErrorDescription']
    3.27                  self.set_status(XEN_API_TASK_STATUS_TYPE[2])                
    3.28          except Exception, e:
    3.29              log.exception('Error running Async Task')
    3.30 -            self.error_code = 'INTERNAL ERROR'
    3.31 -            self.error_info = [str(e)]
    3.32 +            self.error_info = ['INTERNAL ERROR', str(e)]
    3.33              self.set_status(XEN_API_TASK_STATUS_TYPE[2])
    3.34  
    3.35          self.task_progress_lock.acquire()
    3.36 @@ -144,7 +141,6 @@ class XendTask(threading.Thread):
    3.37              'progress': self.get_progress(),
    3.38              'type': self.type,
    3.39              'result': self.result,
    3.40 -            'error_code': self.error_code,
    3.41              'error_info': self.error_info,
    3.42              'allowed_operations': {},
    3.43              'session': self.session,