3

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 readily. Needs kernel re-compilation [trying it now]. I learnt that virtio-vsock is going to be available in the future. So, it is not an option for now.

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

Is there any other filesystem driver that can work with the "filesystem" option of domain xml with libvirt?

Swaru
  • 31
  • 2

2 Answers2

2

According to the libvirt documentation, you might simply need to adjust your target.

The docs provide the following examples:

  <filesystem type='mount' accessmode='passthrough'>
    <driver type='path' wrpolicy='immediate'/>
    <source dir='/export/to/guest'/>
    <target dir='/import/from/host'/>
    <readonly/>
  </filesystem>
  <filesystem type='file' accessmode='passthrough'>
    <driver name='loop' type='raw'/>
    <driver type='path' wrpolicy='immediate'/>
    <source file='/export/to/guest.img'/>
    <target dir='/import/from/host'/>
    <readonly/>
  </filesystem>

That seems to work without the need for 9p.

However, for centos, there is in fact a readily available 9p helper:

Available Packages
Name        : nfs-ganesha-mount-9P
Arch        : x86_64
Version     : 2.3.2
Release     : 1.el7
Size        : 11 k
Repo        : epel/x86_64
Summary     : a 9p mount helper
URL         : https://github.com/nfs-ganesha/nfs-ganesha/wiki
Licence     : LGPLv3+
Description : This package contains the mount.9P script that clients can use
            : to simplify mounting to NFS-GANESHA. This is a 9p mount helper.
iwaseatenbyagrue
  • 3,588
  • 12
  • 22
2

At this time, 9p is the only filesystem sharing option that is supported by libvirt and KVM. Unfortunately 9p supported is disabled in CentOS since it has been largely unmaintained upstream for years & contained a number of security flaws - only in the past few months did a new 9p maintainer start work on cleaning this up. If you do recompile the centos kernel, or build the 9p module yourself though, it should be possible to make it work.

Until virtio-vsock with NFS support comes along, there's no other non-network based options you can use.

DanielB
  • 1,510
  • 6
  • 7