[Libvir] [PATCH][RFC] shows scheduler information

Atsushi SAKAI sakaia at jp.fujitsu.com
Thu Apr 12 08:40:23 UTC 2007


Hi, Rich 

Thank you for your suggestion.
I fixed it.

Changes 
1)changes static to dynamic. (like sedf, credit, weight, cap)
2)virsh printf added various print patterns for scheduler parameters.
3)Tab space changed(from 2 to 4) in xen_unified.c part


Thanks
Atsushi SAKAI


"Richard W.M. Jones" <rjones at redhat.com> wrote:

> --- libvirt.orig/src/libvirt.c	2007-04-04 23:19:49.000000000 +0900
> +++ libvirt.sched/src/libvirt.c	2007-04-06 14:06:08.000000000 +0900
> @@ -1423,6 +1423,113 @@ virConnectGetCapabilities (virConnectPtr
>       return NULL;
>   }
> 
> +/**
> + * virDomainGetSchedulerType:
> + * @dom: pointer to the hypervisor connection
> + *
> + * Get the scheduler type.
> + *
> + * Returns NULL in case of error.
> + */
> +const char *
> +virDomainGetSchedulerType(virDomainPtr domain, int *nparams)
> 
> [...]
> 
>   /*
> + * xenHypervisorGetSchedulerType:
> + * @domain: pointer to the Xen Hypervisor block
> + *
> + * Do a low level hypercall to get scheduler type
> + *
> + * Returns scheduler name or NULL in case of failure
> + */
> +const char *
> +xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
> +{
> [...]
> +        switch (op.u.getschedulerid.sched_id){
> +        case XEN_SCHEDULER_SEDF:
> +            schedulertype = "sedf";
> +            *nparams = 6;
> +            break;
> +        case XEN_SCHEDULER_CREDIT:
> +            schedulertype = "credit";
> +            *nparams = 2;
> +            break;
> 
> Please don't return static strings from functions.  It does not work 
> well in the remote case.
> 
> I don't like the dynamic typing going on in this patch altogether, but 
> with the above statically allocated strings, I think this patch should 
> not go in in its current form.
> 
> Rich.
> 
> -- 
> Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
> 64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421
> 
> Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
> Street, Windsor, Berkshire, SL4 1TE, United Kingdom.
> Registered in England and Wales under Company Registration No. 3798903
> Directors: Michael Cunningham (USA), Charlie Peters (USA) and David
> Owens (Ireland)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add_scheduler4.patch
Type: application/octet-stream
Size: 28885 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070412/ab26a08e/attachment-0001.obj>


More information about the libvir-list mailing list