attempt to get lxc working #23

This commit is contained in:
Jesse Andrews 2011-10-02 13:11:28 -04:00
parent 4ebd289de0
commit c6d3042e06

View file

@ -308,9 +308,22 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
# qcow images) and kvm (hardware based virtualization). If unable to # qcow images) and kvm (hardware based virtualization). If unable to
# load kvm, set the libvirt type to qemu. # load kvm, set the libvirt type to qemu.
sudo modprobe nbd || true sudo modprobe nbd || true
if [ ! -e /dev/kvm ]; then
LIBVIRT_TYPE=qemu if [[ "$LIBVIRT_TYPE" -eq "kvm" ]]; then
if [ ! -e /dev/kvm ]; then
LIBVIRT_TYPE=qemu
fi
fi fi
if [[ "$LIBVIRT_TYPE" -eq "lxc" ]]; then
apt-get install lxc -y
sudo mkdir -p /cgroup
sudo mount none -t cgroup -o cpuacct,memory,devices,cpu,freezer,blkio /cgroup
if ! grep -q cgroup /etc/fstab; then
sudo echo none /cgroup cgroup cpuacct,memory,devices,cpu,freezer,blkio 0 0 >> /etc/fstab
fi
fi
# User needs to be member of libvirtd group for nova-compute to use libvirt. # User needs to be member of libvirtd group for nova-compute to use libvirt.
sudo usermod -a -G libvirtd `whoami` sudo usermod -a -G libvirtd `whoami`
# if kvm wasn't running before we need to restart libvirt to enable it # if kvm wasn't running before we need to restart libvirt to enable it