[Libvir] [PATCH] BZ#251641: Allow to change the cpu pinning for inactive domain

Richard W.M. Jones rjones at redhat.com
Tue Nov 27 13:19:48 UTC 2007

Morning Saori,

You need to call the error function for each error condition, eg:

if (mapstr == NULL) {
   xenXMError (domain ? domain->conn : NULL, VIR_ERR_NO_MEMORY, 
   return -1;

(Much of the current libvirt code gets this wrong, and it's a great deal 
of pain caused by virterror, but there's no sensible way to change 
things from here.)

The inner loop is still quadratic even with snprintf because you're 
copying the string each time.  I've changed it below to use a virBuffer 

If you ./configure --enable-compile-warnings=error then any warnings 
will turn into errors.  There was one warning in the patch you sent.

Modified version of the patch is attached.  **NOTE** I've only compiled 
it, because I don't have any suitable machine to test it on.


PS. Even using the supposedly simplified virBuffer, this is still a good 
example of why we should not be writing any more code in C.  It's not 
1985 any more.  The language should take care of garbage collection, 
typing, strings, structures, error handling, etc.

Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
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. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add_vcpupin_rwmj1.patch
Type: text/x-patch
Size: 5026 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071127/0ca9f62f/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071127/0ca9f62f/attachment-0003.bin>

More information about the libvir-list mailing list