Re: [libvirt] [PATCH] qemu: fix block stats for virtio and scsi

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

 



On Thu, Oct 02, 2008 at 09:06:25PM +0100, Daniel P. Berrange wrote:
> I think this needs to use the virDiskNameToIndex() method to
> extract the index instead.
Corrected pach attached. I don't know how devices are called when using
xenner so I left that out.
 -- Guido
>From c1499445011166aa53bc729e5e6bf1fd55f872ee 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 |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index a1e7285..2155017 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -3416,15 +3416,23 @@ 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),
-                  "ide0-hd%d", path[2] - 'a');
+                  "ide0-hd%d", virDiskNameToIndex(path));
     else if (STREQ (path, "cdrom"))
         strcpy (qemu_dev_name, "ide1-cd0");
     else if (STRPREFIX (path, "fd") && c_islower(path[2]))
         snprintf (qemu_dev_name, sizeof (qemu_dev_name),
-                  "floppy%d", path[2] - 'a');
+                  "floppy%d", virDiskNameToIndex(path));
+    else if (STRPREFIX (path, "vd") && c_islower(path[2]))
+        snprintf (qemu_dev_name, sizeof (qemu_dev_name),
+                  "virtio%d", virDiskNameToIndex(path));
+    else if (STRPREFIX (path, "sd") && c_islower(path[2]))
+        snprintf (qemu_dev_name, sizeof (qemu_dev_name),
+                  "scsi0-hd%d", virDiskNameToIndex(path));
     else {
         qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
                           _("invalid path: %s"), path);
-- 
1.5.6.5

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