[libvirt] [PATCH 2/3] qemu: Process the hostdev "rawio" setting

John Ferlan jferlan at redhat.com
Thu Sep 18 18:17:17 UTC 2014



On 09/18/2014 12:50 PM, Michal Privoznik wrote:
> On 10.09.2014 01:40, John Ferlan wrote:
>> Mimic the "Disk" processing for 'rawio', but for a scsi_host hostdev
>> lun device.
<...snip...>

>> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
>> index b1d8a32..3544716 100644
>> --- a/src/qemu/qemu_process.c
>> +++ b/src/qemu/qemu_process.c
>> @@ -3756,6 +3756,7 @@ int qemuProcessStart(virConnectPtr conn,
>>       struct qemuProcessHookData hookData;
>>       unsigned long cur_balloon;
>>       size_t i;
>> +    bool rawio_set = false;
>>       char *nodeset = NULL;
>>       virBitmapPtr nodemask = NULL;
>>       unsigned int stop_flags;
>> @@ -4122,13 +4123,15 @@ int qemuProcessStart(virConnectPtr conn,
>>           virDomainDeviceDef dev;
>>           virDomainDiskDefPtr disk = vm->def->disks[i];
>>
>> -        if (vm->def->disks[i]->rawio == 1)
>> +        if (vm->def->disks[i]->rawio == 1) {
>>   #ifdef CAP_SYS_RAWIO
>>               virCommandAllowCap(cmd, CAP_SYS_RAWIO);
>>   #else
>>               virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>>                              _("Raw I/O is not supported on this platform"));
>>   #endif
>> +            rawio_set = true;
>> +        }
> 
> Interesting. So if rawio is requested we shout an error but don't fail 
> actually. I think we are missing 'goto cleanup' here.
> 

See 9a2f36ec04e0436b1ba9f0c21f9be234b25ac579

I can add a goto if desired or perhaps change it to a VIR_WARN() or
something else well.

I've copied the author of that commit to get an opinion...


>>
>>           dev.type = VIR_DOMAIN_DEVICE_DISK;
>>           dev.data.disk = disk;
>> @@ -4139,6 +4142,21 @@ int qemuProcessStart(virConnectPtr conn,
>>               goto cleanup;
>>       }
>>
>> +    /* If rawio not already set, check hostdevs as well */
>> +    if (!rawio_set) {
>> +        for (i = 0; i < vm->def->nhostdevs; i++) {
>> +            virDomainHostdevSubsysSCSIPtr scsisrc =
>> +                &vm->def->hostdevs[i]->source.subsys.u.scsi;
>> +            if (scsisrc->rawio == 1)
>> +#ifdef CAP_SYS_RAWIO
>> +                virCommandAllowCap(cmd, CAP_SYS_RAWIO);
>> +#else
>> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>> +                               _("Raw I/O is not supported on this platform"));
>> +#endif
> 
> And here too then.
> 

Monkey see, monkey do[o] ;-)

John

>> +        }
>> +    }
>> +




More information about the libvir-list mailing list