On Thu, Jan 17, 2008 at 04:44:31PM +0000, Gareth Bult wrote: > Hi, > > I've a number of servers running XEN and am trying to write some code to > monitor them through libvirt. > (Xeon/Dual Core/Ubuntu Gutsy/Xen 3.1) > > All was going well until I got to virDomainBlockStats and it simply refused > to accept my coding .. > > My solution (the code now works) is to change the following; > > src/stats_linux.c: > > #ifndef XENVBD_MAJOR > #define XENVBD_MAJOR 3 // <--- I changed this! > /*#define XENVBD_MAJOR 202*/ > #endif > > device = XENVBD_MAJOR * 256 + 1 + minor /* * 16 */; <-- this too! > > It now seems to give me some meaningful numbers without feeding my any error > messages. > Can anyone tell me "why" I needed to do this? > > I'm using "xvda" as the device path .. tried every other device name > I could think of with out any good results ...
Actually looking at the xenstore-ls output that you sent me (offlist), you are not using xvda - you're using hda1 9 = "" 769 = "" domain = "mgm" frontend = "/local/domain/9/device/vbd/769" uuid = "d6d17ae3-c08c-8a5b-fbc6-3258ea5e06bf" dev = "hda1" state = "4" params = "/cluster/images/domains/mgm/disk.img" mode = "w" online = "1" frontend-id = "9" type = "file" node = "/dev/loop13" physical-device = "7:d" hotplug-status = "connected" feature-barrier = "1" sectors = "4194304" info = "0" sector-size = "512" That is a minor detail though. The file: vs tap:aio: is actually a red herring. Having examined the code for calculating device numbers I see that it is flawed in multiple ways - It doesn't add in the partition number to device number. So 'hdc1' gets calculated as 'hdc' which fails - It uses completely wrong formula for IDE disks. It is not simply HD_MAJOR * 256 + minor * 16. There are in fact 10 IDE major numbers each holding 2 disks, with 63 partitions. - It doesn't handle SCSI disks at all. - It doesn't strip the leading /dev/ if given a fully qualified dev Basically only xvda -> xvdp with no partitions, and hda with no partitions was working. This is why it failed for you with 'hda1' and most other example disks. Dan. -- |=- 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 -=| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list