direct-io.hg

changeset 14342:e5d7b878118f

Added an VM_HVM_REQUIRED error code, and use it on VM.start.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Sat Mar 10 23:22:00 2007 +0000 (2007-03-10)
parents 0affe03ee985
children 8a01644306ee
files docs/xen-api/xenapi-datamodel.tex tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/XendError.py tools/python/xen/xend/image.py tools/python/xen/xm/messages/en/xen-xm.po
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Sat Mar 10 21:48:22 2007 +0000
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Sat Mar 10 23:22:00 2007 +0000
     1.3 @@ -1141,7 +1141,8 @@ void
     1.4  
     1.5  \vspace{0.3cm}
     1.6  
     1.7 -\noindent{\bf Possible Error Codes:} {\tt VM\_BAD\_POWER\_STATE}
     1.8 +\noindent{\bf Possible Error Codes:} {\tt VM\_BAD\_POWER\_STATE}, {\tt
     1.9 +VM\_HVM\_REQUIRED}
    1.10  
    1.11  \vspace{0.6cm}
    1.12  \subsubsection{RPC name:~pause}
    1.13 @@ -13337,6 +13338,15 @@ expected and actual VM state at the time
    1.14  \begin{verbatim}VM_BAD_POWER_STATE(vm, expected, actual)\end{verbatim}
    1.15  \begin{center}\rule{10em}{0.1pt}\end{center}
    1.16  
    1.17 +\subsubsection{VM\_HVM\_REQUIRED}
    1.18 +
    1.19 +HVM is required for this operation
    1.20 +
    1.21 +\vspace{0.3cm}
    1.22 +{\bf Signature:}
    1.23 +\begin{verbatim}VM_HVM_REQUIRED(vm)\end{verbatim}
    1.24 +\begin{center}\rule{10em}{0.1pt}\end{center}
    1.25 +
    1.26  
    1.27  
    1.28  \newpage
     2.1 --- a/tools/python/xen/xend/XendAPI.py	Sat Mar 10 21:48:22 2007 +0000
     2.2 +++ b/tools/python/xen/xend/XendAPI.py	Sat Mar 10 23:22:00 2007 +0000
     2.3 @@ -1465,10 +1465,13 @@ class XendAPI(object):
     2.4                                       start_paused = start_paused)
     2.5      
     2.6      def VM_start(self, session, vm_ref, start_paused):
     2.7 -        return XendTask.log_progress(0, 100, do_vm_func,
     2.8 -                                     "domain_start", vm_ref,
     2.9 -                                     start_paused = start_paused)
    2.10 -    
    2.11 +        try:
    2.12 +            return XendTask.log_progress(0, 100, do_vm_func,
    2.13 +                                         "domain_start", vm_ref,
    2.14 +                                         start_paused = start_paused)
    2.15 +        except HVMRequired, exn:
    2.16 +            return xen_api_error(['VM_HVM_REQUIRED', vm_ref])
    2.17 +
    2.18      def VM_suspend(self, session, vm_ref):
    2.19          return XendTask.log_progress(0, 100, do_vm_func,
    2.20                                       "domain_suspend", vm_ref)
     3.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Sat Mar 10 21:48:22 2007 +0000
     3.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Sat Mar 10 23:22:00 2007 +0000
     3.3 @@ -1489,7 +1489,12 @@ class XendDomainInfo:
     3.4              self.info['start_time'] = time.time()
     3.5  
     3.6              self._stateSet(DOM_STATE_RUNNING)
     3.7 -        except (RuntimeError, VmError), exn:
     3.8 +        except VmError, exn:
     3.9 +            log.exception("XendDomainInfo.initDomain: exception occurred")
    3.10 +            if self.image:
    3.11 +                self.image.cleanupBootloading()
    3.12 +            raise exn
    3.13 +        except RuntimeError, exn:
    3.14              log.exception("XendDomainInfo.initDomain: exception occurred")
    3.15              if self.image:
    3.16                  self.image.cleanupBootloading()
     4.1 --- a/tools/python/xen/xend/XendError.py	Sat Mar 10 21:48:22 2007 +0000
     4.2 +++ b/tools/python/xen/xend/XendError.py	Sat Mar 10 23:22:00 2007 +0000
     4.3 @@ -13,6 +13,7 @@
     4.4  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     4.5  #============================================================================
     4.6  # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
     4.7 +# Copyright (c) 2006, 2007 XenSource Inc.
     4.8  #============================================================================
     4.9  
    4.10  from xmlrpclib import Fault
    4.11 @@ -55,6 +56,12 @@ class VmError(XendError):
    4.12      """Vm construction error."""
    4.13      pass
    4.14  
    4.15 +class HVMRequired(VmError):
    4.16 +    def __init__(self):
    4.17 +        XendError.__init__(self,
    4.18 +                           'HVM guest support is unavailable: is VT/AMD-V '
    4.19 +                           'supported by your CPU and enabled in your BIOS?')
    4.20 +
    4.21  
    4.22  XEND_ERROR_AUTHENTICATION_FAILED = ('ELUSER', 'Authentication Failed')
    4.23  XEND_ERROR_SESSION_INVALID       = ('EPERMDENIED', 'Session Invalid')
     5.1 --- a/tools/python/xen/xend/image.py	Sat Mar 10 21:48:22 2007 +0000
     5.2 +++ b/tools/python/xen/xend/image.py	Sat Mar 10 23:22:00 2007 +0000
     5.3 @@ -24,7 +24,7 @@ import signal
     5.4  
     5.5  import xen.lowlevel.xc
     5.6  from xen.xend.XendConstants import REVERSE_DOMAIN_SHUTDOWN_REASONS
     5.7 -from xen.xend.XendError import VmError, XendError
     5.8 +from xen.xend.XendError import VmError, XendError, HVMRequired
     5.9  from xen.xend.XendLogging import log
    5.10  from xen.xend.XendOptions import instance as xenopts
    5.11  from xen.xend.server.netif import randomMAC
    5.12 @@ -274,8 +274,7 @@ class HVMImageHandler(ImageHandler):
    5.13  
    5.14          info = xc.xeninfo()
    5.15          if 'hvm' not in info['xen_caps']:
    5.16 -            raise VmError("HVM guest support is unavailable: is VT/AMD-V "
    5.17 -                          "supported by your CPU and enabled in your BIOS?")
    5.18 +            raise HVMRequired()
    5.19  
    5.20          self.dmargs = self.parseDeviceModelArgs(vmConfig)
    5.21          self.device_model = vmConfig['platform'].get('device_model')
     6.1 --- a/tools/python/xen/xm/messages/en/xen-xm.po	Sat Mar 10 21:48:22 2007 +0000
     6.2 +++ b/tools/python/xen/xm/messages/en/xen-xm.po	Sat Mar 10 23:22:00 2007 +0000
     6.3 @@ -19,7 +19,7 @@
     6.4  msgid ""
     6.5  msgstr ""
     6.6  "Project-Id-Version: Xen-xm 3.0\n"
     6.7 -"PO-Revision-Date: 2007-02-20 15:22+0000\n"
     6.8 +"PO-Revision-Date: 2007-03-10 23:17+0000\n"
     6.9  "Last-Translator: Ewan Mellor <ewan@xensource.com>\n"
    6.10  "Language-Team: xen-devel <xen-devel@lists.xensource.com>\n"
    6.11  "MIME-Version: 1.0\n"
    6.12 @@ -61,3 +61,6 @@ msgstr "The VLAN tag you gave (%(1)s) is
    6.13  
    6.14  msgid "VM_BAD_POWER_STATE"
    6.15  msgstr "The VM must be %(2)s to perform the requested operation (it is currently %(3)s)."
    6.16 +
    6.17 +msgid "VM_HVM_REQUIRED"
    6.18 +msgstr "HVM guest support is unavailable: is VT/AMD-V supported by your CPU and enabled in your BIOS?"