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

Roman Bogorodskiy bogorodskiy at gmail.com
Fri Sep 19 08:00:50 UTC 2014


  John Ferlan wrote:

> 
> 
> 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...

Hi,

Yes, I guess 'goto cleanup' is missing here indeed. VIR_WARN() will also
work, but probably it'd be better user experience to report an unsupported
configuration and fail early instead of showing a warning that could be
missed.

Roman Bogorodskiy




More information about the libvir-list mailing list