On Thu, Oct 02, 2008 at 09:56:51PM +0200, Guido G?nther wrote: > Hi, > qemudDomainBlockStats needs to map between qemu and libvirt device > naming as well. Possible patch attached. > Cheers, > -- Guido > >From 57b8c8e66abfcc57c2f05d8b8364de6ecc05dcf9 Mon Sep 17 00:00:00 2001 > From: Guido Guenther <agx@xxxxxxxxxxx> > Date: Thu, 2 Oct 2008 21:12:20 +0200 > Subject: [PATCH] support virtio and scsi disks in qemudDomainBlockStats > > --- > src/qemu_driver.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/src/qemu_driver.c b/src/qemu_driver.c > index a1e7285..2a7c555 100644 > --- a/src/qemu_driver.c > +++ b/src/qemu_driver.c > @@ -3416,6 +3416,8 @@ qemudDomainBlockStats (virDomainPtr dom, > * hd[a-] to ide0-hd[0-] > * cdrom to ide1-cd0 > * fd[a-] to floppy[0-] > + * vd[a-] to virtio[0-] > + * sd[a-] to scsi0-hd[0-] > */ > if (STRPREFIX (path, "hd") && c_islower(path[2])) > snprintf (qemu_dev_name, sizeof (qemu_dev_name), > @@ -3425,6 +3427,12 @@ qemudDomainBlockStats (virDomainPtr dom, > else if (STRPREFIX (path, "fd") && c_islower(path[2])) > snprintf (qemu_dev_name, sizeof (qemu_dev_name), > "floppy%d", path[2] - 'a'); > + else if (STRPREFIX (path, "vd") && c_islower(path[2])) > + snprintf (qemu_dev_name, sizeof (qemu_dev_name), > + "virtio%d", path[2] - 'a'); > + else if (STRPREFIX (path, "sd") && c_islower(path[2])) > + snprintf (qemu_dev_name, sizeof (qemu_dev_name), > + "scsi0-hd%d", path[2] - 'a'); This isn't correct - it is assuming only a single letter after the prefix - while true for IDE & Floppy, it doesn't hold true for SCSI which can have more than 26 devices, so goes to double letters. We also need to consider Xen style xvdXX devices for Xenner. I think this needs to use the virDiskNameToIndex() method to extract the index instead. 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