[libvirt] Mount events are not propagated to namespaces

Michal Privoznik mprivozn at redhat.com
Fri Jun 16 08:01:26 UTC 2017


Dear list,

while trying to fix a bug of mine, I've realized the mounts are not
being propagated into qemu namespaces once domains are running. That is,
imagine you have a domain running and then you plug in a flash disk,
mount it into host, because you have a file there that you want to
hotplug as a disk to your domain. You're not hotplugging the whole flash
disk, but a file on it. Problem is, that the mount event of the flash
disk is not propagated to qemu namespace even though the root is
remounted as MS_SLAVE|MS_REC right after the namespace is created.

After some digging. I am able to reproduce this even without libvirt at all:

# mount --make-rshared /
# mount | grep floppy
  <empty/>
# unshare -m /bin/bash
# mount --make-rslave /

Now mount floppy from a different terminal:

# mount /dev/sdb1 /mnt/floppy/
# mount | grep floppy
/dev/sdb1 on /mnt/floppy type ext4 (rw,relatime,data=ordered)


At this point, mount should have been propagated into namespace. Well,
it isn't:

# mount | grep floppy
  <empty/>


Do you have any idea what I am doing wrong? We need this to work not
only because of the example described above, but for a whole lot more cases.

Michal




More information about the libvir-list mailing list