* [PATCH] xend: make xc.vcpu_getinfo() return None if guest not existed @ 2013-11-21 3:12 Joe Jin 2013-11-26 1:25 ` Joe Jin 2013-12-03 10:38 ` Joe Jin 0 siblings, 2 replies; 5+ messages in thread From: Joe Jin @ 2013-11-21 3:12 UTC (permalink / raw) To: Matt Wilson, Keir Fraser, Konrad Rzeszutek Wilk, Ian Jackson, Ian Campbell, Roger Pau Monne Cc: Joe Jin, xen-devel We hit failure when when reboot some guests at the same time, xend.log has below: [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 caused by one or more guests be rebooted between the call of find_relaxed_node()->list('all') and getVCPUInfo(). This patch will let xc.vcpu_getinfo() return None if guest not existed to avoid the failure. Signed-off-by: Joe Jin <joe.jin@oracle.com> Cc: Matt Wilson <msw@amazon.com> Cc: Keir Fraser <keir@xen.org> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Roger Pau Monne <roger.pau@citrix.com> --- tools/python/xen/lowlevel/xc/xc.c | 15 ++++++++++++--- tools/python/xen/xend/XendDomainInfo.py | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 2625fc4..9a7e589 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -396,8 +396,13 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self, return pyxc_error_to_exception(self->xc_handle); rc = xc_vcpu_getinfo(self->xc_handle, dom, vcpu, &info); - if ( rc < 0 ) - return pyxc_error_to_exception(self->xc_handle); + if ( rc < 0) + { + if (errno == ESRCH) + return Py_BuildValue(""); + else + return pyxc_error_to_exception(self->xc_handle); + } cpumap = xc_cpumap_alloc(self->xc_handle); if(cpumap == NULL) @@ -407,7 +412,11 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self, if ( rc < 0 ) { free(cpumap); - return pyxc_error_to_exception(self->xc_handle); + + if (errno == ESRCH) + return Py_BuildValue(""); + else + return pyxc_error_to_exception(self->xc_handle); } info_dict = Py_BuildValue("{s:i,s:i,s:i,s:L,s:i}", diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index e9d3e7e..6b5fd83 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -1518,7 +1518,7 @@ class XendDomainInfo: for i in range(0, self.info['VCPUs_max']): if self.domid is not None: info = xc.vcpu_getinfo(self.domid, i) - + if info == None: continue sxpr.append(['vcpu', ['number', i], ['online', info['online']], -- 1.7.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] xend: make xc.vcpu_getinfo() return None if guest not existed 2013-11-21 3:12 [PATCH] xend: make xc.vcpu_getinfo() return None if guest not existed Joe Jin @ 2013-11-26 1:25 ` Joe Jin 2013-12-03 10:38 ` Joe Jin 1 sibling, 0 replies; 5+ messages in thread From: Joe Jin @ 2013-11-26 1:25 UTC (permalink / raw) To: Matt Wilson, Keir Fraser, Konrad Rzeszutek Wilk, Ian Jackson, Ian Campbell, Roger Pau Monne Cc: Joe Jin, xen-devel Hi Matt, Would you please help to review and comment the fix? Thanks, Joe On 11/21/13 11:12, Joe Jin wrote: > We hit failure when when reboot some guests at the same time, > xend.log has below: > [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 caused by one or more guests be rebooted between the call of > find_relaxed_node()->list('all') and getVCPUInfo(). This patch will let > xc.vcpu_getinfo() return None if guest not existed to avoid the failure. > > Signed-off-by: Joe Jin <joe.jin@oracle.com> > Cc: Matt Wilson <msw@amazon.com> > Cc: Keir Fraser <keir@xen.org> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: Ian Campbell <ian.campbell@citrix.com> > Cc: Roger Pau Monne <roger.pau@citrix.com> > --- > tools/python/xen/lowlevel/xc/xc.c | 15 ++++++++++++--- > tools/python/xen/xend/XendDomainInfo.py | 2 +- > 2 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c > index 2625fc4..9a7e589 100644 > --- a/tools/python/xen/lowlevel/xc/xc.c > +++ b/tools/python/xen/lowlevel/xc/xc.c > @@ -396,8 +396,13 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self, > return pyxc_error_to_exception(self->xc_handle); > > rc = xc_vcpu_getinfo(self->xc_handle, dom, vcpu, &info); > - if ( rc < 0 ) > - return pyxc_error_to_exception(self->xc_handle); > + if ( rc < 0) > + { > + if (errno == ESRCH) > + return Py_BuildValue(""); > + else > + return pyxc_error_to_exception(self->xc_handle); > + } > > cpumap = xc_cpumap_alloc(self->xc_handle); > if(cpumap == NULL) > @@ -407,7 +412,11 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self, > if ( rc < 0 ) > { > free(cpumap); > - return pyxc_error_to_exception(self->xc_handle); > + > + if (errno == ESRCH) > + return Py_BuildValue(""); > + else > + return pyxc_error_to_exception(self->xc_handle); > } > > info_dict = Py_BuildValue("{s:i,s:i,s:i,s:L,s:i}", > diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py > index e9d3e7e..6b5fd83 100644 > --- a/tools/python/xen/xend/XendDomainInfo.py > +++ b/tools/python/xen/xend/XendDomainInfo.py > @@ -1518,7 +1518,7 @@ class XendDomainInfo: > for i in range(0, self.info['VCPUs_max']): > if self.domid is not None: > info = xc.vcpu_getinfo(self.domid, i) > - > + if info == None: continue > sxpr.append(['vcpu', > ['number', i], > ['online', info['online']], > -- Oracle <http://www.oracle.com> Joe Jin | Software Development Senior Manager | +8610.6106.5624 ORACLE | Linux and Virtualization No. 24 Zhongguancun Software Park, Haidian District | 100193 Beijing ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xend: make xc.vcpu_getinfo() return None if guest not existed 2013-11-21 3:12 [PATCH] xend: make xc.vcpu_getinfo() return None if guest not existed Joe Jin 2013-11-26 1:25 ` Joe Jin @ 2013-12-03 10:38 ` Joe Jin 2013-12-08 23:52 ` Matt Wilson 1 sibling, 1 reply; 5+ messages in thread From: Joe Jin @ 2013-12-03 10:38 UTC (permalink / raw) To: Matt Wilson, Keir Fraser, Konrad Rzeszutek Wilk, Ian Jackson, Ian Campbell, Roger Pau Monne Cc: Joe Jin, Sureshmon Nair, xen-devel Hi Matt, Can you please review the patch? or any other ideas to fix the race? Thanks, Joe On 11/21/13 11:12, Joe Jin wrote: > We hit failure when when reboot some guests at the same time, > xend.log has below: > [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 caused by one or more guests be rebooted between the call of > find_relaxed_node()->list('all') and getVCPUInfo(). This patch will let > xc.vcpu_getinfo() return None if guest not existed to avoid the failure. > > Signed-off-by: Joe Jin <joe.jin@oracle.com> > Cc: Matt Wilson <msw@amazon.com> > Cc: Keir Fraser <keir@xen.org> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: Ian Campbell <ian.campbell@citrix.com> > Cc: Roger Pau Monne <roger.pau@citrix.com> > --- > tools/python/xen/lowlevel/xc/xc.c | 15 ++++++++++++--- > tools/python/xen/xend/XendDomainInfo.py | 2 +- > 2 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c > index 2625fc4..9a7e589 100644 > --- a/tools/python/xen/lowlevel/xc/xc.c > +++ b/tools/python/xen/lowlevel/xc/xc.c > @@ -396,8 +396,13 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self, > return pyxc_error_to_exception(self->xc_handle); > > rc = xc_vcpu_getinfo(self->xc_handle, dom, vcpu, &info); > - if ( rc < 0 ) > - return pyxc_error_to_exception(self->xc_handle); > + if ( rc < 0) > + { > + if (errno == ESRCH) > + return Py_BuildValue(""); > + else > + return pyxc_error_to_exception(self->xc_handle); > + } > > cpumap = xc_cpumap_alloc(self->xc_handle); > if(cpumap == NULL) > @@ -407,7 +412,11 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self, > if ( rc < 0 ) > { > free(cpumap); > - return pyxc_error_to_exception(self->xc_handle); > + > + if (errno == ESRCH) > + return Py_BuildValue(""); > + else > + return pyxc_error_to_exception(self->xc_handle); > } > > info_dict = Py_BuildValue("{s:i,s:i,s:i,s:L,s:i}", > diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py > index e9d3e7e..6b5fd83 100644 > --- a/tools/python/xen/xend/XendDomainInfo.py > +++ b/tools/python/xen/xend/XendDomainInfo.py > @@ -1518,7 +1518,7 @@ class XendDomainInfo: > for i in range(0, self.info['VCPUs_max']): > if self.domid is not None: > info = xc.vcpu_getinfo(self.domid, i) > - > + if info == None: continue > sxpr.append(['vcpu', > ['number', i], > ['online', info['online']], > -- Oracle <http://www.oracle.com> Joe Jin | Software Development Senior Manager | +8610.6106.5624 ORACLE | Linux and Virtualization No. 24 Zhongguancun Software Park, Haidian District | 100193 Beijing ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xend: make xc.vcpu_getinfo() return None if guest not existed 2013-12-03 10:38 ` Joe Jin @ 2013-12-08 23:52 ` Matt Wilson 2013-12-10 9:05 ` Joe Jin 0 siblings, 1 reply; 5+ messages in thread From: Matt Wilson @ 2013-12-08 23:52 UTC (permalink / raw) To: Joe Jin Cc: Keir Fraser, Ian Campbell, Sureshmon Nair, Ian Jackson, xen-devel, Matt Wilson, Roger Pau Monne On Tue, Dec 03, 2013 at 06:38:10PM +0800, Joe Jin wrote: > Hi Matt, > > Can you please review the patch? or any other ideas to fix the race? Hi Joe, I'm sorry about the delay. As you can imagine, it's a busy time of year for us at work. When I commented on the original patch, I was talking about the type of exception you were catching. I prefer the approach in the original patch to this one, with one change: The RuntimeError class isn't guaranteed to have exception arguments that include an errno value. The xen.lowlevel.xc.Error class is always set via PyErr_SetFromErrno(). So instead of except RuntimeError, exn: I'd rather see: except xen.lowlevel.xc.Error, exn: You can import xen.lowlevel.xc.Error to the local namespace by adding something like: from xen.lowlevel.xc import xc, Error as XenError ... except XenError, exn: Does that make sense? --msw > On 11/21/13 11:12, Joe Jin wrote: > > We hit failure when when reboot some guests at the same time, > > xend.log has below: > > [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 caused by one or more guests be rebooted between the call of > > find_relaxed_node()->list('all') and getVCPUInfo(). This patch will let > > xc.vcpu_getinfo() return None if guest not existed to avoid the failure. > > > > Signed-off-by: Joe Jin <joe.jin@oracle.com> > > Cc: Matt Wilson <msw@amazon.com> > > Cc: Keir Fraser <keir@xen.org> > > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > > Cc: Ian Campbell <ian.campbell@citrix.com> > > Cc: Roger Pau Monne <roger.pau@citrix.com> > > --- > > tools/python/xen/lowlevel/xc/xc.c | 15 ++++++++++++--- > > tools/python/xen/xend/XendDomainInfo.py | 2 +- > > 2 files changed, 13 insertions(+), 4 deletions(-) > > > > diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c > > index 2625fc4..9a7e589 100644 > > --- a/tools/python/xen/lowlevel/xc/xc.c > > +++ b/tools/python/xen/lowlevel/xc/xc.c > > @@ -396,8 +396,13 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self, > > return pyxc_error_to_exception(self->xc_handle); > > > > rc = xc_vcpu_getinfo(self->xc_handle, dom, vcpu, &info); > > - if ( rc < 0 ) > > - return pyxc_error_to_exception(self->xc_handle); > > + if ( rc < 0) > > + { > > + if (errno == ESRCH) > > + return Py_BuildValue(""); > > + else > > + return pyxc_error_to_exception(self->xc_handle); > > + } > > > > cpumap = xc_cpumap_alloc(self->xc_handle); > > if(cpumap == NULL) > > @@ -407,7 +412,11 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self, > > if ( rc < 0 ) > > { > > free(cpumap); > > - return pyxc_error_to_exception(self->xc_handle); > > + > > + if (errno == ESRCH) > > + return Py_BuildValue(""); > > + else > > + return pyxc_error_to_exception(self->xc_handle); > > } > > > > info_dict = Py_BuildValue("{s:i,s:i,s:i,s:L,s:i}", > > diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py > > index e9d3e7e..6b5fd83 100644 > > --- a/tools/python/xen/xend/XendDomainInfo.py > > +++ b/tools/python/xen/xend/XendDomainInfo.py > > @@ -1518,7 +1518,7 @@ class XendDomainInfo: > > for i in range(0, self.info['VCPUs_max']): > > if self.domid is not None: > > info = xc.vcpu_getinfo(self.domid, i) > > - > > + if info == None: continue > > sxpr.append(['vcpu', > > ['number', i], > > ['online', info['online']], > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xend: make xc.vcpu_getinfo() return None if guest not existed 2013-12-08 23:52 ` Matt Wilson @ 2013-12-10 9:05 ` Joe Jin 0 siblings, 0 replies; 5+ messages in thread From: Joe Jin @ 2013-12-10 9:05 UTC (permalink / raw) To: Matt Wilson Cc: Keir Fraser, Ian Campbell, Sureshmon Nair, Ian Jackson, xen-devel, Matt Wilson, Roger Pau Monne Hi Matt, Thanks for your clarification, I send an other patch to you for review, can you please check and advice? Thanks, Joe 12/09/13 07:52, Matt Wilson wrote: > On Tue, Dec 03, 2013 at 06:38:10PM +0800, Joe Jin wrote: >> Hi Matt, >> >> Can you please review the patch? or any other ideas to fix the race? > > Hi Joe, > > I'm sorry about the delay. As you can imagine, it's a busy time of > year for us at work. > > When I commented on the original patch, I was talking about the type > of exception you were catching. I prefer the approach in the original > patch to this one, with one change: > > The RuntimeError class isn't guaranteed to have exception arguments > that include an errno value. The xen.lowlevel.xc.Error class is always > set via PyErr_SetFromErrno(). So instead of > > except RuntimeError, exn: > > I'd rather see: > > except xen.lowlevel.xc.Error, exn: > > You can import xen.lowlevel.xc.Error to the local namespace by adding > something like: > > from xen.lowlevel.xc import xc, Error as XenError > ... > except XenError, exn: > > Does that make sense? > > --msw > >> On 11/21/13 11:12, Joe Jin wrote: >>> We hit failure when when reboot some guests at the same time, >>> xend.log has below: >>> [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 caused by one or more guests be rebooted between the call of >>> find_relaxed_node()->list('all') and getVCPUInfo(). This patch will let >>> xc.vcpu_getinfo() return None if guest not existed to avoid the failure. >>> >>> Signed-off-by: Joe Jin <joe.jin@oracle.com> >>> Cc: Matt Wilson <msw@amazon.com> >>> Cc: Keir Fraser <keir@xen.org> >>> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> >>> Cc: Ian Jackson <ian.jackson@eu.citrix.com> >>> Cc: Ian Campbell <ian.campbell@citrix.com> >>> Cc: Roger Pau Monne <roger.pau@citrix.com> >>> --- >>> tools/python/xen/lowlevel/xc/xc.c | 15 ++++++++++++--- >>> tools/python/xen/xend/XendDomainInfo.py | 2 +- >>> 2 files changed, 13 insertions(+), 4 deletions(-) >>> >>> diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c >>> index 2625fc4..9a7e589 100644 >>> --- a/tools/python/xen/lowlevel/xc/xc.c >>> +++ b/tools/python/xen/lowlevel/xc/xc.c >>> @@ -396,8 +396,13 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self, >>> return pyxc_error_to_exception(self->xc_handle); >>> >>> rc = xc_vcpu_getinfo(self->xc_handle, dom, vcpu, &info); >>> - if ( rc < 0 ) >>> - return pyxc_error_to_exception(self->xc_handle); >>> + if ( rc < 0) >>> + { >>> + if (errno == ESRCH) >>> + return Py_BuildValue(""); >>> + else >>> + return pyxc_error_to_exception(self->xc_handle); >>> + } >>> >>> cpumap = xc_cpumap_alloc(self->xc_handle); >>> if(cpumap == NULL) >>> @@ -407,7 +412,11 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self, >>> if ( rc < 0 ) >>> { >>> free(cpumap); >>> - return pyxc_error_to_exception(self->xc_handle); >>> + >>> + if (errno == ESRCH) >>> + return Py_BuildValue(""); >>> + else >>> + return pyxc_error_to_exception(self->xc_handle); >>> } >>> >>> info_dict = Py_BuildValue("{s:i,s:i,s:i,s:L,s:i}", >>> diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py >>> index e9d3e7e..6b5fd83 100644 >>> --- a/tools/python/xen/xend/XendDomainInfo.py >>> +++ b/tools/python/xen/xend/XendDomainInfo.py >>> @@ -1518,7 +1518,7 @@ class XendDomainInfo: >>> for i in range(0, self.info['VCPUs_max']): >>> if self.domid is not None: >>> info = xc.vcpu_getinfo(self.domid, i) >>> - >>> + if info == None: continue >>> sxpr.append(['vcpu', >>> ['number', i], >>> ['online', info['online']], >>> >> >> -- Oracle <http://www.oracle.com> Joe Jin | Software Development Senior Manager | +8610.6106.5624 ORACLE | Linux and Virtualization No. 24 Zhongguancun Software Park, Haidian District | 100193 Beijing ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-10 9:05 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-11-21 3:12 [PATCH] xend: make xc.vcpu_getinfo() return None if guest not existed Joe Jin 2013-11-26 1:25 ` Joe Jin 2013-12-03 10:38 ` Joe Jin 2013-12-08 23:52 ` Matt Wilson 2013-12-10 9:05 ` Joe Jin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).