[PATCH v2.5 01/10] conf: Change help function

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

 



The helper function to look up disk controller model may be used by scsi
hostdev. But it should be changed to use device info.

Signed-off-by: Han Cheng <hanc.fnst@xxxxxxxxxxxxxx>
---
 src/conf/domain_conf.c   |    8 ++++----
 src/conf/domain_conf.h   |    6 +++---
 src/libvirt_private.syms |    2 +-
 src/qemu/qemu_command.c  |    8 ++++----
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 03e5740..492e0b7 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3699,16 +3699,16 @@ error:
 }
 
 int
-virDomainDiskFindControllerModel(virDomainDefPtr def,
-                                 virDomainDiskDefPtr disk,
-                                 int controllerType)
+virDomainDeviceFindControllerModel(virDomainDefPtr def,
+                                   virDomainDeviceInfoPtr info,
+                                   int controllerType)
 {
     int model = -1;
     int i;
 
     for (i = 0; i < def->ncontrollers; i++) {
         if (def->controllers[i]->type == controllerType &&
-            def->controllers[i]->idx == disk->info.addr.drive.controller)
+            def->controllers[i]->idx == info->addr.drive.controller)
             model = def->controllers[i]->model;
     }
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ec823e2..08b8e48 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2023,9 +2023,9 @@ void virDomainInputDefFree(virDomainInputDefPtr def);
 void virDomainDiskDefFree(virDomainDiskDefPtr def);
 void virDomainLeaseDefFree(virDomainLeaseDefPtr def);
 void virDomainDiskHostDefFree(virDomainDiskHostDefPtr def);
-int virDomainDiskFindControllerModel(virDomainDefPtr def,
-                                     virDomainDiskDefPtr disk,
-                                     int controllerType);
+int virDomainDeviceFindControllerModel(virDomainDefPtr def,
+                                       virDomainDeviceInfoPtr info,
+                                       int controllerType);
 virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def,
                                                  int bus,
                                                  char *dst);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 3a297ec..449696d 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -125,6 +125,7 @@ virDomainDeviceAddressTypeToString;
 virDomainDeviceDefCopy;
 virDomainDeviceDefFree;
 virDomainDeviceDefParse;
+virDomainDeviceFindControllerModel;
 virDomainDeviceInfoCopy;
 virDomainDeviceInfoIterate;
 virDomainDeviceTypeToString;
@@ -142,7 +143,6 @@ virDomainDiskDeviceTypeToString;
 virDomainDiskErrorPolicyTypeFromString;
 virDomainDiskErrorPolicyTypeToString;
 virDomainDiskFindByBusAndDst;
-virDomainDiskFindControllerModel;
 virDomainDiskGeometryTransTypeFromString;
 virDomainDiskGeometryTransTypeToString;
 virDomainDiskHostDefFree;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8f1d28e..e0c53be 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -557,8 +557,8 @@ qemuAssignDeviceDiskAliasCustom(virDomainDefPtr def,
     if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
         if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
             controllerModel =
-                virDomainDiskFindControllerModel(def, disk,
-                                                 VIR_DOMAIN_CONTROLLER_TYPE_SCSI);
+                virDomainDeviceFindControllerModel(def, &disk->info,
+                                                   VIR_DOMAIN_CONTROLLER_TYPE_SCSI);
 
             if ((qemuSetScsiControllerModel(def, qemuCaps, &controllerModel)) < 0)
                 return -1;
@@ -3215,8 +3215,8 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
         }
 
         controllerModel =
-            virDomainDiskFindControllerModel(def, disk,
-                                             VIR_DOMAIN_CONTROLLER_TYPE_SCSI);
+            virDomainDeviceFindControllerModel(def, &disk->info,
+                                               VIR_DOMAIN_CONTROLLER_TYPE_SCSI);
         if ((qemuSetScsiControllerModel(def, qemuCaps, &controllerModel)) < 0)
             goto error;
 
-- 
1.7.1

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