[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH]: Rework xenLinuxDomainDeviceID to support more devices



On Tue, Aug 05, 2008 at 12:12:21PM +0200, Chris Lalancette wrote:
> Recently upstream Xen added support for having xvd devices > 16.  For the most
> part, this doesn't really concern libvirt, since for things like attach and
> detach we just pass it through and let xend worry about whether it is supported
> or not.  The one place this breaks down is in the stats collecting code, where
> we need to figure out the device number so we can go digging in /sys for the
> statistics.
> 
> To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
> expressions to figure out the device number from the name.  The major advantage
> is that now xenLinuxDomainDeviceID() looks fairly identical to
> tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
> devices in the future should be much easier.  It also reduces the size of the
> code, and, in my opinion, the code complexity.
> 
> With this patch in place, I was able to get block statistics both on older style
> devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).

  Sounds good to me even if I don't grasp all the naming convention.

> Signed-off-by: Chris Lalancette <clalance redhat com>
[...]
> +        /* OK, we have a match; see if we have a partition */
> +        *part = 0;
> +        if (pmatch[1].rm_so != -1)
> +            *part = strtol(path + pmatch[1].rm_so, NULL, 10);

 let's use __virStrToLong_i internally

I think it makes that code a bit more readable too, +1

 thanks

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]