Browse code

Add Debian OS support in DevStack

Fix bug #1176216

Change-Id: Ia94c332f02a921a936db249dc3b4a7ae4eff0400

Émilien Macchi authored on 2013/05/04 07:48:20
Showing 7 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 nbd-client
3 3
 lvm2
4 4
 open-iscsi
5
-open-iscsi-utils
5
+open-iscsi-utils # Deprecated since quantal dist:lucid,oneiric,precise
6 6
 genisoimage
7 7
 sysfsutils
8 8
 sg3-utils
... ...
@@ -380,6 +380,12 @@ GetOSVersion() {
380 380
             os_VENDOR=""
381 381
         done
382 382
         os_PACKAGE="rpm"
383
+    # If lsb_release is not installed, we should be able to detect Debian OS
384
+    elif [[ -f /etc/debian_version ]] && [[ $(cat /proc/version) =~ "Debian" ]]; then
385
+        os_VENDOR="Debian"
386
+        os_PACKAGE="deb"
387
+        os_CODENAME=$(awk '/VERSION=/' /etc/os-release | sed 's/VERSION=//' | sed -r 's/\"|\(|\)//g' | awk '{print $2}')
388
+        os_RELEASE=$(awk '/VERSION_ID=/' /etc/os-release | sed 's/VERSION_ID=//' | sed 's/\"//g')
383 389
     fi
384 390
     export os_VENDOR os_RELEASE os_UPDATE os_PACKAGE os_CODENAME
385 391
 }
... ...
@@ -425,8 +431,8 @@ function git_update_remote_branch() {
425 425
 # Sets ``DISTRO`` from the ``os_*`` values
426 426
 function GetDistro() {
427 427
     GetOSVersion
428
-    if [[ "$os_VENDOR" =~ (Ubuntu) ]]; then
429
-        # 'Everyone' refers to Ubuntu releases by the code name adjective
428
+    if [[ "$os_VENDOR" =~ (Ubuntu) || "$os_VENDOR" =~ (Debian) ]]; then
429
+        # 'Everyone' refers to Ubuntu / Debian releases by the code name adjective
430 430
         DISTRO=$os_CODENAME
431 431
     elif [[ "$os_VENDOR" =~ (Fedora) ]]; then
432 432
         # For Fedora, just use 'f' and the release
... ...
@@ -459,11 +465,9 @@ function is_ubuntu {
459 459
     if [[ -z "$os_PACKAGE" ]]; then
460 460
         GetOSVersion
461 461
     fi
462
-
463 462
     [ "$os_PACKAGE" = "deb" ]
464 463
 }
465 464
 
466
-
467 465
 # Determine if current distribution is a Fedora-based distribution
468 466
 # (Fedora, RHEL, CentOS).
469 467
 # is_fedora
... ...
@@ -204,7 +204,7 @@ function configure_baremetal_nova_dirs() {
204 204
     sudo mkdir -p /tftpboot
205 205
     sudo mkdir -p /tftpboot/pxelinux.cfg
206 206
     sudo cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
207
-    sudo chown -R $STACK_USER:libvirtd /tftpboot
207
+    sudo chown -R $STACK_USER:$LIBVIRT_GROUP /tftpboot
208 208
 
209 209
     # ensure $NOVA_STATE_PATH/baremetal is prepared
210 210
     sudo mkdir -p $NOVA_STATE_PATH/baremetal
... ...
@@ -125,7 +125,7 @@ function install_ceilometerclient() {
125 125
 
126 126
 # start_ceilometer() - Start running processes, including screen
127 127
 function start_ceilometer() {
128
-    screen_it ceilometer-acompute "cd $CEILOMETER_DIR && sg libvirtd \"$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF\""
128
+    screen_it ceilometer-acompute "cd $CEILOMETER_DIR && sg $LIBVIRT_GROUP \"$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF\""
129 129
     screen_it ceilometer-acentral "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_CONF"
130 130
     screen_it ceilometer-collector "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-collector --config-file $CEILOMETER_CONF"
131 131
     screen_it ceilometer-api "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR --config-file $CEILOMETER_CONF"
... ...
@@ -298,14 +298,14 @@ EOF
298 298
 
299 299
         if is_fedora || is_suse; then
300 300
             if is_fedora && [[  $DISTRO =~ (rhel6) || "$os_RELEASE" -le "17" ]]; then
301
-                sudo bash -c 'cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
301
+                sudo bash -c "cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
302 302
 [libvirt Management Access]
303
-Identity=unix-group:libvirtd
303
+Identity=unix-group:$LIBVIRT_GROUP
304 304
 Action=org.libvirt.unix.manage
305 305
 ResultAny=yes
306 306
 ResultInactive=yes
307 307
 ResultActive=yes
308
-EOF'
308
+EOF"
309 309
             elif is_suse && [[ $os_RELEASE = 12.2 || "$os_VENDOR" = "SUSE LINUX" ]]; then
310 310
                 # openSUSE < 12.3 or SLE
311 311
                 # Work around the fact that polkit-default-privs overrules pklas
... ...
@@ -338,10 +338,10 @@ EOF"
338 338
 
339 339
         # The user that nova runs as needs to be member of **libvirtd** group otherwise
340 340
         # nova-compute will be unable to use libvirt.
341
-        if ! getent group libvirtd >/dev/null; then
342
-            sudo groupadd libvirtd
341
+        if ! getent group $LIBVIRT_GROUP >/dev/null; then
342
+            sudo groupadd $LIBVIRT_GROUP
343 343
         fi
344
-        add_user_to_group $STACK_USER libvirtd
344
+        add_user_to_group $STACK_USER $LIBVIRT_GROUP
345 345
 
346 346
         # libvirt detects various settings on startup, as we potentially changed
347 347
         # the system configuration (modules, filesystems), we need to restart
... ...
@@ -648,11 +648,11 @@ function start_nova_api() {
648 648
 
649 649
 # start_nova() - Start running processes, including screen
650 650
 function start_nova() {
651
-    # The group **libvirtd** is added to the current user in this script.
652
-    # Use 'sg' to execute nova-compute as a member of the **libvirtd** group.
651
+    # The group **$LIBVIRT_GROUP** is added to the current user in this script.
652
+    # Use 'sg' to execute nova-compute as a member of the **$LIBVIRT_GROUP** group.
653 653
     # ``screen_it`` checks ``is_service_enabled``, it is not needed here
654 654
     screen_it n-cond "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-conductor"
655
-    screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_BIN_DIR/nova-compute"
655
+    screen_it n-cpu "cd $NOVA_DIR && sg $LIBVIRT_GROUP $NOVA_BIN_DIR/nova-compute"
656 656
     screen_it n-crt "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cert"
657 657
     screen_it n-net "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-network"
658 658
     screen_it n-sch "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-scheduler"
... ...
@@ -32,6 +32,15 @@ source $TOP_DIR/functions
32 32
 # and ``DISTRO``
33 33
 GetDistro
34 34
 
35
+# Some dependencies are not available in Debian Wheezy official
36
+# repositories. However, it's possible to run OpenStack from gplhost
37
+# repository.
38
+if [[ "$os_VENDOR" =~ (Debian) ]]; then
39
+    echo 'deb http://archive.gplhost.com/debian grizzly main' | sudo tee /etc/apt/sources.list.d/gplhost_wheezy-backports.list
40
+    echo 'deb http://archive.gplhost.com/debian grizzly-backports main' | sudo tee -a /etc/apt/sources.list.d/gplhost_wheezy-backports.list
41
+    apt_get update
42
+    apt_get install --force-yes gplhost-archive-keyring
43
+fi
35 44
 
36 45
 # Global Settings
37 46
 # ===============
... ...
@@ -105,7 +114,7 @@ disable_negated_services
105 105
 
106 106
 # Warn users who aren't on an explicitly supported distro, but allow them to
107 107
 # override check and attempt installation with ``FORCE=yes ./stack``
108
-if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|raring|saucy|f16|f17|f18|opensuse-12.2|rhel6) ]]; then
108
+if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|raring|saucy|7.0|wheezy|sid|testing|jessie|f16|f17|f18|opensuse-12.2|rhel6) ]]; then
109 109
     echo "WARNING: this script has not been tested on $DISTRO"
110 110
     if [[ "$FORCE" != "yes" ]]; then
111 111
         die $LINENO "If you wish to run this script anyway run with FORCE=yes"
... ...
@@ -162,6 +162,11 @@ BM_POSEUR_BRANCH=${BM_POSEUR_BRANCH:-master}
162 162
 # also install an **LXC** or **OpenVZ** based system.
163 163
 VIRT_DRIVER=${VIRT_DRIVER:-libvirt}
164 164
 LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
165
+if [[ "$os_VENDOR" =~ (Debian) ]]; then
166
+  LIBVIRT_GROUP=libvirt
167
+else
168
+  LIBVIRT_GROUP=libvirtd
169
+fi
165 170
 
166 171
 # Specify a comma-separated list of UEC images to download and install into glance.
167 172
 # supported urls here are: