Browse code

Merge branch 'master' of github.com:cloudbuilders/devstack

Anthony Young authored on 2011/09/17 08:06:19
Showing 1 changed files
... ...
@@ -322,9 +322,7 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
322 322
     # device - used to manage qcow images)
323 323
     sudo modprobe nbd || true
324 324
     sudo modprobe kvm || true
325
-    # user needs to be member of libvirtd group for nova-compute to use libvirt
326
-    ## FIXME: this doesn't affect the current shell so you end up with a failed
327
-    ## launch of nova-compute
325
+    # User needs to be member of libvirtd group for nova-compute to use libvirt.
328 326
     sudo usermod -a -G libvirtd `whoami`
329 327
     # if kvm wasn't running before we need to restart libvirt to enable it
330 328
     sudo /etc/init.d/libvirt-bin restart
... ...
@@ -394,9 +392,9 @@ fi
394 394
 # so send the start command by forcing text into the window.
395 395
 # Only run the services specified in ``ENABLED_SERVICES``
396 396
 
397
-NL=`echo -ne '\015'`
398
-
397
+# our screen helper to launch a service in a hidden named screen
399 398
 function screen_it {
399
+    NL=`echo -ne '\015'`
400 400
     if [[ "$ENABLED_SERVICES" =~ "$1" ]]; then
401 401
         screen -S nova -X screen -t $1
402 402
         screen -S nova -p $1 -X stuff "$2$NL"
... ...
@@ -407,7 +405,13 @@ screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=etc/glance-api.con
407 407
 screen_it g-reg "cd $GLANCE_DIR; bin/glance-registry --config-file=etc/glance-registry.conf"
408 408
 screen_it key "$KEYSTONE_DIR/bin/keystone --config-file $KEYSTONE_CONF"
409 409
 screen_it n-api "$NOVA_DIR/bin/nova-api"
410
-screen_it n-cpu "$NOVA_DIR/bin/nova-compute"
410
+# Launching nova-compute should be as simple as running ``nova-compute`` but 
411
+# have to do a little more than that in our script.  Since we add the group 
412
+# ``libvirtd`` to our user in this script, when nova-compute is run it is
413
+# within the context of our original shell (so our groups won't be updated). 
414
+# We can send the command nova-compute to the ``newgrp`` command to execute
415
+# in a specific context.
416
+screen_it n-cpu "echo $NOVA_DIR/bin/nova-compute | newgrp libvirtd"
411 417
 screen_it n-net "$NOVA_DIR/bin/nova-network"
412 418
 screen_it n-sch "$NOVA_DIR/bin/nova-scheduler"
413 419
 # nova-vncproxy binds a privileged port, and so needs sudo