Add Debian OS support in DevStack
Fix bug #1176216
Change-Id: Ia94c332f02a921a936db249dc3b4a7ae4eff0400
diff --git a/files/apts/n-cpu b/files/apts/n-cpu
index ef281ca..88e0144 100644
--- a/files/apts/n-cpu
+++ b/files/apts/n-cpu
@@ -2,7 +2,7 @@
nbd-client
lvm2
open-iscsi
-open-iscsi-utils
+open-iscsi-utils # Deprecated since quantal dist:lucid,oneiric,precise
genisoimage
sysfsutils
sg3-utils
diff --git a/functions b/functions
index 02c2b3a..0b2710c 100644
--- a/functions
+++ b/functions
@@ -380,6 +380,12 @@
os_VENDOR=""
done
os_PACKAGE="rpm"
+ # If lsb_release is not installed, we should be able to detect Debian OS
+ elif [[ -f /etc/debian_version ]] && [[ $(cat /proc/version) =~ "Debian" ]]; then
+ os_VENDOR="Debian"
+ os_PACKAGE="deb"
+ os_CODENAME=$(awk '/VERSION=/' /etc/os-release | sed 's/VERSION=//' | sed -r 's/\"|\(|\)//g' | awk '{print $2}')
+ os_RELEASE=$(awk '/VERSION_ID=/' /etc/os-release | sed 's/VERSION_ID=//' | sed 's/\"//g')
fi
export os_VENDOR os_RELEASE os_UPDATE os_PACKAGE os_CODENAME
}
@@ -425,8 +431,8 @@
# Sets ``DISTRO`` from the ``os_*`` values
function GetDistro() {
GetOSVersion
- if [[ "$os_VENDOR" =~ (Ubuntu) ]]; then
- # 'Everyone' refers to Ubuntu releases by the code name adjective
+ if [[ "$os_VENDOR" =~ (Ubuntu) || "$os_VENDOR" =~ (Debian) ]]; then
+ # 'Everyone' refers to Ubuntu / Debian releases by the code name adjective
DISTRO=$os_CODENAME
elif [[ "$os_VENDOR" =~ (Fedora) ]]; then
# For Fedora, just use 'f' and the release
@@ -459,11 +465,9 @@
if [[ -z "$os_PACKAGE" ]]; then
GetOSVersion
fi
-
[ "$os_PACKAGE" = "deb" ]
}
-
# Determine if current distribution is a Fedora-based distribution
# (Fedora, RHEL, CentOS).
# is_fedora
diff --git a/lib/baremetal b/lib/baremetal
index 8658c3a..bed3c09 100644
--- a/lib/baremetal
+++ b/lib/baremetal
@@ -204,7 +204,7 @@
sudo mkdir -p /tftpboot
sudo mkdir -p /tftpboot/pxelinux.cfg
sudo cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
- sudo chown -R $STACK_USER:libvirtd /tftpboot
+ sudo chown -R $STACK_USER:$LIBVIRT_GROUP /tftpboot
# ensure $NOVA_STATE_PATH/baremetal is prepared
sudo mkdir -p $NOVA_STATE_PATH/baremetal
diff --git a/lib/ceilometer b/lib/ceilometer
index 6b110cb..1c289fd 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -125,7 +125,7 @@
# start_ceilometer() - Start running processes, including screen
function start_ceilometer() {
- screen_it ceilometer-acompute "cd $CEILOMETER_DIR && sg libvirtd \"$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF\""
+ screen_it ceilometer-acompute "cd $CEILOMETER_DIR && sg $LIBVIRT_GROUP \"$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF\""
screen_it ceilometer-acentral "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_CONF"
screen_it ceilometer-collector "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-collector --config-file $CEILOMETER_CONF"
screen_it ceilometer-api "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR --config-file $CEILOMETER_CONF"
diff --git a/lib/nova b/lib/nova
index 3a59681..6fa1db4 100644
--- a/lib/nova
+++ b/lib/nova
@@ -298,14 +298,14 @@
if is_fedora || is_suse; then
if is_fedora && [[ $DISTRO =~ (rhel6) || "$os_RELEASE" -le "17" ]]; then
- sudo bash -c 'cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
+ sudo bash -c "cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
[libvirt Management Access]
-Identity=unix-group:libvirtd
+Identity=unix-group:$LIBVIRT_GROUP
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes
-EOF'
+EOF"
elif is_suse && [[ $os_RELEASE = 12.2 || "$os_VENDOR" = "SUSE LINUX" ]]; then
# openSUSE < 12.3 or SLE
# Work around the fact that polkit-default-privs overrules pklas
@@ -338,10 +338,10 @@
# The user that nova runs as needs to be member of **libvirtd** group otherwise
# nova-compute will be unable to use libvirt.
- if ! getent group libvirtd >/dev/null; then
- sudo groupadd libvirtd
+ if ! getent group $LIBVIRT_GROUP >/dev/null; then
+ sudo groupadd $LIBVIRT_GROUP
fi
- add_user_to_group $STACK_USER libvirtd
+ add_user_to_group $STACK_USER $LIBVIRT_GROUP
# libvirt detects various settings on startup, as we potentially changed
# the system configuration (modules, filesystems), we need to restart
@@ -648,11 +648,11 @@
# start_nova() - Start running processes, including screen
function start_nova() {
- # The group **libvirtd** is added to the current user in this script.
- # Use 'sg' to execute nova-compute as a member of the **libvirtd** group.
+ # The group **$LIBVIRT_GROUP** is added to the current user in this script.
+ # Use 'sg' to execute nova-compute as a member of the **$LIBVIRT_GROUP** group.
# ``screen_it`` checks ``is_service_enabled``, it is not needed here
screen_it n-cond "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-conductor"
- screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_BIN_DIR/nova-compute"
+ screen_it n-cpu "cd $NOVA_DIR && sg $LIBVIRT_GROUP $NOVA_BIN_DIR/nova-compute"
screen_it n-crt "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cert"
screen_it n-net "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-network"
screen_it n-sch "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-scheduler"
diff --git a/stack.sh b/stack.sh
index 32a7d74..40a068f 100755
--- a/stack.sh
+++ b/stack.sh
@@ -32,6 +32,15 @@
# and ``DISTRO``
GetDistro
+# Some dependencies are not available in Debian Wheezy official
+# repositories. However, it's possible to run OpenStack from gplhost
+# repository.
+if [[ "$os_VENDOR" =~ (Debian) ]]; then
+ echo 'deb http://archive.gplhost.com/debian grizzly main' | sudo tee /etc/apt/sources.list.d/gplhost_wheezy-backports.list
+ echo 'deb http://archive.gplhost.com/debian grizzly-backports main' | sudo tee -a /etc/apt/sources.list.d/gplhost_wheezy-backports.list
+ apt_get update
+ apt_get install --force-yes gplhost-archive-keyring
+fi
# Global Settings
# ===============
@@ -105,7 +114,7 @@
# Warn users who aren't on an explicitly supported distro, but allow them to
# override check and attempt installation with ``FORCE=yes ./stack``
-if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|raring|saucy|f16|f17|f18|opensuse-12.2|rhel6) ]]; then
+if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|raring|saucy|7.0|wheezy|sid|testing|jessie|f16|f17|f18|opensuse-12.2|rhel6) ]]; then
echo "WARNING: this script has not been tested on $DISTRO"
if [[ "$FORCE" != "yes" ]]; then
die $LINENO "If you wish to run this script anyway run with FORCE=yes"
diff --git a/stackrc b/stackrc
index f99eab1..6d6f7bf 100644
--- a/stackrc
+++ b/stackrc
@@ -162,6 +162,11 @@
# also install an **LXC** or **OpenVZ** based system.
VIRT_DRIVER=${VIRT_DRIVER:-libvirt}
LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
+if [[ "$os_VENDOR" =~ (Debian) ]]; then
+ LIBVIRT_GROUP=libvirt
+else
+ LIBVIRT_GROUP=libvirtd
+fi
# Specify a comma-separated list of UEC images to download and install into glance.
# supported urls here are: