Re: [PATCH 1/3] qemu: Allow to specify the sysfs root for qemuBuildCommandLine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 15, 2013 at 12:07:42PM +0100, Daniel P. Berrange wrote:
> On Wed, May 15, 2013 at 06:52:44PM +0800, Osier Yang wrote:
> > Since 0d70656afded, it starts to access the sysfs files to build
> > the qemu command line (by virSCSIDeviceGetSgName, which is find
> > out the scsi generic device name by adpater:bus:target:unit), there
> > is no way to work around, qemu wants to see the scsi generic device
> > like "/dev/sg6" anyway.
> > 
> > And I think it's not only the place which needs to access sysfs
> > files when building qemu command line in future.
> > 
> > As a solution, this introduces a new argument "sysfs_root" for
> > qemuBuildCommandLine, and thus the tests can feed the fake sysfs
> > root to it.
> 
> IMHO it would be nicer to detach the command line generator
> code from any use of sysfs in this case.
> 
> Instead of having QEMU call virSCSIDeviceGetSgName() directly,
> pass in a callback for it to use to resolve the device path.
> 
> eg
> 
>   typedef char *(*qemuGetSCSIDevice)(const char *adapter,
>                                      unsigned int bus,
>                                      unsigned int target,
>                                      unsigned int unit);
> 
> the qemuProcessStart code can pass in an impl of that callback
> which calls  virSCSIDeviceGetSgName(), while the test suite
> can pass in an impl which returns a hard-coded device string.

In fact there are probably other cases where we should pass in
callbacks like this to the QEMU command line builder. Instead of
adding many parameters to the API, we could provide a struct
containing all the various callbacks needed in one go.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]