ia64/xen-unstable

changeset 14041:8bcd71c3b495

Replace the X_HANDLE_INVALID error codes with a single HANDLE_INVALID that
names the class as a parameter.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Feb 20 15:24:01 2007 +0000 (2007-02-20)
parents f65a24235f58
children 8773b1a38c83
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	Tue Feb 20 23:54:42 2007 +0000
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Tue Feb 20 15:24:01 2007 +0000
     1.3 @@ -11767,34 +11767,15 @@ Each possible error code is documented i
     1.4  
     1.5  \subsection{Error Codes}
     1.6  
     1.7 -\subsubsection{HOST\_CPU\_HANDLE\_INVALID}
     1.8 -
     1.9 -You gave an invalid host\_cpu handle.  The host\_cpu may have recently been
    1.10 -deleted.  The handle parameter echoes the bad value given.
    1.11 +\subsubsection{HANDLE\_INVALID}
    1.12 +
    1.13 +You gave an invalid handle.  The object may have recently been deleted. 
    1.14 +The class parameter gives the type of reference given, and the handle
    1.15 +parameter echoes the bad value given.
    1.16  
    1.17  \vspace{0.3cm}
    1.18  {\bf Signature:}
    1.19 -\begin{verbatim}HOST_CPU_HANDLE_INVALID(handle)\end{verbatim}
    1.20 -\begin{center}\rule{10em}{0.1pt}\end{center}
    1.21 -
    1.22 -\subsubsection{HOST\_HANDLE\_INVALID}
    1.23 -
    1.24 -You gave an invalid host handle.  The host may have recently been deleted. 
    1.25 -The handle parameter echoes the bad value given.
    1.26 -
    1.27 -\vspace{0.3cm}
    1.28 -{\bf Signature:}
    1.29 -\begin{verbatim}HOST_HANDLE_INVALID(handle)\end{verbatim}
    1.30 -\begin{center}\rule{10em}{0.1pt}\end{center}
    1.31 -
    1.32 -\subsubsection{HOST\_METRICS\_HANDLE\_INVALID}
    1.33 -
    1.34 -You gave an invalid host\_metrics handle.  The host\_metrics may have
    1.35 -recently been deleted.  The handle parameter echoes the bad value given.
    1.36 -
    1.37 -\vspace{0.3cm}
    1.38 -{\bf Signature:}
    1.39 -\begin{verbatim}HOST_METRICS_HANDLE_INVALID(handle)\end{verbatim}
    1.40 +\begin{verbatim}HANDLE_INVALID(class, handle)\end{verbatim}
    1.41  \begin{center}\rule{10em}{0.1pt}\end{center}
    1.42  
    1.43  \subsubsection{INTERNAL\_ERROR}
    1.44 @@ -11854,18 +11835,7 @@ already attached to some other PIF, and 
    1.45  You attempted an operation that was not allowed.
    1.46  
    1.47  \vspace{0.3cm}
    1.48 -{\bf Signature:}
    1.49 -\begin{verbatim}OPERATION_NOT_ALLOWED()\end{verbatim}
    1.50 -\begin{center}\rule{10em}{0.1pt}\end{center}
    1.51 -
    1.52 -\subsubsection{PIF\_HANDLE\_INVALID}
    1.53 -
    1.54 -You gave an invalid PIF handle.  The PIF may have recently been deleted. 
    1.55 -The handle parameter echoes the bad value given.
    1.56 -
    1.57 -\vspace{0.3cm}
    1.58 -{\bf Signature:}
    1.59 -\begin{verbatim}PIF_HANDLE_INVALID(handle)\end{verbatim}
    1.60 +No parameters.
    1.61  \begin{center}\rule{10em}{0.1pt}\end{center}
    1.62  
    1.63  \subsubsection{PIF\_IS\_PHYSICAL}
    1.64 @@ -11879,16 +11849,6 @@ PIF handle you gave.
    1.65  \begin{verbatim}PIF_IS_PHYSICAL(PIF)\end{verbatim}
    1.66  \begin{center}\rule{10em}{0.1pt}\end{center}
    1.67  
    1.68 -\subsubsection{PIF\_METRICS\_HANDLE\_INVALID}
    1.69 -
    1.70 -You gave an invalid PIF\_metrics handle.  The PIF\_metrics may have
    1.71 -recently been deleted.  The handle parameter echoes the bad value given.
    1.72 -
    1.73 -\vspace{0.3cm}
    1.74 -{\bf Signature:}
    1.75 -\begin{verbatim}PIF_METRICS_HANDLE_INVALID(handle)\end{verbatim}
    1.76 -\begin{center}\rule{10em}{0.1pt}\end{center}
    1.77 -
    1.78  \subsubsection{SESSION\_AUTHENTICATION\_FAILED}
    1.79  
    1.80  The credentials given by the user are incorrect, so access has been denied,
    1.81 @@ -11910,26 +11870,6 @@ current connection.  The handle paramete
    1.82  \begin{verbatim}SESSION_INVALID(handle)\end{verbatim}
    1.83  \begin{center}\rule{10em}{0.1pt}\end{center}
    1.84  
    1.85 -\subsubsection{SR\_HANDLE\_INVALID}
    1.86 -
    1.87 -You gave an invalid SR handle.  The SR may have recently been deleted.  The
    1.88 -handle parameter echoes the bad value given.
    1.89 -
    1.90 -\vspace{0.3cm}
    1.91 -{\bf Signature:}
    1.92 -\begin{verbatim}SR_HANDLE_INVALID(handle)\end{verbatim}
    1.93 -\begin{center}\rule{10em}{0.1pt}\end{center}
    1.94 -
    1.95 -\subsubsection{TASK\_HANDLE\_INVALID}
    1.96 -
    1.97 -You gave an invalid task handle.  The task may have recently been deleted. 
    1.98 -The handle parameter echoes the bad value given.
    1.99 -
   1.100 -\vspace{0.3cm}
   1.101 -{\bf Signature:}
   1.102 -\begin{verbatim}TASK_HANDLE_INVALID(handle)\end{verbatim}
   1.103 -\begin{center}\rule{10em}{0.1pt}\end{center}
   1.104 -
   1.105  \subsubsection{VALUE\_NOT\_SUPPORTED}
   1.106  
   1.107  You attempted to set a value that is not supported by this implementation. 
   1.108 @@ -11941,36 +11881,6 @@ returned.  Also returned is a developer-
   1.109  \begin{verbatim}VALUE_NOT_SUPPORTED(field, value, reason)\end{verbatim}
   1.110  \begin{center}\rule{10em}{0.1pt}\end{center}
   1.111  
   1.112 -\subsubsection{VBD\_HANDLE\_INVALID}
   1.113 -
   1.114 -You gave an invalid VBD handle.  The VBD may have recently been deleted. 
   1.115 -The handle parameter echoes the bad value given.
   1.116 -
   1.117 -\vspace{0.3cm}
   1.118 -{\bf Signature:}
   1.119 -\begin{verbatim}VBD_HANDLE_INVALID(handle)\end{verbatim}
   1.120 -\begin{center}\rule{10em}{0.1pt}\end{center}
   1.121 -
   1.122 -\subsubsection{VDI\_HANDLE\_INVALID}
   1.123 -
   1.124 -You gave an invalid VDI handle.  The VDI may have recently been deleted. 
   1.125 -The handle parameter echoes the bad value given.
   1.126 -
   1.127 -\vspace{0.3cm}
   1.128 -{\bf Signature:}
   1.129 -\begin{verbatim}VDI_HANDLE_INVALID(handle)\end{verbatim}
   1.130 -\begin{center}\rule{10em}{0.1pt}\end{center}
   1.131 -
   1.132 -\subsubsection{VIF\_HANDLE\_INVALID}
   1.133 -
   1.134 -You gave an invalid VIF handle.  The VIF may have recently been deleted. 
   1.135 -The handle parameter echoes the bad value given.
   1.136 -
   1.137 -\vspace{0.3cm}
   1.138 -{\bf Signature:}
   1.139 -\begin{verbatim}VIF_HANDLE_INVALID(handle)\end{verbatim}
   1.140 -\begin{center}\rule{10em}{0.1pt}\end{center}
   1.141 -
   1.142  \subsubsection{VLAN\_TAG\_INVALID}
   1.143  
   1.144  You tried to create a VLAN, but the tag you gave was invalid -- it mmust be
   1.145 @@ -11993,36 +11903,6 @@ expected and actual VM state at the time
   1.146  \begin{verbatim}VM_BAD_POWER_STATE(vm, expected, actual)\end{verbatim}
   1.147  \begin{center}\rule{10em}{0.1pt}\end{center}
   1.148  
   1.149 -\subsubsection{VM\_HANDLE\_INVALID}
   1.150 -
   1.151 -You gave an invalid VM handle.  The VM may have recently been deleted.  The
   1.152 -handle parameter echoes the bad value given.
   1.153 -
   1.154 -\vspace{0.3cm}
   1.155 -{\bf Signature:}
   1.156 -\begin{verbatim}VM_HANDLE_INVALID(handle)\end{verbatim}
   1.157 -\begin{center}\rule{10em}{0.1pt}\end{center}
   1.158 -
   1.159 -\subsubsection{VM\_METRICS\_HANDLE\_INVALID}
   1.160 -
   1.161 -You gave an invalid VM\_metrics handle.  The VM\_metrics may have recently
   1.162 -been deleted.  The handle parameter echoes the bad value given.
   1.163 -
   1.164 -\vspace{0.3cm}
   1.165 -{\bf Signature:}
   1.166 -\begin{verbatim}VM_METRICS_HANDLE_INVALID(handle)\end{verbatim}
   1.167 -\begin{center}\rule{10em}{0.1pt}\end{center}
   1.168 -
   1.169 -\subsubsection{VTPM\_HANDLE\_INVALID}
   1.170 -
   1.171 -You gave an invalid VTPM handle.  The VTPM may have recently been deleted. 
   1.172 -The handle parameter echoes the bad value given.
   1.173 -
   1.174 -\vspace{0.3cm}
   1.175 -{\bf Signature:}
   1.176 -\begin{verbatim}VTPM_HANDLE_INVALID(handle)\end{verbatim}
   1.177 -\begin{center}\rule{10em}{0.1pt}\end{center}
   1.178 -
   1.179  
   1.180  
   1.181  \newpage
     2.1 --- a/tools/python/xen/xend/XendAPI.py	Tue Feb 20 23:54:42 2007 +0000
     2.2 +++ b/tools/python/xen/xend/XendAPI.py	Tue Feb 20 15:24:01 2007 +0000
     2.3 @@ -141,11 +141,11 @@ def session_required(func):
     2.4  def _is_valid_ref(ref, validator):
     2.5      return type(ref) == str and validator(ref)
     2.6  
     2.7 -def _check_ref(validator, errcode, func, api, session, ref, *args, **kwargs):
     2.8 +def _check_ref(validator, clas, func, api, session, ref, *args, **kwargs):
     2.9      if _is_valid_ref(ref, validator):
    2.10          return func(api, session, ref, *args, **kwargs)
    2.11      else:
    2.12 -        return xen_api_error([errcode, ref])
    2.13 +        return xen_api_error(['HANDLE_INVALID', clas, ref])
    2.14  
    2.15  
    2.16  def valid_host(func):
    2.17 @@ -156,7 +156,7 @@ def valid_host(func):
    2.18      """
    2.19      return lambda *args, **kwargs: \
    2.20             _check_ref(XendNode.instance().is_valid_host,
    2.21 -                      'HOST_HANDLE_INVALID', func, *args, **kwargs)
    2.22 +                      'host', func, *args, **kwargs)
    2.23  
    2.24  def valid_host_metrics(func):
    2.25      """Decorator to verify if host_metrics_ref is valid before calling
    2.26 @@ -167,7 +167,7 @@ def valid_host_metrics(func):
    2.27      """
    2.28      return lambda *args, **kwargs: \
    2.29             _check_ref(lambda r: r == XendNode.instance().host_metrics_uuid,
    2.30 -                      'HOST_METRICS_HANDLE_INVALID', func, *args, **kwargs)
    2.31 +                      'host_metrics', func, *args, **kwargs)
    2.32  
    2.33  def valid_host_cpu(func):
    2.34      """Decorator to verify if host_cpu_ref is valid before calling method.
    2.35 @@ -177,7 +177,7 @@ def valid_host_cpu(func):
    2.36      """    
    2.37      return lambda *args, **kwargs: \
    2.38             _check_ref(XendNode.instance().is_valid_cpu,
    2.39 -                      'HOST_CPU_HANDLE_INVALID', func, *args, **kwargs)
    2.40 +                      'host_cpu', func, *args, **kwargs)
    2.41  
    2.42  def valid_vm(func):
    2.43      """Decorator to verify if vm_ref is valid before calling method.
    2.44 @@ -187,7 +187,7 @@ def valid_vm(func):
    2.45      """    
    2.46      return lambda *args, **kwargs: \
    2.47             _check_ref(XendDomain.instance().is_valid_vm,
    2.48 -                      'VM_HANDLE_INVALID', func, *args, **kwargs)
    2.49 +                      'VM', func, *args, **kwargs)
    2.50  
    2.51  def valid_network(func):
    2.52      """Decorator to verify if network_ref is valid before calling method.
    2.53 @@ -197,7 +197,7 @@ def valid_network(func):
    2.54      """    
    2.55      return lambda *args, **kwargs: \
    2.56             _check_ref(XendNode.instance().is_valid_network,
    2.57 -                      'NETWORK_HANDLE_INVALID', func, *args, **kwargs)
    2.58 +                      'network', func, *args, **kwargs)
    2.59  
    2.60  def valid_vbd(func):
    2.61      """Decorator to verify if vbd_ref is valid before calling method.
    2.62 @@ -207,7 +207,7 @@ def valid_vbd(func):
    2.63      """    
    2.64      return lambda *args, **kwargs: \
    2.65             _check_ref(lambda r: XendDomain.instance().is_valid_dev('vbd', r),
    2.66 -                      'VBD_HANDLE_INVALID', func, *args, **kwargs)
    2.67 +                      'VBD', func, *args, **kwargs)
    2.68  
    2.69  def valid_vif(func):
    2.70      """Decorator to verify if vif_ref is valid before calling method.
    2.71 @@ -217,7 +217,7 @@ def valid_vif(func):
    2.72      """
    2.73      return lambda *args, **kwargs: \
    2.74             _check_ref(lambda r: XendDomain.instance().is_valid_dev('vif', r),
    2.75 -                      'VIF_HANDLE_INVALID', func, *args, **kwargs)
    2.76 +                      'VIF', func, *args, **kwargs)
    2.77  
    2.78  def valid_vdi(func):
    2.79      """Decorator to verify if vdi_ref is valid before calling method.
    2.80 @@ -227,7 +227,7 @@ def valid_vdi(func):
    2.81      """
    2.82      return lambda *args, **kwargs: \
    2.83             _check_ref(XendNode.instance().is_valid_vdi,
    2.84 -                      'VDI_HANDLE_INVALID', func, *args, **kwargs)
    2.85 +                      'VDI', func, *args, **kwargs)
    2.86  
    2.87  def valid_vtpm(func):
    2.88      """Decorator to verify if vtpm_ref is valid before calling method.
    2.89 @@ -237,7 +237,7 @@ def valid_vtpm(func):
    2.90      """
    2.91      return lambda *args, **kwargs: \
    2.92             _check_ref(lambda r: XendDomain.instance().is_valid_dev('vtpm', r),
    2.93 -                      'VTPM_HANDLE_INVALID', func, *args, **kwargs)
    2.94 +                      'VTPM', func, *args, **kwargs)
    2.95  
    2.96  
    2.97  def valid_console(func):
    2.98 @@ -249,7 +249,7 @@ def valid_console(func):
    2.99      return lambda *args, **kwargs: \
   2.100             _check_ref(lambda r: XendDomain.instance().is_valid_dev('console',
   2.101                                                                     r),
   2.102 -                      'CONSOLE_HANDLE_INVALID', func, *args, **kwargs)
   2.103 +                      'console', func, *args, **kwargs)
   2.104  
   2.105  def valid_sr(func):
   2.106      """Decorator to verify if sr_ref is valid before calling method.
   2.107 @@ -259,7 +259,7 @@ def valid_sr(func):
   2.108      """
   2.109      return lambda *args, **kwargs: \
   2.110             _check_ref(lambda r: XendNode.instance().is_valid_sr,
   2.111 -                      'SR_HANDLE_INVALID', func, *args, **kwargs)
   2.112 +                      'SR', func, *args, **kwargs)
   2.113  
   2.114  def valid_pif(func):
   2.115      """Decorator to verify if pif_ref is valid before calling
   2.116 @@ -270,7 +270,7 @@ def valid_pif(func):
   2.117      """
   2.118      return lambda *args, **kwargs: \
   2.119             _check_ref(lambda r: r in XendNode.instance().pifs,
   2.120 -                      'PIF_HANDLE_INVALID', func, *args, **kwargs)
   2.121 +                      'PIF', func, *args, **kwargs)
   2.122  
   2.123  def valid_pif_metrics(func):
   2.124      """Decorator to verify if pif_metrics_ref is valid before calling
   2.125 @@ -281,7 +281,7 @@ def valid_pif_metrics(func):
   2.126      """
   2.127      return lambda *args, **kwargs: \
   2.128             _check_ref(lambda r: r in XendNode.instance().pif_metrics,
   2.129 -                      'PIF_METRICS_HANDLE_INVALID', func, *args, **kwargs)
   2.130 +                      'PIF_metrics', func, *args, **kwargs)
   2.131  
   2.132  def valid_task(func):
   2.133      """Decorator to verify if task_ref is valid before calling
   2.134 @@ -292,7 +292,7 @@ def valid_task(func):
   2.135      """
   2.136      return lambda *args, **kwargs: \
   2.137             _check_ref(XendTaskManager.get_task,
   2.138 -                      'TASK_HANDLE_INVALID', func, *args, **kwargs)
   2.139 +                      'task', func, *args, **kwargs)
   2.140  
   2.141  def valid_debug(func):
   2.142      """Decorator to verify if task_ref is valid before calling
   2.143 @@ -303,7 +303,7 @@ def valid_debug(func):
   2.144      """
   2.145      return lambda *args, **kwargs: \
   2.146             _check_ref(lambda r: r in XendAPI._debug,
   2.147 -                      'TASK_HANDLE_INVALID', func, *args, **kwargs)
   2.148 +                      'debug', func, *args, **kwargs)
   2.149  
   2.150  # -----------------------------
   2.151  # Bridge to Legacy XM API calls
   2.152 @@ -908,7 +908,7 @@ class XendAPI(object):
   2.153                  return xen_api_success(
   2.154                      node.PIF_create_VLAN(ref, network, vlan))
   2.155              else:
   2.156 -                return xen_api_error(['NETWORK_HANDLE_INVALID', network])
   2.157 +                return xen_api_error(['HANDLE_INVALID', 'network', network])
   2.158          except NetworkAlreadyConnected, exn:
   2.159              return xen_api_error(['NETWORK_ALREADY_CONNECTED',
   2.160                                    network, exn.pif_uuid])
   2.161 @@ -1352,7 +1352,7 @@ class XendAPI(object):
   2.162          xendom = XendDomain.instance()
   2.163          xeninfo = xendom.get_vm_by_uuid(vm_ref)
   2.164          if not xeninfo:
   2.165 -            return xen_api_error(['VM_HANDLE_INVALID', vm_ref])
   2.166 +            return xen_api_error(['HANDLE_INVALID', 'VM', vm_ref])
   2.167          
   2.168          record = {
   2.169              'uuid': xeninfo.get_uuid(),
   2.170 @@ -1469,10 +1469,10 @@ class XendAPI(object):
   2.171          xendom = XendDomain.instance()
   2.172          vm = xendom.get_vm_with_dev_uuid('vbd', vbd_ref)
   2.173          if not vm:
   2.174 -            return xen_api_error(['VBD_HANDLE_INVALID', vbd_ref])
   2.175 +            return xen_api_error(['HANDLE_INVALID', 'VBD', vbd_ref])
   2.176          cfg = vm.get_dev_xenapi_config('vbd', vbd_ref)
   2.177          if not cfg:
   2.178 -            return xen_api_error(['VBD_HANDLE_INVALID', vbd_ref])
   2.179 +            return xen_api_error(['HANDLE_INVALID', 'VBD', vbd_ref])
   2.180  
   2.181          valid_vbd_keys = self.VBD_attr_ro + self.VBD_attr_rw + \
   2.182                           self.Base_attr_ro + self.Base_attr_rw
   2.183 @@ -1491,7 +1491,7 @@ class XendAPI(object):
   2.184      def VBD_create(self, session, vbd_struct):
   2.185          xendom = XendDomain.instance()
   2.186          if not xendom.is_valid_vm(vbd_struct['VM']):
   2.187 -            return xen_api_error(['VM_HANDLE_INVALID', vbd_struct['VM']])
   2.188 +            return xen_api_error(['HANDLE_INVALID', 'VM', vbd_struct['VM']])
   2.189          
   2.190          dom = xendom.get_vm_by_uuid(vbd_struct['VM'])
   2.191          vbd_ref = ''
   2.192 @@ -1500,7 +1500,7 @@ class XendAPI(object):
   2.193              vdi_ref = vbd_struct.get('VDI')
   2.194              vdi = XendNode.instance().get_vdi_by_uuid(vdi_ref)
   2.195              if not vdi:
   2.196 -                return xen_api_error(['VDI_HANDLE_INVALID', vdi_ref])
   2.197 +                return xen_api_error(['HANDLE_INVALID', 'VDI', vdi_ref])
   2.198              vdi_image = vdi.get_location()
   2.199              vbd_ref = XendTask.log_progress(0, 100,
   2.200                                              dom.create_vbd,
   2.201 @@ -1516,7 +1516,7 @@ class XendAPI(object):
   2.202          xendom = XendDomain.instance()
   2.203          vm = xendom.get_vm_with_dev_uuid('vbd', vbd_ref)
   2.204          if not vm:
   2.205 -            return xen_api_error(['VBD_HANDLE_INVALID', vbd_ref])
   2.206 +            return xen_api_error(['HANDLE_INVALID', 'VBD', vbd_ref])
   2.207  
   2.208          XendTask.log_progress(0, 100, vm.destroy_vbd, vbd_ref)
   2.209          return xen_api_success_void()
   2.210 @@ -1586,10 +1586,10 @@ class XendAPI(object):
   2.211          xendom = XendDomain.instance()
   2.212          vm = xendom.get_vm_with_dev_uuid('vif', vif_ref)
   2.213          if not vm:
   2.214 -            return xen_api_error(['VIF_HANDLE_INVALID', vif_ref])
   2.215 +            return xen_api_error(['HANDLE_INVALID', 'VIF', vif_ref])
   2.216          cfg = vm.get_dev_xenapi_config('vif', vif_ref)
   2.217          if not cfg:
   2.218 -            return xen_api_error(['VIF_HANDLE_INVALID', vif_ref])
   2.219 +            return xen_api_error(['HANDLE_INVALID', 'VIF', vif_ref])
   2.220          
   2.221          valid_vif_keys = self.VIF_attr_ro + self.VIF_attr_rw + \
   2.222                           self.Base_attr_ro + self.Base_attr_rw
   2.223 @@ -1613,14 +1613,14 @@ class XendAPI(object):
   2.224              except XendError:
   2.225                  return xen_api_error(XEND_ERROR_TODO)
   2.226          else:
   2.227 -            return xen_api_error(['VM_HANDLE_INVALID', vif_struct['VM']])
   2.228 +            return xen_api_error(['HANDLE_INVALID', 'VM', vif_struct['VM']])
   2.229  
   2.230  
   2.231      def VIF_destroy(self, session, vif_ref):
   2.232          xendom = XendDomain.instance()
   2.233          vm = xendom.get_vm_with_dev_uuid('vif', vif_ref)
   2.234          if not vm:
   2.235 -            return xen_api_error(['VIF_HANDLE_INVALID', vif_ref])
   2.236 +            return xen_api_error(['HANDLE_INVALID', 'VIF', vif_ref])
   2.237  
   2.238          vm.destroy_vif(vif_ref)
   2.239          return xen_api_success_void()
   2.240 @@ -1766,7 +1766,7 @@ class XendAPI(object):
   2.241          sr_ref = vdi_struct.get('SR')
   2.242          xennode = XendNode.instance()
   2.243          if not xennode.is_valid_sr(sr_ref):
   2.244 -            return xen_api_error(['SR_HANDLE_INVALID', sr_ref])
   2.245 +            return xen_api_error(['HANDLE_INVALID', 'SR', sr_ref])
   2.246  
   2.247          vdi_uuid = xennode.srs[sr_ref].create_vdi(vdi_struct)
   2.248          return xen_api_success(vdi_uuid)
   2.249 @@ -1797,10 +1797,10 @@ class XendAPI(object):
   2.250          xendom = XendDomain.instance()
   2.251          vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
   2.252          if not vm:
   2.253 -            return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
   2.254 +            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
   2.255          cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref)
   2.256          if not cfg:
   2.257 -            return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
   2.258 +            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
   2.259          valid_vtpm_keys = self.VTPM_attr_ro + self.VTPM_attr_rw + \
   2.260                            self.Base_attr_ro + self.Base_attr_rw
   2.261          return_cfg = {}
   2.262 @@ -1815,10 +1815,10 @@ class XendAPI(object):
   2.263          xendom = XendDomain.instance()
   2.264          vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
   2.265          if not vm:
   2.266 -            return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
   2.267 +            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
   2.268          cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref)
   2.269          if not cfg:
   2.270 -            return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
   2.271 +            return xen_api_error(['HANDLE_INVALID', 'VTPM', vtpm_ref])
   2.272          if not cfg.has_key('backend'):
   2.273              return xen_api_error(['VTPM backend not set'])
   2.274          return xen_api_success(cfg['backend'])
   2.275 @@ -1841,7 +1841,7 @@ class XendAPI(object):
   2.276              tpmif.destroy_vtpmstate(dom.getName())
   2.277              return xen_api_success(True)
   2.278          else:
   2.279 -            return xen_api_error(['VM_HANDLE_INVALID', vtpm_struct['VM']])
   2.280 +            return xen_api_error(['HANDLE_INVALID', 'VM', vtpm_struct['VM']])
   2.281  
   2.282      # class methods
   2.283      def VTPM_create(self, session, vtpm_struct):
   2.284 @@ -1855,7 +1855,7 @@ class XendAPI(object):
   2.285              except XendError:
   2.286                  return xen_api_error(XEND_ERROR_TODO)
   2.287          else:
   2.288 -            return xen_api_error(['VM_HANDLE_INVALID', vtpm_struct['VM']])
   2.289 +            return xen_api_error(['HANDLE_INVALID', 'VM', vtpm_struct['VM']])
   2.290  
   2.291      def VTPM_get_all(self, session):
   2.292          xendom = XendDomain.instance()
   2.293 @@ -1897,10 +1897,10 @@ class XendAPI(object):
   2.294          xendom = XendDomain.instance()
   2.295          vm = xendom.get_vm_with_dev_uuid('console', console_ref)
   2.296          if not vm:
   2.297 -            return xen_api_error(['CONSOLE_HANDLE_INVALID', console_ref])
   2.298 +            return xen_api_error(['HANDLE_INVALID', 'console', console_ref])
   2.299          cfg = vm.get_dev_xenapi_config('console', console_ref)
   2.300          if not cfg:
   2.301 -            return xen_api_error(['CONSOLE_HANDLE_INVALID', console_ref])
   2.302 +            return xen_api_error(['HANDLE_INVALID', 'console', console_ref])
   2.303          
   2.304          valid_console_keys = self.console_attr_ro + self.console_attr_rw + \
   2.305                               self.Base_attr_ro + self.Base_attr_rw
   2.306 @@ -1915,7 +1915,8 @@ class XendAPI(object):
   2.307      def console_create(self, session, console_struct):
   2.308          xendom = XendDomain.instance()
   2.309          if not xendom.is_valid_vm(console_struct['VM']):
   2.310 -            return xen_api_error(['VM_HANDLE_INVALID', console_struct['VM']])
   2.311 +            return xen_api_error(['HANDLE_INVALID', 'VM',
   2.312 +                                  console_struct['VM']])
   2.313          
   2.314          dom = xendom.get_vm_by_uuid(console_struct['VM'])
   2.315          try:
   2.316 @@ -1972,7 +1973,7 @@ class XendAPI(object):
   2.317          sr = XendNode.instance().get_sr(sr_ref)
   2.318          if sr:
   2.319              return xen_api_success(sr.get_record())
   2.320 -        return xen_api_error(['SR_HANDLE_INVALID', sr_ref])
   2.321 +        return xen_api_error(['HANDLE_INVALID', 'SR', sr_ref])
   2.322  
   2.323      # Attribute acceess
   2.324  
     3.1 --- a/tools/python/xen/xm/messages/en/xen-xm.po	Tue Feb 20 23:54:42 2007 +0000
     3.2 +++ b/tools/python/xen/xm/messages/en/xen-xm.po	Tue Feb 20 15:24:01 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-31 12:34+0000\n"
     3.8 +"PO-Revision-Date: 2007-02-20 15:22+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 @@ -44,44 +44,8 @@ msgstr "Permission denied."
    3.13  msgid "VALUE_NOT_SUPPORTED"
    3.14  msgstr "Value \"%(2)s\" for %(1)s is not supported by this server.  The server said \"%(3)s\"."
    3.15  
    3.16 -msgid "HOST_CPU_HANDLE_INVALID"
    3.17 -msgstr "The host_cpu handle %(1)s is invalid."
    3.18 -
    3.19 -msgid "HOST_HANDLE_INVALID"
    3.20 -msgstr "The host handle %(1)s is invalid."
    3.21 -
    3.22 -msgid "HOST_METRICS_HANDLE_INVALID"
    3.23 -msgstr "The host_metrics handle %(1)s is invalid."
    3.24 -
    3.25 -msgid "PIF_HANDLE_INVALID"
    3.26 -msgstr "The PIF handle %(1)s is invalid."
    3.27 -
    3.28 -msgid "PIF_METRICS_HANDLE_INVALID"
    3.29 -msgstr "The PIF_METRICS handle %(1)s is invalid."
    3.30 -
    3.31 -msgid "SR_HANDLE_INVALID"
    3.32 -msgstr "The SR handle %(1)s is invalid."
    3.33 -
    3.34 -msgid "TASK_HANDLE_INVALID"
    3.35 -msgstr "The task handle %(1)s is invalid."
    3.36 -
    3.37 -msgid "VBD_HANDLE_INVALID"
    3.38 -msgstr "The VBD handle %(1)s is invalid."
    3.39 -
    3.40 -msgid "VDI_HANDLE_INVALID"
    3.41 -msgstr "The VDI handle %(1)s is invalid."
    3.42 -
    3.43 -msgid "VIF_HANDLE_INVALID"
    3.44 -msgstr "The VIF handle %(1)s is invalid."
    3.45 -
    3.46 -msgid "VM_HANDLE_INVALID"
    3.47 -msgstr "The VM handle %(1)s is invalid."
    3.48 -
    3.49 -msgid "VM_METRICS_HANDLE_INVALID"
    3.50 -msgstr "The VM_metrics handle %(1)s is invalid."
    3.51 -
    3.52 -msgid "VTPM_HANDLE_INVALID"
    3.53 -msgstr "The VTPM handle %(1)s is invalid."
    3.54 +msgid "HANDLE_INVALID"
    3.55 +msgstr "The %(1)s handle %(2)s is invalid."
    3.56  
    3.57  msgid "OPERATION_NOT_ALLOWED"
    3.58  msgstr "You attempted an operation that was not allowed."