• M
    qemuDomainCreateDeviceRecursive: Support file mount points · 4f05f188
    Michal Privoznik 提交于
    https://bugzilla.redhat.com/show_bug.cgi?id=1462060
    
    When building a qemu namespace we might be dealing with bare
    regular files. Files that live under /dev. For instance
    /dev/my_awesome_disk:
    
      <disk type='file' device='disk'>
        <driver name='qemu' type='qcow2'/>
        <source file='/dev/my_awesome_disk'/>
        <target dev='vdc' bus='virtio'/>
      </disk>
    
      # qemu-img create -f qcow2 /dev/my_awesome_disk 10M
    
    So far we were mknod()-ing them which is
    obviously wrong. We need to touch the file and bind mount it to
    the original:
    
    1) touch /var/run/libvirt/qemu/fedora.dev/my_awesome_disk
    2) mount --bind /dev/my_awesome_disk /var/run/libvirt/qemu/fedora.dev/my_awesome_disk
    
    Later, when the new /dev is built and replaces original /dev the
    file is going to live at expected location.
    Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
    Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
    4f05f188
qemu_domain.c 283.3 KB