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

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

 



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@xxxxxxxxxx>
[...]
> +        /* 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@xxxxxxxxxx  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]