Browse code

attempt to get lxc working #23

Jesse Andrews authored on 2011/10/03 02:11:28
Showing 1 changed files
... ...
@@ -308,9 +308,22 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
308 308
     # qcow images) and kvm (hardware based virtualization).  If unable to
309 309
     # load kvm, set the libvirt type to qemu.
310 310
     sudo modprobe nbd || true
311
-    if [ ! -e /dev/kvm ]; then
312
-        LIBVIRT_TYPE=qemu
311
+
312
+    if [[ "$LIBVIRT_TYPE" -eq "kvm" ]]; then
313
+        if [ ! -e /dev/kvm ]; then
314
+            LIBVIRT_TYPE=qemu
315
+        fi
316
+    fi
317
+
318
+    if [[ "$LIBVIRT_TYPE" -eq "lxc" ]]; then
319
+        apt-get install lxc -y
320
+        sudo mkdir -p /cgroup
321
+        sudo mount none -t cgroup -o cpuacct,memory,devices,cpu,freezer,blkio /cgroup
322
+        if ! grep -q cgroup /etc/fstab; then
323
+            sudo echo none /cgroup cgroup cpuacct,memory,devices,cpu,freezer,blkio 0 0 >> /etc/fstab
324
+        fi
313 325
     fi
326
+
314 327
     # User needs to be member of libvirtd group for nova-compute to use libvirt.
315 328
     sudo usermod -a -G libvirtd `whoami`
316 329
     # if kvm wasn't running before we need to restart libvirt to enable it