Bug 1317569

Summary: VirtFS fails
Product: [Fedora] Fedora Reporter: morgan read <mstuff>
Component: qemuAssignee: Fedora Virtualization Maintainers <virt-maint>
Status: CLOSED DEFERRED QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: amit.shah, berrange, cfergeau, crobinso, dwmw2, itamar, mstuff, pbonzini, rjones, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-02 14:38:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description morgan read 2016-03-14 15:10:09 UTC
Description of problem:
Set up f20 guest
Set up Filesystem in virt-manager as per various:
http://www.linux-kvm.org/page/9p_virtio
http://www.linux-kvm.org/page/VirtFS
https://troglobit.github.io/blog/2013/07/05/file-system-pass-through-in-kvm-slash-qemu-slash-libvirt/
http://docs.slackware.com/howtos:general_admin:kvm_libvirt#shared_folders_using_virtfs

Version-Release number of selected component (if applicable):
qemu-2.3.1-12.fc22.x86_64

How reproducible:
Always


Steps to Reproduce:
1. Follow various instructions as above
2. Fails
3.

Actual results:
$ sudo mount -t 9p -o trans=virtio,version=9p2000.L,rw /home/readlegal/Home /home/readlegal/Home
[readlegal@localhost ~]$ ls
Desktop  Downloads  Home
[readlegal@localhost ~]$ ls ./Home
ls: cannot open directory ./Home: Permission denied
[readlegal@localhost ~]$ sudo ls ./Home
ls: cannot open directory ./Home: Permission denied
[readlegal@localhost ~]$ su -
Password: 
Last login: Mon Mar 14 14:38:04 GMT 2016 on pts/0
[root@localhost ~]# ls /home/readlegal/Home
ls: cannot open directory /home/readlegal/Home: Permission denied
[root@localhost ~]#

Expected results:
Able to use host file system, no permission denials

Additional info:

Comment 1 Cole Robinson 2016-03-15 19:32:02 UTC
Works for me with F23 host and F22 guest. Please provide the qemu commandline or libvirt XML you are using.

Here's my filesystem libvirt XML:

    <filesystem type='mount' accessmode='mapped'>
      <source dir='/mnt/data/devel/images'/>
      <target dir='colepath'/>
    </filesystem>

Then inside the VM I do:

# mount -t 9p colepath /mnt
# ls /mnt
...

And it all seems to work

Comment 2 morgan read 2016-03-26 08:47:39 UTC
Thanks Cole

Here's what I had - I'll now start changing things to look more like yours.

libvert XML from /etc/libvirt/qemu/fedora20.xml

 <filesystem type='mount' accessmode='mapped'>
      <driver type='path'/>
      <source dir='/home/readlegal'/>
      <target dir='/home/readlegal/Home'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </filesystem>



Inside fedora20 I've been doing, and done:-

$ sudo mount -t 9p -o trans=virtio,version=9p2000.L,rw /home/readlegal/Home /home/readlegal/Home


Via Nautilus:
The ~/Home directory icon shows as a mounted drive and under ‘Devices’ it is listed as a drive with a ‘unmount/ eject’ icon beside it, but when access the drive via Nautilus I get an error-

This location could not be displayed.
You do not have the permissions necessary to view the contents of “Home”.


Via gnome-terminal:
[root@localhost ~]# cd /home/readlegal/Home
[root@localhost Home]# ls
ls: cannot open directory .: Permission denied
[root@localhost Home]# logout
[readlegal@localhost ~]$ cd /home/readlegal/Home
[readlegal@localhost Home]$ ls
ls: cannot open directory .: Permission denied
[readlegal@localhost Home]$


Then, trying to unmount via Nautilus ‘unmount/ eject’ icon:
I get an error-

Unable to unmount Home
umount: /home/readlegal/Home: umount failed: Operation not permitted


Via gnome-terminal:
[readlegal@localhost ~]$ umount /home/readlegal/Home
umount: /home/readlegal/Home: umount failed: Operation not permitted
[readlegal@localhost ~]$ su -
Password:
Last login: Sat Mar 26 08:11:57 GMT 2016 on pts/0
[root@localhost ~]# umount /home/readlegal/Home
[root@localhost ~]# ls /home/readlegal/Home
TestFolder
[root@localhost ~]#


Unmounting via a root terminal seems to have succeeded with the the drive icon disappearing from the list under Devices but the directory in Nautilus not returning to a standard directory (folder) icon


mount -t 9p colepath /mnt
Following the above scheme with:

[root@localhost ~]# mount -t 9p /home/readlegal/Home /home/readlegal/Home

I get exactly the same results



I'll try playing with the XML

Comment 3 morgan read 2016-03-26 22:06:58 UTC
OK, now libvert XML from /etc/libvirt/qemu/fedora20.xml says:

 <filesystem type='mount' accessmode='mapped'>
      <source dir='/home/readlegal'/>
      <target dir='/home/readlegal/Home'/>
    </filesystem>

Hmm, interestingley, when I edit fedora20.xml as above, it gets set back to:

<filesystem type='mount' accessmode='mapped'>
      <source dir='/home/readlegal'/>
      <target dir='/home/readlegal/Home'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </filesystem>

By the time I view it with:

# less fedora20.xm

And, the following the above changes, I get:

[root@localhost ~]# ls /home/readlegal/Home
TestFolder
[root@localhost ~]# mount -t 9p /home/readlegal/Home /home/readlegal/Home
[root@localhost ~]# ls /home/readlegal/Home
ls: cannot open directory /home/readlegal/Home: Permission denied
[root@localhost ~]# umount /home/readlegal/Home
[root@localhost ~]# mount -t 9p -o trans=virtio,version=9p2000.L,rw /home/readlegal/Home /home/readlegal/Home
[root@localhost ~]# ls /home/readlegal/Home
ls: cannot open directory /home/readlegal/Home: Permission denied
[root@localhost ~]# umount /home/readlegal/Home
[root@localhost ~]# ls /home/readlegal/Home
TestFolder
[root@localhost ~]#


So, there doesn't seem to be any change - and VirtFS seems broken for me.  I'm not sure what would be different between my set up and yours.  I've only instaled f22 since the New Year

Comment 4 Cole Robinson 2016-04-07 19:59:03 UTC
You aren't supposed to edit XML directly in /etc/libvirt, use 'virsh edit' instead:

http://wiki.libvirt.org/page/FAQ#Where_are_VM_config_files_stored.3F_How_do_I_edit_a_VM.27s_XML_config.3F

Make sure you stop and start the VM inbetween

Are you getting any selinux errors on the host machine? Maybe see if there's any error messages in /var/log/libvirt/qemu/$vmname.log

Also the use for F20 guest means it could be a guest issue, I tested with F22 guest. And the 'mount' command I used was different from yours

Comment 5 Cole Robinson 2016-05-02 14:38:06 UTC
No response, so closing as DEFERRED. If you are still having issues, please provide the info requested in Comment 4