Xend: handle died domain in getVCPUInfo()
PATCH 1/1 Xend: handle died domain in getVCPUInfo()
When created new guest on NUMA server, xend tried to get the best node by calculated all vcpus info, if domain already be terminated then getVCPUInfo() will throw below exception and guest start failed:
[2013-09-04 20:01:26 6254] ERROR (XendDomainInfo:496) VM start failed Traceback (most recent call last):
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 482, in start
XendTask.log_progress(31, 60, self._initDomain)
File "/usr/lib64/python2.4/site-packages/xen/xend/XendTask.py", line 209, in log_progress
retval = func(*args, **kwds)
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 2918, in _initDomain
node = self._setCPUAffinity()
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 2835, in _setCPUAffinity
best_node = find_relaxed_node(candidate_node_list)[0]
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 2803, in find_relaxed_node
cpuinfo = dom.getVCPUInfo()
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 1600, in getVCPUInfo
raise XendError(str(exn))
XendError: (3, 'No such process')
This patch will check return value of xc.vcpu_getinfo() and make sure the error not caused by domain died before throw the exception.
--- tools/python/xen/xend/XendDomainInfo.py | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
tools/python/xen/xend/XendDomainInfo.py +6 -1
@@ -35,8 +35,10 @@ import stat import shutil import traceback from types import StringTypes +import errno import xen.lowlevel.xc +from xen.lowlevel.xc import Error as XCError from xen.util import asserts, auxbin, mkdir from xen.util.blkif import parse_uname import xen.util.xsm.xsm as security
@@ -1540,7 +1542,10 @@ class XendDomainInfo: return sxpr - except RuntimeError, exn: + except XCError, exn: + # Domain already died. + if exn.args[0] == errno.ESRCH: + return sxpr raise XendError(str(exn))
Signature · 1 line
1.7.1
Quoted 20 lines · Joe Jin
When created new guest on NUMA server, xend tried to get the best node by calculated all vcpus info, if domain already be terminated then
getVCPUInfo()will throw below exception and guest start failed:[2013-09-04 20:01:26 6254] ERROR (XendDomainInfo:496) VM start failed Traceback (most recent call last):
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 482, in startXendTask.log_progress(31, 60, self._initDomain)File "
/usr/lib64/python2.4/site-packages/xen/xend/XendTask.py", line 209, inlog_progress
retval =func(*args, **kwds)
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 2918, in_initDomain
node =self._setCPUAffinity()
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 2835, in_setCPUAffinity
best_node= find_relaxed_node(candidate_node_list)[0]
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 2803, infind_relaxed_node
cpuinfo =dom.getVCPUInfo()
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 1600, in getVCPUInfo
raise XendError(str(exn))
XendError: (3, 'No such process')
Quoted 4 lines
This patch will check return value of
xc.vcpu_getinfo()and make sure the error not caused by domain died before throw the exception.Signed-off-by Joe Jin <[email protected]>
Quoted 37 lines
Cc Matt Wilson <[email protected]>Cc Keir Fraser <[email protected]>Cc Konrad Rzeszutek Wilk <[email protected]>Cc Ian Jackson <[email protected]>Cc Ian Campbell <[email protected]>Cc Roger Pau Monne <[email protected]>--- tools/python/xen/xend/XendDomainInfo.py | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)tools/python/xen/xend/XendDomainInfo.py +6
-1@@ -35,8 +35,10 @@ import stat import shutil import traceback from types import StringTypes +import errno import xen.lowlevel.xc +from xen.lowlevel.xc import Error as XCError from xen.util import asserts, auxbin, mkdir from xen.util.blkif import parse_uname import xen.util.xsm.xsm as security@@ -1540,7 +1542,10 @@ class XendDomainInfo: return sxpr - except RuntimeError, exn: + except XCError, exn: + # Domain already died. + if exn.args[0] == errno.ESRCH: + return sxpr raise XendError(str(exn))
Quoted 21 lines · Matt Wilson
Quoted 20 lines · Joe Jin
When created new guest on NUMA server, xend tried to get the best node by calculated all vcpus info, if domain already be terminated then
getVCPUInfo()will throw below exception and guest start failed:[2013-09-04 20:01:26 6254] ERROR (XendDomainInfo:496) VM start failed Traceback (most recent call last):
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 482, in startXendTask.log_progress(31, 60, self._initDomain)File "
/usr/lib64/python2.4/site-packages/xen/xend/XendTask.py", line 209, inlog_progress
retval =func(*args, **kwds)
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 2918, in_initDomain
node =self._setCPUAffinity()
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 2835, in_setCPUAffinity
best_node= find_relaxed_node(candidate_node_list)[0]
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 2803, infind_relaxed_node
cpuinfo =dom.getVCPUInfo()
File "/usr/lib64/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 1600, in getVCPUInfo
raise XendError(str(exn))
XendError: (3, 'No such process')
Quoted 6 lines
Quoted 4 lines
This patch will check return value of
xc.vcpu_getinfo()and make sure the error not caused by domain died before throw the exception.Signed-off-by Joe Jin <[email protected]>Acked-by Matt Wilson <[email protected]>
Pushed.
Ian.