提交 46da4f26 编写于 作者: D Daniel Veillard

* src/xen_internal.c: and nother one again from Saori Fukuta

Daniel
上级 90ae19cc
Fri Jul 20 12:53:35 CEST 2007 Daniel Veillard <veillard@redhat.com>
* src/xen_internal.c: and nother one again from Saori Fukuta
Fri Jul 20 11:02:28 CEST 2007 Daniel Veillard <veillard@redhat.com>
* src/xen_internal.c: some error handling improvements from Saori Fukuta
......
......@@ -1182,6 +1182,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
int i;
unsigned int val;
xenUnifiedPrivatePtr priv;
char buf[256];
if ((domain == NULL) || (domain->conn == NULL)) {
virXenErrorFunc (VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
......@@ -1246,13 +1247,13 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
op_dom.u.getschedinfo.u.credit.cap = (uint16_t)~0U;
for (i = 0; i < nparams; i++) {
memset(&buf, 0, sizeof(buf));
if (STREQ (params[i].field, str_weight) &&
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
val = params[i].value.ui;
if ((val < 1) || (val > USHRT_MAX)) {
virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
_("Credit scheduler weight parameter (%d) is out of range (1-65535)"),
val);
snprintf(buf, sizeof(buf), _("Credit scheduler weight parameter (%d) is out of range (1-65535)"), val);
virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
return(-1);
}
op_dom.u.getschedinfo.u.credit.weight = val;
......@@ -1261,9 +1262,8 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
val = params[i].value.ui;
if (val > USHRT_MAX) {
virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
_("Credit scheduler cap parameter (%d) is out of range (0-65535)"),
val);
snprintf(buf, sizeof(buf), _("Credit scheduler cap parameter (%d) is out of range (0-65535)"), val);
virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
return(-1);
}
op_dom.u.getschedinfo.u.credit.cap = val;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册