[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] xend driver: handle new-format sched-credit options



On Thu, Jan 22, 2009 at 05:49:22PM -0800, john levon sun com wrote:
> # HG changeset patch
> # User john levon sun com
> # Date 1232675291 28800
> # Node ID ad7f82da983cc0ba07f7f4e94a2f23a4edc3be57
> # Parent  3ef027308b88b47b2f3ca721bf88f2e606d8e3bc
> xend driver: handle new-format sched-credit options
> 
> Signed-off-by: John Levon <john levon sun com>

Am I right in thinking you're adding this because the
generic "virsh schedinfo --set cap=123"  command is hardcoding
the LLONG data type. If so, this is the wrong approach - virsh
is actually the one at fault.

When given a parameter, it should first call GetSchedulerParameters
and look for the named parameter. It can thus know exactly what
data type is required, and use that data type for the following
SetSchedularParameters call. It shouldn't be hardcoding any of
the datatypes.

> 
> diff --git a/src/xend_internal.c b/src/xend_internal.c
> --- a/src/xend_internal.c
> +++ b/src/xend_internal.c
> @@ -4634,9 +4634,15 @@ xenDaemonSetSchedulerParameters(virDomai
>                  if (STREQ (params[i].field, str_weight) &&
>                      params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
>                      snprintf(buf_weight, sizeof(buf_weight), "%u", params[i].value.ui);
> +                } else if (STREQ (params[i].field, str_weight) &&
> +                    params[i].type == VIR_DOMAIN_SCHED_FIELD_LLONG) {
> +                    snprintf(buf_weight, sizeof(buf_weight), "%lld", params[i].value.l);
>                  } else if (STREQ (params[i].field, str_cap) &&
>                      params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
>                      snprintf(buf_cap, sizeof(buf_cap), "%u", params[i].value.ui);
> +                } else if (STREQ (params[i].field, str_cap) &&
> +                    params[i].type == VIR_DOMAIN_SCHED_FIELD_LLONG) {
> +                    snprintf(buf_cap, sizeof(buf_cap), "%lld", params[i].value.l);
>                  } else {
>                      virXendError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
>                      goto error;
> 


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]