[Libvir] [PATCH] Refactor xend_internal.c block device detection

Richard W.M. Jones rjones at redhat.com
Tue Oct 16 13:13:04 UTC 2007


This patch is a little bit esoteric, but I need it for something I'm 
working on at the moment.

At the moment the code in xend_internal.c: xend_parse_sexp_desc parses 
the domain sexpr directly into XML.  This makes it rather hard to just 
get a list of block devices without repeating the same code.  So here 
I've factored out the common code for parsing block devices into a 
separate function and callback.

There are a couple of small changes that you should be aware of: (1) The 
<devices> list may be returned in a different order (specifically, block 
devices are always returned first).  (2) We iterate over the root nodes 
of the sexpr twice (once for block devices, once for vifs and vfbs). 
But the sexpr is small and in-memory so this shouldn't be a problem 
compared to having to do the HTTP request to xend to get it in the first 
place.

'make check' passes.

Rich.

-- 
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: libvirt-refactor-xen-blockdevs.patch
Type: text/x-patch
Size: 17590 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20071016/94ef8ac8/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/20071016/94ef8ac8/attachment-0003.bin>


More information about the libvir-list mailing list