0

I am trying to use virsh and domain xml to launch a Centos 7 guest from ubuntu 16.04 LTS host. The "filesystem" node that i am using in domain xml is as below:

    <filesystem type='mount' accessmode='passthrough'>
        <driver type='path' wrpolicy='immediate'/>
         <source dir='/opt/test'/>
         <target dir='testlabel'/>
    </filesystem>

With the above config, "testlabel" is not visible in the guest and hence i am not able to mount it. Is there anything that i am missing?

I tried to have 9p modules in guest but they don't seem to be available in centos 7.

I do not want to use network based file sharing like NFS or glusterfs either.

Swaru
  • 144
  • 2
  • 8
  • Is the goal to be able to copy files between these hosts or anything else? – dmi Mar 17 '17 at 13:49
  • @dmi . Yes, the intention is to be able to access the same set of files from host as well as guest. The final goal is for the guest to create some files and put it in the shared folder so that the host can use it at a later point of time. – Swaru Mar 20 '17 at 05:31
  • In this case, perhaps SSH or FTP might be useful. Many modern file managers allow to use an SSH connection in a way like a filesystem. – dmi Mar 20 '17 at 06:10
  • @dmi. Yes, I agree. But, to have SSH or FTP, the firewall needs to be opened between the guest and host. This needs to be given as a special requirement to the host when multiple operators are using same host. This poses a security threat and then we have to look into TLS and other security hardening options which makes the solution quite complex. I was hoping for a simple file sharing option instead. – Swaru Mar 20 '17 at 06:22
  • Yes, any way of inter-host communication will require a certain connection and thus a firewall rule :). Perhaps having SSH on some custom port (i.e. 80 or 445) would be a workaround for this. – dmi Mar 20 '17 at 06:34

2 Answers2

1

RHEL-7 (and thus CentOS-7) explicitly does not support the 9p filesystem. It is disabled in guest kernel builds and also disabled in QEMU builds for RHEL hosts. The reason is that 9p support in QEMU has been largely unmaintained upstream and the QEMU community doesn't have confidence its is security or performance.

If you want to share filesystem locations, pretty much your only choice is to use a traditional network filesystem, whether NFS, SAMBA, or something tunnelled like SSHFS.

Work is ongoing upstream to support a new technology called virtio-vsock, which will allow running NFS-over-vsock, bypassing the need for networking - think of it as akin to NFS over UNIX sockets. This is not ready for use yet though, so not possible for an Ubuntu/RHEL-7 pair.

DanielB
  • 1,802
  • 7
  • 11
  • Thanks for that reply @DanielB. Yes, I read about virtio-vsock a couple of days back. Doesn't seem to be an option for now. But, I am still wondering if there is absolutely no way to make the "filesystem" option of Domain XML (mentioned in my original question) work without 9p file system? Is the "filesystem" node completely dependent on 9pfs or can it use some other FS driver ? – Swaru Mar 20 '17 at 05:27
  • The XML format is generic, but 9p is the only driver that is currently available for QEMU – DanielB Mar 20 '17 at 10:20
1

Use for the guest (CentOS 7) the kernel from the CentOSPlus repository Wiki CentOSPlus. The CentOSPlus kernel has the 9p file system support build in. You can install the "kernel-plus" kernel with

yum --enablerepo=centosplus install kernel-plus

Start the guest with the "kernel-plus" kernel and

mount -t 9p -o trans=virtio {sharetarget} {mountpoint}

works. I use it this way on CentOS 7 guest systems.

GM.
  • 290
  • 1
  • 5
  • 15