* [PATCH] fix xend 'rename-restart' behavior
@ 2008-01-24 22:37 Jim Fehlig
2008-01-25 1:11 ` John Levon
0 siblings, 1 reply; 3+ messages in thread
From: Jim Fehlig @ 2008-01-24 22:37 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 210 bytes --]
Given no objections to
http://lists.xensource.com/archives/html/xen-devel/2008-01/msg00838.html
attached are patches that (re)introduce crashed power state and fix
issues with 'rename-restart'.
Regards,
Jim
[-- Attachment #2: xend_crashed_ps.patch --]
[-- Type: text/x-patch, Size: 8611 bytes --]
# HG changeset patch
# User Jim Fehlig <jfehlig@novell.com>
# Date 1201213239 25200
# Node ID cc85865f26a7cbced1d171fd52da224dca066a98
# Parent 31adb5c972d03e45cb746cd2305126ea2571282f
(Re)introduce notion of crashed VM power state.
The crashed power state is necessary to allow both core-dumping a crashed
but preserved VM and renaming/restarting a crashed VM.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
diff -r 31adb5c972d0 -r cc85865f26a7 docs/xen-api/vm-lifecycle.tex
--- a/docs/xen-api/vm-lifecycle.tex Thu Jan 24 14:41:26 2008 +0000
+++ b/docs/xen-api/vm-lifecycle.tex Thu Jan 24 15:20:39 2008 -0700
@@ -21,7 +21,10 @@
\end{figure}
Figure~\ref{fig-vm-lifecycle} shows the states that a VM can be in
-and the API calls that can be used to move the VM between these states.
+and the API calls that can be used to move the VM between these states. The crashed
+state indicates that the guest OS running within the VM has crashed. There is no
+API to explicitly move to the crashed state, however a hardShutdown will move the
+VM to the powered down state.
\section{VM boot parameters}
diff -r 31adb5c972d0 -r cc85865f26a7 docs/xen-api/vm_lifecycle.dot
--- a/docs/xen-api/vm_lifecycle.dot Thu Jan 24 14:41:26 2008 +0000
+++ b/docs/xen-api/vm_lifecycle.dot Thu Jan 24 15:20:39 2008 -0700
@@ -1,6 +1,6 @@ digraph g{
digraph g{
-node [shape=box]; "powered down" paused running suspended;
+node [shape=box]; "powered down" paused running suspended crashed;
"powered down" -> paused [label="start(paused=true)"];
"powered down" -> running [label="start(paused=false)"];
@@ -11,5 +11,7 @@ paused -> running [label="resume"];
paused -> running [label="resume"];
running -> "powered down" [label="cleanShutdown /\nhardShutdown"];
running -> paused [label="pause"];
+running -> crashed [label="guest OS crash"]
+crashed -> "powered down" [label="hardShutdown"]
}
\ No newline at end of file
diff -r 31adb5c972d0 -r cc85865f26a7 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Thu Jan 24 14:41:26 2008 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Thu Jan 24 15:20:39 2008 -0700
@@ -156,6 +156,7 @@ The following enumeration types are used
\hspace{0.5cm}{\tt Paused} & Paused \\
\hspace{0.5cm}{\tt Running} & Running \\
\hspace{0.5cm}{\tt Suspended} & Suspended \\
+\hspace{0.5cm}{\tt Crashed} & Crashed \\
\hspace{0.5cm}{\tt Unknown} & Some other unknown state \\
\hline
\end{longtable}
diff -r 31adb5c972d0 -r cc85865f26a7 tools/libxen/include/xen/api/xen_vm_power_state.h
--- a/tools/libxen/include/xen/api/xen_vm_power_state.h Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/libxen/include/xen/api/xen_vm_power_state.h Thu Jan 24 15:20:39 2008 -0700
@@ -46,6 +46,11 @@ enum xen_vm_power_state
XEN_VM_POWER_STATE_SUSPENDED,
/**
+ * Crashed
+ */
+ XEN_VM_POWER_STATE_CRASHED,
+
+ /**
* Some other unknown state
*/
XEN_VM_POWER_STATE_UNKNOWN
diff -r 31adb5c972d0 -r cc85865f26a7 tools/libxen/src/xen_vm_power_state.c
--- a/tools/libxen/src/xen_vm_power_state.c Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/libxen/src/xen_vm_power_state.c Thu Jan 24 15:20:39 2008 -0700
@@ -32,6 +32,7 @@ static const char *lookup_table[] =
"Paused",
"Running",
"Suspended",
+ "Crashed",
"Unknown"
};
diff -r 31adb5c972d0 -r cc85865f26a7 tools/python/xen/xend/XendAPIConstants.py
--- a/tools/python/xen/xend/XendAPIConstants.py Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/python/xen/xend/XendAPIConstants.py Thu Jan 24 15:20:39 2008 -0700
@@ -25,6 +25,7 @@ XEN_API_VM_POWER_STATE = [
'Running',
'Suspended',
'Halted',
+ 'Crashed',
'Unknown'
]
@@ -33,7 +34,8 @@ XEN_API_VM_POWER_STATE_RUNNING = 2
XEN_API_VM_POWER_STATE_RUNNING = 2
XEN_API_VM_POWER_STATE_SUSPENDED = 3
XEN_API_VM_POWER_STATE_SHUTTINGDOWN = 4
-XEN_API_VM_POWER_STATE_UNKNOWN = 5
+XEN_API_VM_POWER_STATE_CRASHED = 5
+XEN_API_VM_POWER_STATE_UNKNOWN = 6
XEN_API_ON_NORMAL_EXIT = [
'destroy',
diff -r 31adb5c972d0 -r cc85865f26a7 tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/python/xen/xend/XendConstants.py Thu Jan 24 15:20:39 2008 -0700
@@ -61,6 +61,7 @@ DOM_STATES = [
'running',
'suspended',
'shutdown',
+ 'crashed',
'unknown',
]
@@ -69,6 +70,7 @@ DOM_STATE_RUNNING = XEN_API_VM_POWER_STA
DOM_STATE_RUNNING = XEN_API_VM_POWER_STATE_RUNNING
DOM_STATE_SUSPENDED = XEN_API_VM_POWER_STATE_SUSPENDED
DOM_STATE_SHUTDOWN = XEN_API_VM_POWER_STATE_SHUTTINGDOWN
+DOM_STATE_CRASHED = XEN_API_VM_POWER_STATE_CRASHED
DOM_STATE_UNKNOWN = XEN_API_VM_POWER_STATE_UNKNOWN
DOM_STATES_OLD = [
diff -r 31adb5c972d0 -r cc85865f26a7 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/python/xen/xend/XendDomain.py Thu Jan 24 15:20:39 2008 -0700
@@ -43,6 +43,7 @@ from xen.xend.XendConstants import DOM_S
from xen.xend.XendConstants import DOM_STATE_HALTED, DOM_STATE_PAUSED
from xen.xend.XendConstants import DOM_STATE_RUNNING, DOM_STATE_SUSPENDED
from xen.xend.XendConstants import DOM_STATE_SHUTDOWN, DOM_STATE_UNKNOWN
+from xen.xend.XendConstants import DOM_STATE_CRASHED
from xen.xend.XendConstants import TRIGGER_TYPE
from xen.xend.XendDevices import XendDevices
from xen.xend.XendAPIConstants import *
@@ -69,6 +70,7 @@ POWER_STATE_NAMES = dict([(x, XEN_API_VM
DOM_STATE_RUNNING,
DOM_STATE_SUSPENDED,
DOM_STATE_SHUTDOWN,
+ DOM_STATE_CRASHED,
DOM_STATE_UNKNOWN]])
POWER_STATE_ALL = 'all'
@@ -1191,13 +1193,14 @@ class XendDomain:
if dominfo.getDomid() == DOM0_ID:
raise XendError("Cannot pause privileged domain %s" % domid)
ds = dominfo._stateGet()
- if ds not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
+ if ds not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED, DOM_STATE_CRASHED):
raise VMBadState("Domain '%s' is not started" % domid,
POWER_STATE_NAMES[DOM_STATE_RUNNING],
POWER_STATE_NAMES[ds])
log.info("Domain %s (%d) paused.", dominfo.getName(),
int(dominfo.getDomid()))
- dominfo.pause()
+ if ds == DOM_STATE_RUNNING:
+ dominfo.pause()
if state:
return ds
except XendInvalidDomain:
@@ -1216,7 +1219,7 @@ class XendDomain:
if dominfo.getDomid() == DOM0_ID:
raise XendError("Cannot dump core for privileged domain %s" % domid)
- if dominfo._stateGet() not in (DOM_STATE_PAUSED, DOM_STATE_RUNNING):
+ if dominfo._stateGet() not in (DOM_STATE_PAUSED, DOM_STATE_RUNNING, DOM_STATE_CRASHED):
raise VMBadState("Domain '%s' is not started" % domid,
POWER_STATE_NAMES[DOM_STATE_PAUSED],
POWER_STATE_NAMES[dominfo._stateGet()])
diff -r 31adb5c972d0 -r cc85865f26a7 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Thu Jan 24 15:20:39 2008 -0700
@@ -414,7 +414,7 @@ class XendDomainInfo:
"""
from xen.xend import XendDomain
- if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED, XEN_API_VM_POWER_STATE_SUSPENDED):
+ if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED, XEN_API_VM_POWER_STATE_SUSPENDED, XEN_API_VM_POWER_STATE_CRASHED):
try:
XendTask.log_progress(0, 30, self._constructDomain)
XendTask.log_progress(31, 60, self._initDomain)
@@ -648,7 +648,7 @@ class XendDomainInfo:
return rc
def getDeviceSxprs(self, deviceClass):
- if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
+ if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED, DOM_STATE_CRASHED):
return self.getDeviceController(deviceClass).sxprs()
else:
sxprs = []
@@ -2268,6 +2268,9 @@ class XendDomainInfo:
return XEN_API_VM_POWER_STATE_SUSPENDED
else:
return XEN_API_VM_POWER_STATE_HALTED
+ elif info['crashed']:
+ # Crashed
+ return XEN_API_VM_POWER_STATE_CRASHED
else:
# We are either RUNNING or PAUSED
if info['paused']:
[-- Attachment #3: xend_rename-restart.patch --]
[-- Type: text/x-patch, Size: 2456 bytes --]
# HG changeset patch
# User Jim Fehlig <jfehlig@novell.com>
# Date 1201214105 25200
# Node ID ff3ebb57e9859a30c29d4aea6a5e2439616ea655
# Parent cc85865f26a7cbced1d171fd52da224dca066a98
Fix 'on_*=rename-restart' domain configuration option.
When setting e.g. 'on_crash=rename-restart' option in domain config and
crashing guest OS running in the domain, the new domain is restarted with
same name as renamed domain.
jfehlig4: # xm li
Name ID Mem VCPUs State Time(s)
Domain-0 0 1233 4 r----- 937.9
Domain-e64b12a0-0493-44d7-afde-55c776513426 21 384 1 ---c- 14.3
Domain-e64b12a0-0493-44d7-afde-55c776513426 22 384 1 r----- 7.3
This patch copies the domain info prior to setting new name and uuid in
the crashed domain info and uses the copied domain info to construct the
restarted domain.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
diff -r cc85865f26a7 -r ff3ebb57e985 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Thu Jan 24 15:20:39 2008 -0700
+++ b/tools/python/xen/xend/XendDomainInfo.py Thu Jan 24 15:35:05 2008 -0700
@@ -1393,9 +1393,10 @@ class XendDomainInfo:
self._writeVm('xend/previous_restart_time', str(now))
+ new_dom_info = self.info
try:
if rename:
- self._preserveForRestart()
+ new_dom_info = self._preserveForRestart()
else:
self._unwatchVm()
self.destroyDomain()
@@ -1409,7 +1410,7 @@ class XendDomainInfo:
new_dom = None
try:
new_dom = XendDomain.instance().domain_create_from_dict(
- self.info)
+ new_dom_info)
new_dom.waitForDevices()
new_dom.unpause()
rst_cnt = self._readVm('xend/restart_count')
@@ -1440,11 +1441,15 @@ class XendDomainInfo:
new_name, new_uuid)
self._unwatchVm()
self._releaseDevices()
+ new_dom_info = self.info.copy()
+ new_dom_info['name_label'] = self.info['name_label']
+ new_dom_info['uuid'] = self.info['uuid']
self.info['name_label'] = new_name
self.info['uuid'] = new_uuid
self.vmpath = XS_VMROOT + new_uuid
self._storeVmDetails()
self._preserve()
+ return new_dom_info
def _preserve(self):
[-- Attachment #4: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fix xend 'rename-restart' behavior
2008-01-24 22:37 [PATCH] fix xend 'rename-restart' behavior Jim Fehlig
@ 2008-01-25 1:11 ` John Levon
2008-01-25 16:12 ` Jim Fehlig
0 siblings, 1 reply; 3+ messages in thread
From: John Levon @ 2008-01-25 1:11 UTC (permalink / raw)
To: Jim Fehlig; +Cc: xen-devel
On Thu, Jan 24, 2008 at 03:37:52PM -0700, Jim Fehlig wrote:
> diff -r 31adb5c972d0 -r cc85865f26a7 docs/xen-api/vm-lifecycle.tex
> --- a/docs/xen-api/vm-lifecycle.tex Thu Jan 24 14:41:26 2008 +0000
> +++ b/docs/xen-api/vm-lifecycle.tex Thu Jan 24 15:20:39 2008 -0700
There's a change log for the Xen API, I think this needs to be indicated
and the version bumped.
cheers,
john
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fix xend 'rename-restart' behavior
2008-01-25 1:11 ` John Levon
@ 2008-01-25 16:12 ` Jim Fehlig
0 siblings, 0 replies; 3+ messages in thread
From: Jim Fehlig @ 2008-01-25 16:12 UTC (permalink / raw)
To: John Levon; +Cc: xen-devel
[-- Attachment #1: Type: text/plain, Size: 452 bytes --]
John Levon wrote:
> On Thu, Jan 24, 2008 at 03:37:52PM -0700, Jim Fehlig wrote:
>
>
>> diff -r 31adb5c972d0 -r cc85865f26a7 docs/xen-api/vm-lifecycle.tex
>> --- a/docs/xen-api/vm-lifecycle.tex Thu Jan 24 14:41:26 2008 +0000
>> +++ b/docs/xen-api/vm-lifecycle.tex Thu Jan 24 15:20:39 2008 -0700
>>
>
> There's a change log for the Xen API, I think this needs to be indicated
> and the version bumped.
>
Right. Updated patch attached.
Jim
[-- Attachment #2: crashed-power-state.patch --]
[-- Type: text/x-patch, Size: 10158 bytes --]
# HG changeset patch
# User Jim Fehlig <jfehlig@novell.com>
# Date 1201277349 25200
# Node ID fd4e2742f9b6131c3116af976dba85b1af40da41
# Parent 31adb5c972d03e45cb746cd2305126ea2571282f
(Re)introduce notion of crashed VM power state.
The crashed power state is necessary to allow both core-dumping a crashed
but preserved VM and renaming/restarting a crashed VM.
This change requires incrementing Xen API version and C-bindings major
version.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
diff -r 31adb5c972d0 -r fd4e2742f9b6 docs/xen-api/revision-history.tex
--- a/docs/xen-api/revision-history.tex Thu Jan 24 14:41:26 2008 +0000
+++ b/docs/xen-api/revision-history.tex Fri Jan 25 09:09:09 2008 -0700
@@ -16,5 +16,12 @@
\end{flushleft}
\end{minipage}\\
\hline
+ 1.0.2 & 25th Jan. 08 & J. Fehlig &
+ \begin{minipage}[t]{7cm}
+ \begin{flushleft}
+ Added Crashed VM power state.
+ \end{flushleft}
+ \end{minipage}\\
+ \hline
\end{tabular}
\end{center}
\ No newline at end of file
diff -r 31adb5c972d0 -r fd4e2742f9b6 docs/xen-api/vm-lifecycle.tex
--- a/docs/xen-api/vm-lifecycle.tex Thu Jan 24 14:41:26 2008 +0000
+++ b/docs/xen-api/vm-lifecycle.tex Fri Jan 25 09:09:09 2008 -0700
@@ -21,7 +21,10 @@
\end{figure}
Figure~\ref{fig-vm-lifecycle} shows the states that a VM can be in
-and the API calls that can be used to move the VM between these states.
+and the API calls that can be used to move the VM between these states. The crashed
+state indicates that the guest OS running within the VM has crashed. There is no
+API to explicitly move to the crashed state, however a hardShutdown will move the
+VM to the powered down state.
\section{VM boot parameters}
diff -r 31adb5c972d0 -r fd4e2742f9b6 docs/xen-api/vm_lifecycle.dot
--- a/docs/xen-api/vm_lifecycle.dot Thu Jan 24 14:41:26 2008 +0000
+++ b/docs/xen-api/vm_lifecycle.dot Fri Jan 25 09:09:09 2008 -0700
@@ -1,6 +1,6 @@ digraph g{
digraph g{
-node [shape=box]; "powered down" paused running suspended;
+node [shape=box]; "powered down" paused running suspended crashed;
"powered down" -> paused [label="start(paused=true)"];
"powered down" -> running [label="start(paused=false)"];
@@ -11,5 +11,7 @@ paused -> running [label="resume"];
paused -> running [label="resume"];
running -> "powered down" [label="cleanShutdown /\nhardShutdown"];
running -> paused [label="pause"];
+running -> crashed [label="guest OS crash"]
+crashed -> "powered down" [label="hardShutdown"]
}
\ No newline at end of file
diff -r 31adb5c972d0 -r fd4e2742f9b6 docs/xen-api/xenapi-coversheet.tex
--- a/docs/xen-api/xenapi-coversheet.tex Thu Jan 24 14:41:26 2008 +0000
+++ b/docs/xen-api/xenapi-coversheet.tex Fri Jan 25 09:09:09 2008 -0700
@@ -17,12 +17,12 @@
\newcommand{\coversheetlogo}{xen.eps}
%% Document date
-\newcommand{\datestring}{10th December 2007}
+\newcommand{\datestring}{25th January 2008}
\newcommand{\releasestatement}{Stable Release}
%% Document revision
-\newcommand{\revstring}{API Revision 1.0.1}
+\newcommand{\revstring}{API Revision 1.0.2}
%% Document authors
\newcommand{\docauthors}{
diff -r 31adb5c972d0 -r fd4e2742f9b6 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Thu Jan 24 14:41:26 2008 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Fri Jan 25 09:09:09 2008 -0700
@@ -156,6 +156,7 @@ The following enumeration types are used
\hspace{0.5cm}{\tt Paused} & Paused \\
\hspace{0.5cm}{\tt Running} & Running \\
\hspace{0.5cm}{\tt Suspended} & Suspended \\
+\hspace{0.5cm}{\tt Crashed} & Crashed \\
\hspace{0.5cm}{\tt Unknown} & Some other unknown state \\
\hline
\end{longtable}
diff -r 31adb5c972d0 -r fd4e2742f9b6 tools/libxen/Makefile
--- a/tools/libxen/Makefile Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/libxen/Makefile Fri Jan 25 09:09:09 2008 -0700
@@ -18,7 +18,7 @@ XEN_ROOT=../..
XEN_ROOT=../..
include $(XEN_ROOT)/tools/Rules.mk
-MAJOR = 1.0
+MAJOR = 1.1
MINOR = 0
CFLAGS += -Iinclude \
diff -r 31adb5c972d0 -r fd4e2742f9b6 tools/libxen/include/xen/api/xen_vm_power_state.h
--- a/tools/libxen/include/xen/api/xen_vm_power_state.h Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/libxen/include/xen/api/xen_vm_power_state.h Fri Jan 25 09:09:09 2008 -0700
@@ -46,6 +46,11 @@ enum xen_vm_power_state
XEN_VM_POWER_STATE_SUSPENDED,
/**
+ * Crashed
+ */
+ XEN_VM_POWER_STATE_CRASHED,
+
+ /**
* Some other unknown state
*/
XEN_VM_POWER_STATE_UNKNOWN
diff -r 31adb5c972d0 -r fd4e2742f9b6 tools/libxen/src/xen_vm_power_state.c
--- a/tools/libxen/src/xen_vm_power_state.c Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/libxen/src/xen_vm_power_state.c Fri Jan 25 09:09:09 2008 -0700
@@ -32,6 +32,7 @@ static const char *lookup_table[] =
"Paused",
"Running",
"Suspended",
+ "Crashed",
"Unknown"
};
diff -r 31adb5c972d0 -r fd4e2742f9b6 tools/python/xen/xend/XendAPIConstants.py
--- a/tools/python/xen/xend/XendAPIConstants.py Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/python/xen/xend/XendAPIConstants.py Fri Jan 25 09:09:09 2008 -0700
@@ -25,6 +25,7 @@ XEN_API_VM_POWER_STATE = [
'Running',
'Suspended',
'Halted',
+ 'Crashed',
'Unknown'
]
@@ -33,7 +34,8 @@ XEN_API_VM_POWER_STATE_RUNNING = 2
XEN_API_VM_POWER_STATE_RUNNING = 2
XEN_API_VM_POWER_STATE_SUSPENDED = 3
XEN_API_VM_POWER_STATE_SHUTTINGDOWN = 4
-XEN_API_VM_POWER_STATE_UNKNOWN = 5
+XEN_API_VM_POWER_STATE_CRASHED = 5
+XEN_API_VM_POWER_STATE_UNKNOWN = 6
XEN_API_ON_NORMAL_EXIT = [
'destroy',
diff -r 31adb5c972d0 -r fd4e2742f9b6 tools/python/xen/xend/XendConstants.py
--- a/tools/python/xen/xend/XendConstants.py Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/python/xen/xend/XendConstants.py Fri Jan 25 09:09:09 2008 -0700
@@ -61,6 +61,7 @@ DOM_STATES = [
'running',
'suspended',
'shutdown',
+ 'crashed',
'unknown',
]
@@ -69,6 +70,7 @@ DOM_STATE_RUNNING = XEN_API_VM_POWER_STA
DOM_STATE_RUNNING = XEN_API_VM_POWER_STATE_RUNNING
DOM_STATE_SUSPENDED = XEN_API_VM_POWER_STATE_SUSPENDED
DOM_STATE_SHUTDOWN = XEN_API_VM_POWER_STATE_SHUTTINGDOWN
+DOM_STATE_CRASHED = XEN_API_VM_POWER_STATE_CRASHED
DOM_STATE_UNKNOWN = XEN_API_VM_POWER_STATE_UNKNOWN
DOM_STATES_OLD = [
diff -r 31adb5c972d0 -r fd4e2742f9b6 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/python/xen/xend/XendDomain.py Fri Jan 25 09:09:09 2008 -0700
@@ -43,6 +43,7 @@ from xen.xend.XendConstants import DOM_S
from xen.xend.XendConstants import DOM_STATE_HALTED, DOM_STATE_PAUSED
from xen.xend.XendConstants import DOM_STATE_RUNNING, DOM_STATE_SUSPENDED
from xen.xend.XendConstants import DOM_STATE_SHUTDOWN, DOM_STATE_UNKNOWN
+from xen.xend.XendConstants import DOM_STATE_CRASHED
from xen.xend.XendConstants import TRIGGER_TYPE
from xen.xend.XendDevices import XendDevices
from xen.xend.XendAPIConstants import *
@@ -69,6 +70,7 @@ POWER_STATE_NAMES = dict([(x, XEN_API_VM
DOM_STATE_RUNNING,
DOM_STATE_SUSPENDED,
DOM_STATE_SHUTDOWN,
+ DOM_STATE_CRASHED,
DOM_STATE_UNKNOWN]])
POWER_STATE_ALL = 'all'
@@ -1191,13 +1193,14 @@ class XendDomain:
if dominfo.getDomid() == DOM0_ID:
raise XendError("Cannot pause privileged domain %s" % domid)
ds = dominfo._stateGet()
- if ds not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
+ if ds not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED, DOM_STATE_CRASHED):
raise VMBadState("Domain '%s' is not started" % domid,
POWER_STATE_NAMES[DOM_STATE_RUNNING],
POWER_STATE_NAMES[ds])
log.info("Domain %s (%d) paused.", dominfo.getName(),
int(dominfo.getDomid()))
- dominfo.pause()
+ if ds == DOM_STATE_RUNNING:
+ dominfo.pause()
if state:
return ds
except XendInvalidDomain:
@@ -1216,7 +1219,7 @@ class XendDomain:
if dominfo.getDomid() == DOM0_ID:
raise XendError("Cannot dump core for privileged domain %s" % domid)
- if dominfo._stateGet() not in (DOM_STATE_PAUSED, DOM_STATE_RUNNING):
+ if dominfo._stateGet() not in (DOM_STATE_PAUSED, DOM_STATE_RUNNING, DOM_STATE_CRASHED):
raise VMBadState("Domain '%s' is not started" % domid,
POWER_STATE_NAMES[DOM_STATE_PAUSED],
POWER_STATE_NAMES[dominfo._stateGet()])
diff -r 31adb5c972d0 -r fd4e2742f9b6 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Thu Jan 24 14:41:26 2008 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Fri Jan 25 09:09:09 2008 -0700
@@ -414,7 +414,7 @@ class XendDomainInfo:
"""
from xen.xend import XendDomain
- if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED, XEN_API_VM_POWER_STATE_SUSPENDED):
+ if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED, XEN_API_VM_POWER_STATE_SUSPENDED, XEN_API_VM_POWER_STATE_CRASHED):
try:
XendTask.log_progress(0, 30, self._constructDomain)
XendTask.log_progress(31, 60, self._initDomain)
@@ -648,7 +648,7 @@ class XendDomainInfo:
return rc
def getDeviceSxprs(self, deviceClass):
- if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
+ if self._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED, DOM_STATE_CRASHED):
return self.getDeviceController(deviceClass).sxprs()
else:
sxprs = []
@@ -2268,6 +2268,9 @@ class XendDomainInfo:
return XEN_API_VM_POWER_STATE_SUSPENDED
else:
return XEN_API_VM_POWER_STATE_HALTED
+ elif info['crashed']:
+ # Crashed
+ return XEN_API_VM_POWER_STATE_CRASHED
else:
# We are either RUNNING or PAUSED
if info['paused']:
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-01-25 16:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-24 22:37 [PATCH] fix xend 'rename-restart' behavior Jim Fehlig
2008-01-25 1:11 ` John Levon
2008-01-25 16:12 ` Jim Fehlig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.