Skip to content

Commit

Permalink
libvirt: Smaller cleanups
Browse files Browse the repository at this point in the history
- Rename odev to dev.orig
- Disable mount propagation ot preserve the original mount tree
- fix lvm typo
  • Loading branch information
fabiand committed Jan 9, 2017
1 parent a2c2e59 commit 41daca7
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions images/libvirtd/libvirtd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@ fatal() { echo "FATAL: $@" >&2 ; exit 2 ; }

# HACK
# Use hosts's /dev to see new devices and allow macvtap
mkdir /odev && {
mount --rbind /dev /odev
mkdir /dev.container && {
mount --make-rprivate --rbind /dev /dev.container

mount --rbind /host/dev /dev
# Keep some devices from the original /dev
mount --rbind /odev/shm /dev/shm
mount --rbind /odev/mqueue /dev/mqueue

# Keep some devices from the containerinal /dev
keep() { mount --rbind /dev.container/$1 /dev/$1 ; }
keep shm
keep mqueue
# Keep ptmx/pts for pty creation
mount --rbind /odev/pts /dev/pts
keep pts
mount --rbind /dev/pts/ptmx /dev/ptmx
# Use the original /dev/kvm if available
[[ -e /odev/lvm ]] && mount --rbind /odev/kvm /dev/kvm

mount --rbind /host/sys /sys
# Use the container /dev/kvm if available
[[ -e /dev.container/kvm ]] && keep kvm
}

mount --rbind /host/sys /sys

/usr/sbin/virtlogd &
/usr/sbin/libvirtd -l

0 comments on commit 41daca7

Please sign in to comment.