]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Fix bus and lun checks when scsi-disk.channel not present
authorJohn Ferlan <jferlan@redhat.com>
Thu, 30 Apr 2015 19:52:03 +0000 (15:52 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 30 Apr 2015 20:21:38 +0000 (16:21 -0400)
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

src/qemu/qemu_command.c

index 0dc8628b9821ba163e61769d68130763d9301a86..583bc11f166cf11e252fea8d780a9b090ac5c100 100644 (file)
@@ -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) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("This QEMU only supports both bus and "
                                      "unit equal to 0"));