[libvirt] [PATCH] qemu: Fix bus and lun checks when scsi-disk.channel not present

Eric Blake eblake at redhat.com
Thu Apr 30 22:59:38 UTC 2015


On 04/30/2015 04:55 PM, John Ferlan wrote:
> Found by Laine and discussed a bit on internal IRC.
> 
> Commit id c56fe7f1d6 added support for creating a command line to support
> scsi-disk.channel.
> 
> Series was here:
> http://www.redhat.com/archives/libvir-list/2012-February/msg01052.html
> 
> Which pointed to a design proposal here:
> http://permalink.gmane.org/gmane.comp.emulators.libvirt/50428
> 
> Which states (in part):
> 
> Libvirt should check for the QEMU "scsi-disk.channel" property.  If it
> is unavailable, QEMU will only support channel=lun=0 and 0<=target<=7.
> 
> However, the check added was ensuring that bus != lun *and* bus != 0. So
> if bus == lun and both were non zero, we'd never make the second check.
> Changing this to an *or* check fixes the check, but still is less readable
> than the just checking each for 0
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/qemu/qemu_command.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 0dc8628..583bc11 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -4127,8 +4127,8 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
>                      goto error;
>                  }
>  
> -                if ((disk->info.addr.drive.bus != disk->info.addr.drive.unit) &&
> -                    (disk->info.addr.drive.bus != 0)) {
> +                if (disk->info.addr.drive.bus != 0 &&
> +                    disk->info.addr.drive.unit != 0) {

Looks reasonable, and safe for freeze.  ACK

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150430/e2d76f1a/attachment-0001.sig>


More information about the libvir-list mailing list