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

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

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.


  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.

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

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