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

Daniel
This commit is contained in:
Daniel Veillard 2007-07-20 10:53:31 +00:00
parent 90ae19cccf
commit 46da4f268f
2 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,7 @@
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> Fri Jul 20 11:02:28 CEST 2007 Daniel Veillard <veillard@redhat.com>
* src/xen_internal.c: some error handling improvements from Saori Fukuta * src/xen_internal.c: some error handling improvements from Saori Fukuta

View File

@ -1182,6 +1182,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
int i; int i;
unsigned int val; unsigned int val;
xenUnifiedPrivatePtr priv; xenUnifiedPrivatePtr priv;
char buf[256];
if ((domain == NULL) || (domain->conn == NULL)) { if ((domain == NULL) || (domain->conn == NULL)) {
virXenErrorFunc (VIR_ERR_INTERNAL_ERROR, __FUNCTION__, virXenErrorFunc (VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
@ -1246,13 +1247,13 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
op_dom.u.getschedinfo.u.credit.cap = (uint16_t)~0U; op_dom.u.getschedinfo.u.credit.cap = (uint16_t)~0U;
for (i = 0; i < nparams; i++) { for (i = 0; i < nparams; i++) {
memset(&buf, 0, sizeof(buf));
if (STREQ (params[i].field, str_weight) && if (STREQ (params[i].field, str_weight) &&
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) { params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
val = params[i].value.ui; val = params[i].value.ui;
if ((val < 1) || (val > USHRT_MAX)) { if ((val < 1) || (val > USHRT_MAX)) {
virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__, snprintf(buf, sizeof(buf), _("Credit scheduler weight parameter (%d) is out of range (1-65535)"), val);
_("Credit scheduler weight parameter (%d) is out of range (1-65535)"), virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
val);
return(-1); return(-1);
} }
op_dom.u.getschedinfo.u.credit.weight = val; op_dom.u.getschedinfo.u.credit.weight = val;
@ -1261,9 +1262,8 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) { params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
val = params[i].value.ui; val = params[i].value.ui;
if (val > USHRT_MAX) { if (val > USHRT_MAX) {
virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__, snprintf(buf, sizeof(buf), _("Credit scheduler cap parameter (%d) is out of range (0-65535)"), val);
_("Credit scheduler cap parameter (%d) is out of range (0-65535)"), virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
val);
return(-1); return(-1);
} }
op_dom.u.getschedinfo.u.credit.cap = val; op_dom.u.getschedinfo.u.credit.cap = val;