<br><font size=2 face="sans-serif">This interesting thread is temporarilu suspended because Michel has left for some (long) vacation until August 15th.</font>
<br><font size=2 face="sans-serif">I think the last proposal is a good one and deserves to be implemented and tested.</font>
<br><font size=2 face="sans-serif">I am confident that Michel will be willing to update its patch accordingly when he comes back.</font>
<br><font size=2 face="sans-serif">Is it OK for you ?.</font>
<br>
<br><font size=2 face="sans-serif">Side question: is there a defined "sign-off" procedure to follow when submitting patches ?</font>
<br>
<br><font size=2 face="sans-serif">Cordialement.</font>
<br><font size=2 face="sans-serif">Jean-Paul</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>Daniel Veillard <veillard@redhat.com></b></font>
<br><font size=1 face="sans-serif">Envoyé par : libvir-list-bounces@redhat.com</font>
<p><font size=1 face="sans-serif">17/07/2006 15:08</font>
<br><font size=1 face="sans-serif">Veuillez répondre à veillard</font>
<br>
<td><font size=1 face="Arial">        </font>
<br><font size=1 face="sans-serif">        Pour :        "Daniel P. Berrange" <berrange@redhat.com></font>
<br><font size=1 face="sans-serif">        cc :        libvir-list@redhat.com, michel.ponceau@bull.net</font>
<br><font size=1 face="sans-serif">        Objet :        Re: [Libvir] Re: Proposal : add 3 functions to Libvirt API,        for virtual CPUs</font></table>
<br>
<br><font size=2 face="Courier New">On Mon, Jul 17, 2006 at 01:50:25PM +0100, Daniel P. Berrange wrote:<br>
> On Tue, Jul 11, 2006 at 10:50:53AM -0400, Daniel Veillard wrote:<br>
> >   We still have a relatively simple API for the common case, and for special<br>
> > cases we have an extension capability with relatively clear definitions. it's<br>
> > a bitstrange but I think that should cover most case as best as possible<br>
> <br>
> I dont particularly like this as an API because I think it will be error<br>
> prone for application developers. Most app developers will only ever have<br>
> a handful of CPUs in their test machines, so they'll never the alternate<br>
> codepath for > 256 cpu case.  Likewise I don't like the idea of a virVcpuInfo<br>
> struct which has a variable size because it will totally confuse people who<br>
> haven't read the API docs very carefully, again leading to obscure bugs.<br>
> <br>
> The root problem is that we have two conflicting goals here <br>
> <br>
>   1. Want to have virVcpuInfo be a fixed size struct<br>
>   2. We want a cpumap of arbitrary size<br>
<br>
  Right this is confusing, I wanted to avoid another allocation in the general<br>
case but this made things even more confusing.<br>
<br>
> The obvious solution to this problem is to *remove*  the cpumap data from<br>
> the virVcpuInfo structure completely, and always pass in a separately <br>
> malloc'd array of the correct size. So I'd suggest:<br>
> <br>
>    typedef struct _virVcpuInfo virVcpuInfo;<br>
>    struct _virVcpuInfo {<br>
>      unsigned int number;        /* virtual CPU number */<br>
>      int state;                  /* value from virVcpuState */<br>
>      unsigned long long cpuTime; /* CPU time used, in nanoseconds */<br>
>      int cpu;                    /* real CPU number, or -1 if offline */<br>
>    }<br>
> <br>
>   virDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,<br>
>                     char *cpumap, int maplen);<br>
<br>
  Agreed, this is the most logical approach<br>
<br>
> <br>
> The client applications calling this API already have to malloc() the memory<br>
> region for the 'info' parameter of a correct size, so having to also malloc<br>
> the cpumap parameter is no extra trouble.<br>
> <br>
>   virDomainInfo info;<br>
>   virDomainVpuInfoPtr cpuInfo;<br>
>   int cpuMapLen;<br>
>   char *cpuMap;<br>
> <br>
>   virDomainGetInfo(domain, &info);<br>
> <br>
>   cpuInfo = malloc(sizeof(virDomainVcpuInfo)*info.nrVirtCpu);<br>
>   cpuMapLen = (info.nrVirtCpu + 7) / 8 ;<br>
>   cpuMap = malloc(cpuMapLen);<br>
> <br>
>   virDomainGetVCpus(domain, cpuInfo, info.nrVirtCpu, cpuMap, cpuMapLen);<br>
> <br>
>   ... do stuff with the data ...<br>
> <br>
>   free(cpuInfo);<br>
>   free(cpuMap);<br>
> <br>
> <br>
> So you can see there is minimal extra work to always pass in cpuMap as <br>
> a separate parameter. If an application didn't care about the cpuMap<br>
> data they could simply pass in NULL.<br>
<br>
  Agree. We should keep an example of use (like above completed) in the source<br>
tree to help developpers.<br>
<br>
Daniel<br>
<br>
-- <br>
Daniel Veillard      | Red Hat http://redhat.com/<br>
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/<br>
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/<br>
<br>
--<br>
Libvir-list mailing list<br>
Libvir-list@redhat.com<br>
https://www.redhat.com/mailman/listinfo/libvir-list<br>
</font>
<br>
<br>