[libvirt] [PATCH 2/3] qemu: fix block stats for virtio and scsi

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

 



Hi,
qemuDiskDeviceName treat's all IDE and SCSI devices as cdroms, make it
also handle disks. Make funcion arguments const.
 -- Guido
>From 3204259d61af4eee8436ccaea66469544f929613 Mon Sep 17 00:00:00 2001
From: Guido Guenther <agx@xxxxxxxxxxx>
Date: Fri, 10 Oct 2008 17:14:15 +0200
Subject: [PATCH] handle disks

---
 src/qemu_driver.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 0a0efb6..b2ea0d1 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2969,8 +2969,8 @@ static int qemudDomainUndefine(virDomainPtr dom) {
 }
 
 /* Return the disks name for use in monitor commands */
-static char *qemudDiskDeviceName(virDomainPtr dom,
-                                 virDomainDiskDefPtr disk) {
+static char *qemudDiskDeviceName(const virDomainPtr dom,
+                                 const virDomainDiskDefPtr disk) {
 
     int busid, devid;
     int ret;
@@ -2985,10 +2985,16 @@ static char *qemudDiskDeviceName(virDomainPtr dom,
 
     switch (disk->bus) {
         case VIR_DOMAIN_DISK_BUS_IDE:
-            ret = asprintf(&devname, "ide%d-cd%d", busid, devid);
+            if (disk->device== VIR_DOMAIN_DISK_DEVICE_DISK)
+                ret = asprintf(&devname, "ide%d-hd%d", busid, devid);
+            else
+                ret = asprintf(&devname, "ide%d-cd%d", busid, devid);
             break;
         case VIR_DOMAIN_DISK_BUS_SCSI:
-            ret = asprintf(&devname, "scsi%d-cd%d", busid, devid);
+            if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK)
+                ret = asprintf(&devname, "scsi%d-hd%d", busid, devid);
+            else
+                ret = asprintf(&devname, "scsi%d-cd%d", busid, devid);
             break;
         case VIR_DOMAIN_DISK_BUS_FDC:
             ret = asprintf(&devname, "floppy%d", devid);
-- 
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]