Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-4432

Should fail to define guest with externally launched virtiofsd by enabling exporting filesystem as a readonly mount

    • libvirt-9.9.0-1.el9
    • None
    • None
    • rhel-sst-virtualization
    • ssg_virtualization
    • 13
    • 18
    • None
    • QE ack, Dev ack
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • 9.8.0
    • None

      Version-Release number of selected component (if applicable):
      libvirt-daemon-9.5.0-7.el9_3.x86_64
      qemu-kvm-8.0.0-13.el9.x86_64
      virtiofsd-1.7.2-1.el9.x86_64

      How reproducible:
      100%

      Steps to Reproduce:
      1. set virtd_exec_t on the virtiofsd binary:
      #chcon -t virtd_exec_t /usr/libexec/virtiofsd

      #chcon -t virtd_exec_t /usr/libexec/virtiofsd
      

      2.Create the shared dir:

      #mkdir -p /var/lib/fs/vm001
      

      3.run virtiofsd using systemd-run:

      #systemd-run /usr/libexec/virtiofsd --socket-path=/vm001-vhost-fs.sock
      -o source=/var/lib/fs/vm001
      Running as unit: run-r8ac82b1258df4c208ee74f7be3f00f7a.service
      

      4.relabel the created socket

      #chcon -t svirt_image_t /vm001-vhost-fs.sock
      

      5.Change ownership of the socket file:

      #chown qemu:qemu /vm001-vhost-fs.sock
      

      6.Define guest to add a externally-launched virtiofsd filesystem in guest:

       # virsh dumpxml lizhu --xpath //filesystem
      <filesystem type="mount">
      <driver type="virtiofs" queue="1024"/>
      <source socket="/vm001-vhost-fs.sock"/>
      <target dir="mount_tag1"/>
      <readonly/>
      <alias name="fs0"/>
      <address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
      </filesystem>
      

      7. start the guest

       # virsh start lizhu
      Domain 'lizhu' started
      

      8. login into the guest

      [Guest OS]#mount -t virtiofs mount_tag1 /mnt
      [Guest OS]#cd /mnt && echo 1 > file1
      

      9. check file1

      [Guest OS]# cat file1
      1
      

      10. check file1 on host

       # cat /var/lib/fs/vm001/file1
      1
      

      Actual results:
      Can define the above guest

      Expected results:
      Can not define the above guest, and we also need to update the related document in libvirt.org

      Additional info:
      When define a guest with internally launched virtiofsd as following:

          <filesystem type='mount' accessmode='passthrough'>
            <driver type='virtiofs' queue='1024'/>
            <binary path='/usr/libexec/virtiofsd' xattr='on'>
            </binary>
            <source dir='/path'/>
            <target dir='mount_tag'/>
            <alias name='fs0'/>
            <readonly/>
          </filesystem>
      
      # virsh define lizhu.xml
      error: Failed to define domain from lizhu.xml
      error: unsupported configuration: virtiofs does not yet support read-only mode
      

              jtomko@redhat.com Jano Tomko
              rhn-support-lizhu Lili Zhu
              virt-maint virt-maint
              Lili Zhu Lili Zhu
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: