* [PATCH] Fix xm create command for wrong scheduler parameters
@ 2007-02-06 6:10 Masaki Kanno
2007-02-06 16:03 ` Ewan Mellor
0 siblings, 1 reply; 4+ messages in thread
From: Masaki Kanno @ 2007-02-06 6:10 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 1011 bytes --]
Hi,
When I tested the xm create command with wrong scheduler parameters,
a domain existed with the paused state. Usually, if an error occurred
by the xm create command, the domain isn't created.
The xm start command also has same issue.
# xm create /xen/vm1.conf cpu_weight=99999
Using config file "/xen/vm1.conf".
Error: weight is out of range
# xm create /xen/vm2.conf cpu_cap=999
Using config file "/xen/vm2.conf".
Error: cap is out of range
# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 491 2 r----- 594.5
vm1 6 256 1 --p--- 0.0
vm2 7 256 1 --p--- 0.0
This patch fixes the issue. If the xm create command fails with
wrong scheduler parameters, it destroys the domain in the proceeding
of xm create command.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Best regards,
Kan
[-- Attachment #2: xm_create.patch --]
[-- Type: application/octet-stream, Size: 2089 bytes --]
diff -r 8bc64a3a5054 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Mon Feb 05 16:40:19 2007 +0000
+++ b/tools/python/xen/xend/XendDomain.py Tue Feb 06 13:43:15 2007 +0900
@@ -868,11 +868,15 @@ class XendDomain:
self._refresh()
dominfo = XendDomainInfo.create(config)
- if XendNode.instance().xenschedinfo() == 'credit':
- self.domain_sched_credit_set(dominfo.getDomid(),
- dominfo.getWeight(),
- dominfo.getCap())
- return dominfo
+ try:
+ if XendNode.instance().xenschedinfo() == 'credit':
+ self.domain_sched_credit_set(dominfo.getDomid(),
+ dominfo.getWeight(),
+ dominfo.getCap())
+ return dominfo
+ except Exception, ex:
+ self.domain_destroy(dominfo.getDomid())
+ raise XendError(str(ex))
finally:
self.domains_lock.release()
@@ -945,10 +949,14 @@ class XendDomain:
POWER_STATE_NAMES[dominfo.state])
dominfo.start(is_managed = True)
- if XendNode.instance().xenschedinfo() == 'credit':
- self.domain_sched_credit_set(dominfo.getDomid(),
- dominfo.getWeight(),
- dominfo.getCap())
+ try:
+ if XendNode.instance().xenschedinfo() == 'credit':
+ self.domain_sched_credit_set(dominfo.getDomid(),
+ dominfo.getWeight(),
+ dominfo.getCap())
+ except Exception, ex:
+ self.domain_destroy(dominfo.getDomid())
+ raise XendError(str(ex))
finally:
self.domains_lock.release()
dominfo.waitForDevices()
[-- 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] 4+ messages in thread
* Re: [PATCH] Fix xm create command for wrong scheduler parameters
2007-02-06 6:10 [PATCH] Fix xm create command for wrong scheduler parameters Masaki Kanno
@ 2007-02-06 16:03 ` Ewan Mellor
2007-02-07 6:56 ` [PATCH] Fix xm create command for wrong schedulerparameters Masaki Kanno
0 siblings, 1 reply; 4+ messages in thread
From: Ewan Mellor @ 2007-02-06 16:03 UTC (permalink / raw)
To: Masaki Kanno; +Cc: xen-devel
On Tue, Feb 06, 2007 at 03:10:48PM +0900, Masaki Kanno wrote:
Content-Description: Mail message body
> Hi,
>
> When I tested the xm create command with wrong scheduler parameters,
> a domain existed with the paused state. Usually, if an error occurred
> by the xm create command, the domain isn't created.
> The xm start command also has same issue.
>
> # xm create /xen/vm1.conf cpu_weight=99999
> Using config file "/xen/vm1.conf".
> Error: weight is out of range
> # xm create /xen/vm2.conf cpu_cap=999
> Using config file "/xen/vm2.conf".
> Error: cap is out of range
> # xm list
> Name ID Mem VCPUs State Time(s)
> Domain-0 0 491 2 r----- 594.5
> vm1 6 256 1 --p--- 0.0
> vm2 7 256 1 --p--- 0.0
>
>
> This patch fixes the issue. If the xm create command fails with
> wrong scheduler parameters, it destroys the domain in the proceeding
> of xm create command.
>
>
> Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
>
> Best regards,
> Kan
>
> diff -r 8bc64a3a5054 tools/python/xen/xend/XendDomain.py
> --- a/tools/python/xen/xend/XendDomain.py Mon Feb 05 16:40:19 2007 +0000
> +++ b/tools/python/xen/xend/XendDomain.py Tue Feb 06 13:43:15 2007 +0900
> @@ -868,11 +868,15 @@ class XendDomain:
> self._refresh()
>
> dominfo = XendDomainInfo.create(config)
> - if XendNode.instance().xenschedinfo() == 'credit':
> - self.domain_sched_credit_set(dominfo.getDomid(),
> - dominfo.getWeight(),
> - dominfo.getCap())
> - return dominfo
> + try:
> + if XendNode.instance().xenschedinfo() == 'credit':
> + self.domain_sched_credit_set(dominfo.getDomid(),
> + dominfo.getWeight(),
> + dominfo.getCap())
> + return dominfo
> + except Exception, ex:
> + self.domain_destroy(dominfo.getDomid())
> + raise XendError(str(ex))
> finally:
> self.domains_lock.release()
>
> @@ -945,10 +949,14 @@ class XendDomain:
> POWER_STATE_NAMES[dominfo.state])
>
> dominfo.start(is_managed = True)
> - if XendNode.instance().xenschedinfo() == 'credit':
> - self.domain_sched_credit_set(dominfo.getDomid(),
> - dominfo.getWeight(),
> - dominfo.getCap())
> + try:
> + if XendNode.instance().xenschedinfo() == 'credit':
> + self.domain_sched_credit_set(dominfo.getDomid(),
> + dominfo.getWeight(),
> + dominfo.getCap())
> + except Exception, ex:
> + self.domain_destroy(dominfo.getDomid())
> + raise XendError(str(ex))
> finally:
> self.domains_lock.release()
> dominfo.waitForDevices()
I think that you should move this call to the end of XendDomainInfo.start(),
which already handles exceptions and destroys the domain if necessary. That
would save duplicating the error handling here.
Ewan.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix xm create command for wrong schedulerparameters
2007-02-06 16:03 ` Ewan Mellor
@ 2007-02-07 6:56 ` Masaki Kanno
2007-02-16 4:48 ` [PATCH] Fix xm create command for wrongschedulerparameters Masaki Kanno
0 siblings, 1 reply; 4+ messages in thread
From: Masaki Kanno @ 2007-02-07 6:56 UTC (permalink / raw)
To: Ewan Mellor; +Cc: xen-devel
[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 3870 bytes --]
>On Tue, Feb 06, 2007 at 03:10:48PM +0900, Masaki Kanno wrote:
>
>Content-Description: Mail message body
>> Hi,
>>
>> When I tested the xm create command with wrong scheduler parameters,
>> a domain existed with the paused state. Usually, if an error occurred
>> by the xm create command, the domain isn't created.
>> The xm start command also has same issue.
>>
>> # xm create /xen/vm1.conf cpu_weight=99999
>> Using config file "/xen/vm1.conf".
>> Error: weight is out of range
>> # xm create /xen/vm2.conf cpu_cap=999
>> Using config file "/xen/vm2.conf".
>> Error: cap is out of range
>> # xm list
>> Name ID Mem VCPUs State
>> Time(s)
>> Domain-0 0 491 2 r-----
>> 594.5
>> vm1 6 256 1 --p---
>> 0.0
>> vm2 7 256 1 --p---
>> 0.0
>>
>>
>> This patch fixes the issue. If the xm create command fails with
>> wrong scheduler parameters, it destroys the domain in the proceeding
>> of xm create command.
>>
>>
>> Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
>>
>> Best regards,
>> Kan
>>
>
>> diff -r 8bc64a3a5054 tools/python/xen/xend/XendDomain.py
>> --- a/tools/python/xen/xend/XendDomain.py Mon Feb 05 16:40:19 2007 +0000
>> +++ b/tools/python/xen/xend/XendDomain.py Tue Feb 06 13:43:15 2007 +0900
>> @@ -868,11 +868,15 @@ class XendDomain:
>> self._refresh()
>>
>> dominfo = XendDomainInfo.create(config)
>> - if XendNode.instance().xenschedinfo() == 'credit':
>> - self.domain_sched_credit_set(dominfo.getDomid(),
>> - dominfo.getWeight(),
>> - dominfo.getCap())
>> - return dominfo
>> + try:
>> + if XendNode.instance().xenschedinfo() == 'credit':
>> + self.domain_sched_credit_set(dominfo.getDomid(),
>> + dominfo.getWeight(),
>> + dominfo.getCap())
>> + return dominfo
>> + except Exception, ex:
>> + self.domain_destroy(dominfo.getDomid())
>> + raise XendError(str(ex))
>> finally:
>> self.domains_lock.release()
>>
>> @@ -945,10 +949,14 @@ class XendDomain:
>> POWER_STATE_NAMES[dominfo.state])
>>
>> dominfo.start(is_managed = True)
>> - if XendNode.instance().xenschedinfo() == 'credit':
>> - self.domain_sched_credit_set(dominfo.getDomid(),
>> - dominfo.getWeight(),
>> - dominfo.getCap())
>> + try:
>> + if XendNode.instance().xenschedinfo() == 'credit':
>> + self.domain_sched_credit_set(dominfo.getDomid(),
>> + dominfo.getWeight(),
>> + dominfo.getCap())
>> + except Exception, ex:
>> + self.domain_destroy(dominfo.getDomid())
>> + raise XendError(str(ex))
>> finally:
>> self.domains_lock.release()
>> dominfo.waitForDevices()
>
>I think that you should move this call to the end of XendDomainInfo.start(),
>which already handles exceptions and destroys the domain if necessary. That
>would save duplicating the error handling here.
Hi Ewan,
Thanks for your advice.
I moved calling of domain_sched_credit_set() to the end of
XendDomainInfo.start(). How is this patch?
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Best regards,
Kan
[-- Attachment #2: xm_create_take2.patch --]
[-- Type: application/octet-stream, Size: 3188 bytes --]
diff -r 2379569b590d tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Tue Feb 06 16:05:29 2007 +0000
+++ b/tools/python/xen/xend/XendDomain.py Wed Feb 07 11:42:09 2007 +0900
@@ -32,7 +32,7 @@ import xen.lowlevel.xc
import xen.lowlevel.xc
-from xen.xend import XendOptions, XendCheckpoint, XendDomainInfo, XendNode
+from xen.xend import XendOptions, XendCheckpoint, XendDomainInfo
from xen.xend.PrettyPrint import prettyprint
from xen.xend.XendConfig import XendConfig
from xen.xend.XendError import XendError, XendInvalidDomain, VmError
@@ -868,10 +868,6 @@ class XendDomain:
self._refresh()
dominfo = XendDomainInfo.create(config)
- if XendNode.instance().xenschedinfo() == 'credit':
- self.domain_sched_credit_set(dominfo.getDomid(),
- dominfo.getWeight(),
- dominfo.getCap())
return dominfo
finally:
self.domains_lock.release()
@@ -888,10 +884,6 @@ class XendDomain:
self._refresh()
dominfo = XendDomainInfo.create_from_dict(config_dict)
- if XendNode.instance().xenschedinfo() == 'credit':
- self.domain_sched_credit_set(dominfo.getDomid(),
- dominfo.getWeight(),
- dominfo.getCap())
return dominfo
finally:
self.domains_lock.release()
@@ -945,10 +937,6 @@ class XendDomain:
POWER_STATE_NAMES[dominfo.state])
dominfo.start(is_managed = True)
- if XendNode.instance().xenschedinfo() == 'credit':
- self.domain_sched_credit_set(dominfo.getDomid(),
- dominfo.getWeight(),
- dominfo.getCap())
finally:
self.domains_lock.release()
dominfo.waitForDevices()
diff -r 2379569b590d tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Tue Feb 06 16:05:29 2007 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Wed Feb 07 11:49:39 2007 +0900
@@ -396,11 +396,18 @@ class XendDomainInfo:
XendTask.log_progress(81, 90, self._registerWatches)
XendTask.log_progress(91, 100, self.refreshShutdown)
+ xendomains = XendDomain.instance()
+ xennode = XendNode.instance()
+
# save running configuration if XendDomains believe domain is
# persistent
if is_managed:
- xendomains = XendDomain.instance()
xendomains.managed_config_save(self)
+
+ if xennode.xenschedinfo() == 'credit':
+ xendomains.domain_sched_credit_set(self.getDomid(),
+ self.getWeight(),
+ self.getCap())
except:
log.exception('VM start failed')
self.destroy()
[-- 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] 4+ messages in thread
* Re: [PATCH] Fix xm create command for wrongschedulerparameters
2007-02-07 6:56 ` [PATCH] Fix xm create command for wrong schedulerparameters Masaki Kanno
@ 2007-02-16 4:48 ` Masaki Kanno
0 siblings, 0 replies; 4+ messages in thread
From: Masaki Kanno @ 2007-02-16 4:48 UTC (permalink / raw)
To: Ewan Mellor; +Cc: xen-devel
Hi Ewan,
Could you apply this patch? Or do you have comment?
This is small issue, but I would like to solve it for Xen 3.0.5.
Best regards,
Kan
>
>>On Tue, Feb 06, 2007 at 03:10:48PM +0900, Masaki Kanno wrote:
>>
>>Content-Description: Mail message body
>>> Hi,
>>>
>>> When I tested the xm create command with wrong scheduler parameters,
>>> a domain existed with the paused state. Usually, if an error occurred
>>> by the xm create command, the domain isn't created.
>>> The xm start command also has same issue.
>>>
>>> # xm create /xen/vm1.conf cpu_weight=99999
>>> Using config file "/xen/vm1.conf".
>>> Error: weight is out of range
>>> # xm create /xen/vm2.conf cpu_cap=999
>>> Using config file "/xen/vm2.conf".
>>> Error: cap is out of range
>>> # xm list
>>> Name ID Mem VCPUs State
>>> Time(s)
>>> Domain-0 0 491 2 r-----
>>> 594.5
>>> vm1 6 256 1 --p---
>>> 0.0
>>> vm2 7 256 1 --p---
>>> 0.0
>>>
>>>
>>> This patch fixes the issue. If the xm create command fails with
>>> wrong scheduler parameters, it destroys the domain in the proceeding
>>> of xm create command.
>>>
>>>
>>> Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
>>>
>>> Best regards,
>>> Kan
>>>
>>
>>> diff -r 8bc64a3a5054 tools/python/xen/xend/XendDomain.py
>>> --- a/tools/python/xen/xend/XendDomain.py Mon Feb 05 16:40:19 2007 +0000
>>> +++ b/tools/python/xen/xend/XendDomain.py Tue Feb 06 13:43:15 2007 +0900
>>> @@ -868,11 +868,15 @@ class XendDomain:
>>> self._refresh()
>>>
>>> dominfo = XendDomainInfo.create(config)
>>> - if XendNode.instance().xenschedinfo() == 'credit':
>>> - self.domain_sched_credit_set(dominfo.getDomid(),
>>> - dominfo.getWeight(),
>>> - dominfo.getCap())
>>> - return dominfo
>>> + try:
>>> + if XendNode.instance().xenschedinfo() == 'credit':
>>> + self.domain_sched_credit_set(dominfo.getDomid(),
>>> + dominfo.getWeight(),
>>> + dominfo.getCap())
>>> + return dominfo
>>> + except Exception, ex:
>>> + self.domain_destroy(dominfo.getDomid())
>>> + raise XendError(str(ex))
>>> finally:
>>> self.domains_lock.release()
>>>
>>> @@ -945,10 +949,14 @@ class XendDomain:
>>> POWER_STATE_NAMES[dominfo.state])
>>>
>>> dominfo.start(is_managed = True)
>>> - if XendNode.instance().xenschedinfo() == 'credit':
>>> - self.domain_sched_credit_set(dominfo.getDomid(),
>>> - dominfo.getWeight(),
>>> - dominfo.getCap())
>>> + try:
>>> + if XendNode.instance().xenschedinfo() == 'credit':
>>> + self.domain_sched_credit_set(dominfo.getDomid(),
>>> + dominfo.getWeight(),
>>> + dominfo.getCap())
>>> + except Exception, ex:
>>> + self.domain_destroy(dominfo.getDomid())
>>> + raise XendError(str(ex))
>>> finally:
>>> self.domains_lock.release()
>>> dominfo.waitForDevices()
>>
>>I think that you should move this call to the end of XendDomainInfo.start(),
>>which already handles exceptions and destroys the domain if necessary. That
>>would save duplicating the error handling here.
>
>Hi Ewan,
>
>Thanks for your advice.
>I moved calling of domain_sched_credit_set() to the end of
>XendDomainInfo.start(). How is this patch?
>
>
>Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
>
>Best regards,
> Kan
>
>
>-------------------------------text/plain-------------------------------
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-02-16 4:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-06 6:10 [PATCH] Fix xm create command for wrong scheduler parameters Masaki Kanno
2007-02-06 16:03 ` Ewan Mellor
2007-02-07 6:56 ` [PATCH] Fix xm create command for wrong schedulerparameters Masaki Kanno
2007-02-16 4:48 ` [PATCH] Fix xm create command for wrongschedulerparameters Masaki Kanno
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.