[libvirt] [PATCH 07/10] qemu: Build command line for the new address format

Osier Yang jyang at redhat.com
Fri Feb 17 16:52:07 UTC 2012


On 2012年02月18日 00:44, Paolo Bonzini wrote:
> On 02/17/2012 06:18 PM, Osier Yang wrote:
>> +        controller_model =
>> +            virDomainDiskFindControllerModel(def, disk,
>> +                                             VIR_DOMAIN_CONTROLLER_TYPE_SCSI);
>> +        if (controller_model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC) {
>> +            virBufferAddLit(&opt, "scsi-disk");
>> +            virBufferAsprintf(&opt, ",bus=scsi%d.%d,scsi-id=%d",
>> +                              disk->info.addr.drive.controller,
>> +                              disk->info.addr.drive.bus,
>> +                              disk->info.addr.drive.unit);
>
> Here indeed it is ok to look at the model, for backwards compatibility.
>   However, you need to test that the target is zero and print an error if
> it is not (for example, "legacy addressing for the 'lsilogic' SCSI
> controller does not use the target attribute").

Yeah, agreed. Thanks for pointing it out.

>
> Paolo
>
>> +        } else {
>> +            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_CHANNEL)) {
>> +                if (disk->info.addr.drive.target>  7) {
>> +                    qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>> +                                    _("This QEMU doesn't support target "
>> +                                      "greater than 7"));
>> +                    goto error;
>> +                }
>> +
>> +                if ((disk->info.addr.drive.bus != disk->info.addr.drive.unit)&&
>> +                    (disk->info.addr.drive.bus != 0)) {
>> +                    qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>> +                                    _("This QEMU only supports both bus and "
>> +                                      "unit are equal to 0"));
>> +                    goto error;
>> +                }
>> +            }
>> +
>> +            virBufferAddLit(&opt, "scsi-disk");
>> +            virBufferAsprintf(&opt, ",bus=scsi%d.0,channel=%d,scsi-id=%d,lun=%d",
>> +                              disk->info.addr.drive.controller,
>> +                              disk->info.addr.drive.bus,
>> +                              disk->info.addr.drive.target,
>> +                              disk->info.addr.drive.unit);
>> +        }
>




More information about the libvir-list mailing list