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

[RHEL-10] shared_filesystems feature doesn't work well with non-canonical paths

    • libvirt-10.10.0-7.el10
    • No
    • Important
    • rhel-sst-virt-tools
    • ssg_virtualization
    • None
    • Dev ack
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • All
    • None

      akalenyu has been integrating the shared_filesystems feature introduced with RHEL-70637 into KubeVirt and has discovered that it doesn't work as expected there.

      This is what the domain XML for a KubeVirt guest looks like:

      <disk type='file' device='disk' model='virtio-non-transitional'>
        <driver name='qemu' type='raw' cache='none' error_policy='stop' discard='unmap'/>
        <source file='/var/run/kubevirt-private/vmi-disks/disk0/disk.img' index='2'/>
        <backingStore/>
        <target dev='vda' bus='virtio'/>
        <alias name='ua-dv-disk'/>
        <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
      </disk>
      

      And this is how the QEMU driver is configured to take advantage of the shared_filesystems feature:

      shared_filesystems = [ "/var/run/kubevirt-private/vmi-disks/disk0" ]
      

      Everything looks sane, and yet migration fails with:

      {"component":"virt-launcher","level":"info","msg":"Check if path /var/run/kubevirt-private/vmi-disks/disk0/disk.img with FS magic 61267 is shared","pos":"virFileIsSharedFSType:3625","subcomponent":"libvirt","thread":"28","timestamp":"2025-02-12T16:27:02.871000Z"}
      {"component":"virt-launcher","level":"error","msg":"Unsafe migration: Migration without shared storage is unsafe","pos":"qemuMigrationSrcIsSafe:1754","subcomponent":"libvirt","thread":"28","timestamp":"2025-02-12T16:27:02.871000Z"}
      

      After some joint analysis, we figured out that the issue stems from the fact that the virt-launcher container, just like all modern Linux systems, contains the following symlink:

      $ ls -l /var/run
      lrwxrwxrwx. 1 root root 6 Oct 24 16:49 /var/run -> ../run
      

      So the canonical form for any /var/run/foo path is /run/foo; notably, all paths in the shared_filesystems configuration value undergo canonicalization, while the disk path itself doesn't. Knowing this, it becomes obvious why the feature doesn't work as expected. Luckily, the fix is just as obvious.

              rhn-engineering-abologna Andrea Bolognani
              rhn-engineering-abologna Andrea Bolognani
              virt-maint virt-maint
              Han Han Han Han
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated: