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

[Xen-changelog] [xen-unstable] Added an VM_HVM_REQUIRED error code, and use it on VM.start.



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1173568920 0
# Node ID e5d7b878118f0895b4e81e1122ba73beb25bdfe7
# Parent  0affe03ee985ddad617d1f7b23828574cc89f324
Added an VM_HVM_REQUIRED error code, and use it on VM.start.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex         |   12 +++++++++++-
 tools/python/xen/xend/XendAPI.py          |   11 +++++++----
 tools/python/xen/xend/XendDomainInfo.py   |    7 ++++++-
 tools/python/xen/xend/XendError.py        |    7 +++++++
 tools/python/xen/xend/image.py            |    5 ++---
 tools/python/xen/xm/messages/en/xen-xm.po |    5 ++++-
 6 files changed, 37 insertions(+), 10 deletions(-)

diff -r 0affe03ee985 -r e5d7b878118f docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Sat Mar 10 21:48:22 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Sat Mar 10 23:22:00 2007 +0000
@@ -1141,7 +1141,8 @@ void
 
 \vspace{0.3cm}
 
-\noindent{\bf Possible Error Codes:} {\tt VM\_BAD\_POWER\_STATE}
+\noindent{\bf Possible Error Codes:} {\tt VM\_BAD\_POWER\_STATE}, {\tt
+VM\_HVM\_REQUIRED}
 
 \vspace{0.6cm}
 \subsubsection{RPC name:~pause}
@@ -13337,6 +13338,15 @@ expected and actual VM state at the time
 \begin{verbatim}VM_BAD_POWER_STATE(vm, expected, actual)\end{verbatim}
 \begin{center}\rule{10em}{0.1pt}\end{center}
 
+\subsubsection{VM\_HVM\_REQUIRED}
+
+HVM is required for this operation
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}VM_HVM_REQUIRED(vm)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
 
 
 \newpage
diff -r 0affe03ee985 -r e5d7b878118f tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Sat Mar 10 21:48:22 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Sat Mar 10 23:22:00 2007 +0000
@@ -1465,10 +1465,13 @@ class XendAPI(object):
                                      start_paused = start_paused)
     
     def VM_start(self, session, vm_ref, start_paused):
-        return XendTask.log_progress(0, 100, do_vm_func,
-                                     "domain_start", vm_ref,
-                                     start_paused = start_paused)
-    
+        try:
+            return XendTask.log_progress(0, 100, do_vm_func,
+                                         "domain_start", vm_ref,
+                                         start_paused = start_paused)
+        except HVMRequired, exn:
+            return xen_api_error(['VM_HVM_REQUIRED', vm_ref])
+
     def VM_suspend(self, session, vm_ref):
         return XendTask.log_progress(0, 100, do_vm_func,
                                      "domain_suspend", vm_ref)
diff -r 0affe03ee985 -r e5d7b878118f tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Sat Mar 10 21:48:22 2007 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Sat Mar 10 23:22:00 2007 +0000
@@ -1489,7 +1489,12 @@ class XendDomainInfo:
             self.info['start_time'] = time.time()
 
             self._stateSet(DOM_STATE_RUNNING)
-        except (RuntimeError, VmError), exn:
+        except VmError, exn:
+            log.exception("XendDomainInfo.initDomain: exception occurred")
+            if self.image:
+                self.image.cleanupBootloading()
+            raise exn
+        except RuntimeError, exn:
             log.exception("XendDomainInfo.initDomain: exception occurred")
             if self.image:
                 self.image.cleanupBootloading()
diff -r 0affe03ee985 -r e5d7b878118f tools/python/xen/xend/XendError.py
--- a/tools/python/xen/xend/XendError.py        Sat Mar 10 21:48:22 2007 +0000
+++ b/tools/python/xen/xend/XendError.py        Sat Mar 10 23:22:00 2007 +0000
@@ -13,6 +13,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #============================================================================
 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@xxxxxx>
+# Copyright (c) 2006, 2007 XenSource Inc.
 #============================================================================
 
 from xmlrpclib import Fault
@@ -55,6 +56,12 @@ class VmError(XendError):
     """Vm construction error."""
     pass
 
+class HVMRequired(VmError):
+    def __init__(self):
+        XendError.__init__(self,
+                           'HVM guest support is unavailable: is VT/AMD-V '
+                           'supported by your CPU and enabled in your BIOS?')
+
 
 XEND_ERROR_AUTHENTICATION_FAILED = ('ELUSER', 'Authentication Failed')
 XEND_ERROR_SESSION_INVALID       = ('EPERMDENIED', 'Session Invalid')
diff -r 0affe03ee985 -r e5d7b878118f tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Sat Mar 10 21:48:22 2007 +0000
+++ b/tools/python/xen/xend/image.py    Sat Mar 10 23:22:00 2007 +0000
@@ -24,7 +24,7 @@ import signal
 
 import xen.lowlevel.xc
 from xen.xend.XendConstants import REVERSE_DOMAIN_SHUTDOWN_REASONS
-from xen.xend.XendError import VmError, XendError
+from xen.xend.XendError import VmError, XendError, HVMRequired
 from xen.xend.XendLogging import log
 from xen.xend.XendOptions import instance as xenopts
 from xen.xend.server.netif import randomMAC
@@ -274,8 +274,7 @@ class HVMImageHandler(ImageHandler):
 
         info = xc.xeninfo()
         if 'hvm' not in info['xen_caps']:
-            raise VmError("HVM guest support is unavailable: is VT/AMD-V "
-                          "supported by your CPU and enabled in your BIOS?")
+            raise HVMRequired()
 
         self.dmargs = self.parseDeviceModelArgs(vmConfig)
         self.device_model = vmConfig['platform'].get('device_model')
diff -r 0affe03ee985 -r e5d7b878118f tools/python/xen/xm/messages/en/xen-xm.po
--- a/tools/python/xen/xm/messages/en/xen-xm.po Sat Mar 10 21:48:22 2007 +0000
+++ b/tools/python/xen/xm/messages/en/xen-xm.po Sat Mar 10 23:22:00 2007 +0000
@@ -19,7 +19,7 @@ msgid ""
 msgid ""
 msgstr ""
 "Project-Id-Version: Xen-xm 3.0\n"
-"PO-Revision-Date: 2007-02-20 15:22+0000\n"
+"PO-Revision-Date: 2007-03-10 23:17+0000\n"
 "Last-Translator: Ewan Mellor <ewan@xxxxxxxxxxxxx>\n"
 "Language-Team: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>\n"
 "MIME-Version: 1.0\n"
@@ -61,3 +61,6 @@ msgstr "The VLAN tag you gave (%(1)s) is
 
 msgid "VM_BAD_POWER_STATE"
 msgstr "The VM must be %(2)s to perform the requested operation (it is 
currently %(3)s)."
+
+msgid "VM_HVM_REQUIRED"
+msgstr "HVM guest support is unavailable: is VT/AMD-V supported by your CPU 
and enabled in your BIOS?"

_______________________________________________
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®.