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 06:47:34AM -0400, Daniel Veillard wrote:
> 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

It is more readable because it doesn't give as detailed error
reporting to the caller. I don't consider that a positive thing

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
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]