[Libvir] Proposal for new Libvirt functions about virtual CPUs

Daniel P. Berrange berrange at redhat.com
Mon Jun 26 14:22:15 UTC 2006

On Mon, Jun 26, 2006 at 04:14:59PM +0200, michel.ponceau at bull.net wrote:
> 2) For "xm vcpu-list" equivalent function (suggested virDomainGetVcpus) I propose to return in a new structure all the information provided by 
> Xen Daemon. I am trying the following addition in libvirt.h :
> typedef struct _virVcpuInfo virVcpuInfo;
> struct _virVcpuInfo {
>     int number;                 /* virtual CPU number */
>     unsigned char state;        /* 'r'=running, 'b'=blocked, 'p'=offline 
> */
>     unsigned long long cpuTime; /* CPU time used, in nanoseconds */
>     int cpu;                    /* last real CPU number allocated */
>     char cpumap[128];           /* affinity map of real CPUs which can be 
> allocated */
> };
> typedef virVcpuInfo *virVcpuInfoPtr;
> For cpumap, the xm command displays a string "x,y-z..." more compact than 
> the list of all possible CPUs "x y y+1 y+2...z..." provided by xend. But 
> the routines for this reformatting are not easy, so I propose to keep the 
> xend format in virCpuInfo. What is your opinion?

That is a rather unpleasent format to expose to applications - each application
will be forced to write their own (buggy) parser to extract useful information
from this string. It really needs to be sructured in a format which can be
directly interpreted, without requiring parsing.

|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

More information about the libvir-list mailing list