From 5bc5a44db93a0d08c3311063599c5de1dee3f0f3 Mon Sep 17 00:00:00 2001 From: Han Cheng Date: Tue, 9 Apr 2013 10:32:40 +0800 Subject: [PATCH] conf: Change help function 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 --- 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 03e5740935..492e0b73a4 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 ec823e2d72..08b8e48d17 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 3a297ec1fd..449696d112 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 173938b646..41a2dfdd86 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; @@ -3210,8 +3210,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; -- GitLab