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

Re: [Libvir] [PATCH] Block device and network stats (version 2)

On Mon, Aug 20, 2007 at 04:31:26PM +0100, Richard W.M. Jones wrote:
> This patch adds block device and network stats.  The main changes over 
> the previous version are:
> * Remote support.
> * Change Xen network interface names to have the form "vif<domid>.<n>"[1].
> Discussions about the previous version may be found starting here:
> https://www.redhat.com/archives/libvir-list/2007-August/thread.html#00064
> I have left use of stdint.h / int64_t, since it wasn't clear to me what 
> conclusion people had arrived at.

Personally I'm for using long long, since its consistent with the other
existing APIs using 64 bit quantities. They're both standards so there's
no much of a reason to favour one over the other.

I notice the Xen impl of the block stats only fills in the rd_req and wr_req
fields, not the rd_bytes and wr_bytes fields. Are requests always fixed at
512 bytes in size ? If so, should be just junk those fields and only return
data in terms of the bytes (other units can be calculated as needed). As a
point of reference libstatgrab only returns bytes read/written for disks.

The Xen impl as coded only works for disks named xvdN, because the code for
calculating device ID assumes xvdN device numbering scheme:

    device = 202 * 256 + minor;

I know this is all utterly horrific, but we need to apply same logic as
used in XenD for sdNNN and hdNNN :-( For sdNNN based disks it seems to be

    8 * 256 + 16 * (ord value of disk letter ) + partition number

For hdNNN based disks it seems to be 

    ide major number corresponding to disk letter * 256 + minor number
    as calculated from partition numbers.


The interface stats look OK to me. The impl which parses /proc/net/dev
though could be shared with the QEMU driver - only the device name needs
to be different between them - QEMU will be vnetXXX - we have the actual
dev name when we create teh TAP device, but don't bother to save it anywhere
from the looks of things.

> I left the explicit structure size parameter to allow for future 
> extensibility.

Good plan.

|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

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