Chenzijian
2019-Mar-26 19:05 UTC
[libvirt-users] Problem passing qemu cmdline option when using <qemu:commandline> in domain xml.
【Sorry there I maked some mistake in my first email, here is the correct one.】 I am trying to pass-through the parallel port of the host to the guest. When I just used qemu-system-x86_64 with option '-chardev parallel,id=charparallel0,path=/dev/parport0 -device isa-parallel,chardev=charparallel0,id=parallel0', it worked perfect. But when I tried to pass these option by adding lines below to the domain xml, ... </device> <qemu:commandline> <qemu:args value='-chardev'/> <qemu:args value='parallel,id=charparallel0,path=/dev/parport0'/> <qemu:args value='-device'/> <qemu:args value='isa-parallel,chardev=charparallel0,id=parallel0'/> </qemu:commandline> ... it failed and showed: [root@localhost local]# virsh start test02 error: Failed to start domain test02 error: internal error: process exited while connecting to monitor: 2019-03-27 02:28:12.507+0000: Domain id=32 is tainted: custom-argv 2019-03-27T02:28:12.599326Z qemu-system-x86_64: -chardev parallel,id=charparallel0,path=/dev/parport0: Could not open '/dev/parport0': No such file or directory I dont know why it showed a 'No such file or directory'. The /dev/parport0 is actually here. I have tried setting chmod 666 to /dev/parport0 and shutdown the selinux, but it always show the same thing. Please give me some help, thanks.
Peter Krempa
2019-Mar-27 13:25 UTC
Re: [libvirt-users] Problem passing qemu cmdline option when using <qemu:commandline> in domain xml.
On Wed, Mar 27, 2019 at 03:05:17 +0800, Chenzijian wrote:> 【Sorry there I maked some mistake in my first email, here is the correct one.】 > I am trying to pass-through the parallel port of the host to the guest. > When I just used qemu-system-x86_64 with option '-chardev parallel,id=charparallel0,path=/dev/parport0 -device isa-parallel,chardev=charparallel0,id=parallel0', it worked perfect. > But when I tried to pass these option by adding lines below to the domain xml, > ... > </device> > <qemu:commandline> > <qemu:args value='-chardev'/> > <qemu:args value='parallel,id=charparallel0,path=/dev/parport0'/> > <qemu:args value='-device'/> > <qemu:args value='isa-parallel,chardev=charparallel0,id=parallel0'/> > </qemu:commandline>Note that using this should not be required as libvirt does support <parallel> devices.> ... > it failed and showed: > [root@localhost local]# virsh start test02 > error: Failed to start domain test02 > error: internal error: process exited while connecting to monitor: 2019-03-27 02:28:12.507+0000: Domain id=32 is tainted: custom-argv > 2019-03-27T02:28:12.599326Z qemu-system-x86_64: -chardev parallel,id=charparallel0,path=/dev/parport0: Could not open '/dev/parport0': No such file or directory > > > I dont know why it showed a 'No such file or directory'. The /dev/parport0 is actually here. I have tried setting chmod 666 to /dev/parport0 and shutdown the selinux, but it always show the same thing. > Please give me some help, thanks.libvirt runs qemu in a "container" where /dev/is not fully populated, but rather only necessary devices are present. For the example above you should be able to use the <parallel> element directly. You can work around the containerization of /dev/ by adding the correct device to cgroup_device_acl in /etc/libvirt/qemu.conf