Highlights:
* Add files/rpms/*
* get_packages() only loads deps for services that are enabled
11Apr2012
* change mod_wsgi cwd to $HORIZON_DIR
* fix horizon apache log file name and location
Note: This superceeds https://review.openstack.org/4364
Change-Id: I95486584561e4418907a6a4feb0ffbe4f4ea1843
... | ... |
@@ -2,7 +2,7 @@ DevStack is a set of scripts and utilities to quickly deploy an OpenStack cloud. |
2 | 2 |
|
3 | 3 |
# Goals |
4 | 4 |
|
5 |
-* To quickly build dev OpenStack environments in a clean Oneiric or Precise environment |
|
5 |
+* To quickly build dev OpenStack environments in a clean Ubuntu or Fedora environment |
|
6 | 6 |
* To describe working configurations of OpenStack (which code branches work together? what do config files look like for those branches?) |
7 | 7 |
* To make it easier for developers to dive into OpenStack so that they can productively contribute without having to understand every part of the system at once |
8 | 8 |
* To make it easy to prototype cross-project features |
9 | 9 |
deleted file mode 100644 |
... | ... |
@@ -1,28 +0,0 @@ |
1 |
-<VirtualHost *:80> |
|
2 |
- WSGIScriptAlias / %HORIZON_DIR%/openstack_dashboard/wsgi/django.wsgi |
|
3 |
- WSGIDaemonProcess horizon user=%USER% group=%GROUP% processes=3 threads=10 |
|
4 |
- SetEnv APACHE_RUN_USER %USER% |
|
5 |
- SetEnv APACHE_RUN_GROUP %GROUP% |
|
6 |
- WSGIProcessGroup horizon |
|
7 |
- |
|
8 |
- DocumentRoot %HORIZON_DIR%/.blackhole/ |
|
9 |
- Alias /media %HORIZON_DIR%/openstack_dashboard/static |
|
10 |
- Alias /vpn /opt/stack/vpn |
|
11 |
- |
|
12 |
- <Directory /> |
|
13 |
- Options FollowSymLinks |
|
14 |
- AllowOverride None |
|
15 |
- </Directory> |
|
16 |
- |
|
17 |
- <Directory %HORIZON_DIR%/> |
|
18 |
- Options Indexes FollowSymLinks MultiViews |
|
19 |
- AllowOverride None |
|
20 |
- Order allow,deny |
|
21 |
- allow from all |
|
22 |
- </Directory> |
|
23 |
- |
|
24 |
- ErrorLog /var/log/apache2/error.log |
|
25 |
- LogLevel warn |
|
26 |
- CustomLog /var/log/apache2/access.log combined |
|
27 |
-</VirtualHost> |
|
28 |
- |
29 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,29 @@ |
0 |
+<VirtualHost *:80> |
|
1 |
+ WSGIScriptAlias / %HORIZON_DIR%/openstack_dashboard/wsgi/django.wsgi |
|
2 |
+ WSGIDaemonProcess horizon user=%USER% group=%GROUP% processes=3 threads=10 home=%HORIZON_DIR% |
|
3 |
+ |
|
4 |
+ SetEnv APACHE_RUN_USER %USER% |
|
5 |
+ SetEnv APACHE_RUN_GROUP %GROUP% |
|
6 |
+ WSGIProcessGroup horizon |
|
7 |
+ |
|
8 |
+ DocumentRoot %HORIZON_DIR%/.blackhole/ |
|
9 |
+ Alias /media %HORIZON_DIR%/openstack_dashboard/static |
|
10 |
+ |
|
11 |
+ <Directory /> |
|
12 |
+ Options FollowSymLinks |
|
13 |
+ AllowOverride None |
|
14 |
+ </Directory> |
|
15 |
+ |
|
16 |
+ <Directory %HORIZON_DIR%/> |
|
17 |
+ Options Indexes FollowSymLinks MultiViews |
|
18 |
+ AllowOverride None |
|
19 |
+ Order allow,deny |
|
20 |
+ allow from all |
|
21 |
+ </Directory> |
|
22 |
+ |
|
23 |
+ ErrorLog /var/log/%APACHE_NAME%/horizon_error.log |
|
24 |
+ LogLevel warn |
|
25 |
+ CustomLog /var/log/%APACHE_NAME%/horizon_access.log combined |
|
26 |
+</VirtualHost> |
|
27 |
+ |
|
28 |
+WSGISocketPrefix /var/run/%APACHE_NAME% |
0 | 8 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,25 @@ |
0 |
+Django |
|
1 |
+django-registration |
|
2 |
+gcc |
|
3 |
+httpd # NOPRIME |
|
4 |
+mod_wsgi # NOPRIME |
|
5 |
+pylint |
|
6 |
+python-anyjson |
|
7 |
+python-boto |
|
8 |
+python-coverage |
|
9 |
+python-dateutil |
|
10 |
+python-eventlet |
|
11 |
+python-greenlet |
|
12 |
+python-httplib2 |
|
13 |
+python-kombu |
|
14 |
+python-migrate |
|
15 |
+python-mox |
|
16 |
+python-nose |
|
17 |
+python-paste |
|
18 |
+python-paste-deploy |
|
19 |
+python-pep8 |
|
20 |
+python-routes |
|
21 |
+python-sphinx |
|
22 |
+python-sqlalchemy |
|
23 |
+python-webob |
|
24 |
+pyxattr |
0 | 2 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,39 @@ |
0 |
+MySQL-python |
|
1 |
+curl |
|
2 |
+dnsmasq-utils # for dhcp_release |
|
3 |
+ebtables |
|
4 |
+gawk |
|
5 |
+iptables |
|
6 |
+iputils |
|
7 |
+kpartx |
|
8 |
+kvm |
|
9 |
+libvirt-bin # NOPRIME |
|
10 |
+libvirt-python |
|
11 |
+libxml2-python |
|
12 |
+m2crypto |
|
13 |
+mysql-server # NOPRIME |
|
14 |
+parted |
|
15 |
+python-boto |
|
16 |
+python-carrot |
|
17 |
+python-cheetah |
|
18 |
+python-eventlet |
|
19 |
+python-feedparser |
|
20 |
+python-gflags |
|
21 |
+python-greenlet |
|
22 |
+python-iso8601 |
|
23 |
+python-kombu |
|
24 |
+python-lockfile |
|
25 |
+python-migrate |
|
26 |
+python-mox |
|
27 |
+python-netaddr |
|
28 |
+python-paramiko |
|
29 |
+python-paste |
|
30 |
+python-paste-deploy |
|
31 |
+python-routes |
|
32 |
+python-sqlalchemy |
|
33 |
+python-suds |
|
34 |
+python-tempita |
|
35 |
+rabbitmq-server # NOPRIME |
|
36 |
+sqlite |
|
37 |
+sudo |
|
38 |
+vconfig |
0 | 39 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,18 @@ |
0 |
+curl |
|
1 |
+gcc |
|
2 |
+memcached # NOPRIME |
|
3 |
+python-configobj |
|
4 |
+python-coverage |
|
5 |
+python-devel |
|
6 |
+python-eventlet |
|
7 |
+python-greenlet |
|
8 |
+python-netifaces |
|
9 |
+python-nose |
|
10 |
+python-paste-deploy |
|
11 |
+python-setuptools |
|
12 |
+python-simplejson |
|
13 |
+python-webob |
|
14 |
+pyxattr |
|
15 |
+sqlite |
|
16 |
+xfsprogs |
|
17 |
+xinetd |
... | ... |
@@ -298,21 +298,42 @@ function pip_install { |
298 | 298 |
# Service wrapper to restart services |
299 | 299 |
# restart_service service-name |
300 | 300 |
function restart_service() { |
301 |
- sudo /usr/sbin/service $1 restart |
|
301 |
+ if [[ -z "$os_PACKAGE" ]]; then |
|
302 |
+ GetOSVersion |
|
303 |
+ fi |
|
304 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
305 |
+ sudo /usr/sbin/service $1 restart |
|
306 |
+ else |
|
307 |
+ sudo /sbin/service $1 restart |
|
308 |
+ fi |
|
302 | 309 |
} |
303 | 310 |
|
304 | 311 |
|
305 | 312 |
# Service wrapper to start services |
306 | 313 |
# start_service service-name |
307 | 314 |
function start_service() { |
308 |
- sudo /usr/sbin/service $1 start |
|
315 |
+ if [[ -z "$os_PACKAGE" ]]; then |
|
316 |
+ GetOSVersion |
|
317 |
+ fi |
|
318 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
319 |
+ sudo /usr/sbin/service $1 start |
|
320 |
+ else |
|
321 |
+ sudo /sbin/service $1 start |
|
322 |
+ fi |
|
309 | 323 |
} |
310 | 324 |
|
311 | 325 |
|
312 | 326 |
# Service wrapper to stop services |
313 | 327 |
# stop_service service-name |
314 | 328 |
function stop_service() { |
315 |
- sudo /usr/sbin/service $1 stop |
|
329 |
+ if [[ -z "$os_PACKAGE" ]]; then |
|
330 |
+ GetOSVersion |
|
331 |
+ fi |
|
332 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
333 |
+ sudo /usr/sbin/service $1 stop |
|
334 |
+ else |
|
335 |
+ sudo /sbin/service $1 stop |
|
336 |
+ fi |
|
316 | 337 |
} |
317 | 338 |
|
318 | 339 |
|
... | ... |
@@ -32,6 +32,9 @@ GetOSVersion |
32 | 32 |
if [[ "$os_VENDOR" =~ (Ubuntu) ]]; then |
33 | 33 |
# 'Everyone' refers to Ubuntu releases by the code name adjective |
34 | 34 |
DISTRO=$os_CODENAME |
35 |
+elif [[ "$os_VENDOR" =~ (Fedora) ]]; then |
|
36 |
+ # For Fedora, just use 'f' and the release |
|
37 |
+ DISTRO="f$os_RELEASE" |
|
35 | 38 |
else |
36 | 39 |
# Catch-all for now is Vendor + Release + Update |
37 | 40 |
DISTRO="$os_VENDOR-$os_RELEASE.$os_UPDATE" |
... | ... |
@@ -72,7 +75,7 @@ if [[ ! -r $TOP_DIR/stackrc ]]; then |
72 | 72 |
echo "ERROR: missing $TOP_DIR/stackrc - did you grab more than just stack.sh?" |
73 | 73 |
exit 1 |
74 | 74 |
fi |
75 |
-source ./stackrc |
|
75 |
+source $TOP_DIR/stackrc |
|
76 | 76 |
|
77 | 77 |
# Destination path for installation ``DEST`` |
78 | 78 |
DEST=${DEST:-/opt/stack} |
... | ... |
@@ -83,14 +86,21 @@ DEST=${DEST:-/opt/stack} |
83 | 83 |
|
84 | 84 |
# Warn users who aren't on an explicitly supported distro, but allow them to |
85 | 85 |
# override check and attempt installation with ``FORCE=yes ./stack`` |
86 |
-if [[ ! ${DISTRO} =~ (oneiric|precise) ]]; then |
|
87 |
- echo "WARNING: this script has only been tested on oneiric and precise" |
|
86 |
+if [[ ! ${DISTRO} =~ (oneiric|precise|f16) ]]; then |
|
87 |
+ echo "WARNING: this script has been tested on oneiric, precise and f16" |
|
88 | 88 |
if [[ "$FORCE" != "yes" ]]; then |
89 | 89 |
echo "If you wish to run this script anyway run with FORCE=yes" |
90 | 90 |
exit 1 |
91 | 91 |
fi |
92 | 92 |
fi |
93 | 93 |
|
94 |
+# Set the paths of certain binaries |
|
95 |
+if [[ "$os_PACKAGE" = "deb" ]]; then |
|
96 |
+ NOVA_ROOTWRAP=/usr/local/bin/nova-rootwrap |
|
97 |
+else |
|
98 |
+ NOVA_ROOTWRAP=/usr/bin/nova-rootwrap |
|
99 |
+fi |
|
100 |
+ |
|
94 | 101 |
# stack.sh keeps the list of ``apt`` and ``pip`` dependencies in external |
95 | 102 |
# files, along with config templates and other useful files. You can find these |
96 | 103 |
# in the ``files`` directory (next to this script). We will reference this |
... | ... |
@@ -122,11 +132,16 @@ if [[ $EUID -eq 0 ]]; then |
122 | 122 |
|
123 | 123 |
# since this script runs as a normal user, we need to give that user |
124 | 124 |
# ability to run sudo |
125 |
- dpkg -l sudo || apt_get update && install_package sudo |
|
126 |
- |
|
125 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
126 |
+ dpkg -l sudo || apt_get update && install_package sudo |
|
127 |
+ STACK_GROUP=sudo |
|
128 |
+ else |
|
129 |
+ rpm -qa | grep sudo || install_package sudo |
|
130 |
+ STACK_GROUP=wheel |
|
131 |
+ fi |
|
127 | 132 |
if ! getent passwd stack >/dev/null; then |
128 | 133 |
echo "Creating a user called stack" |
129 |
- useradd -U -G sudo -s /bin/bash -d $DEST -m stack |
|
134 |
+ useradd -U -G $STACK_GROUP -s /bin/bash -d $DEST -m stack |
|
130 | 135 |
fi |
131 | 136 |
|
132 | 137 |
echo "Giving stack user passwordless sudo priviledges" |
... | ... |
@@ -148,7 +163,12 @@ if [[ $EUID -eq 0 ]]; then |
148 | 148 |
exit 1 |
149 | 149 |
else |
150 | 150 |
# We're not root, make sure sudo is available |
151 |
- dpkg -l sudo || die "Sudo is required. Re-run stack.sh as root ONE TIME ONLY to set up sudo." |
|
151 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
152 |
+ CHECK_SUDO_CMD="dpkg -l sudo" |
|
153 |
+ else |
|
154 |
+ CHECK_SUDO_CMD="rpm -q sudo" |
|
155 |
+ fi |
|
156 |
+ $CHECK_SUDO_CMD || die "Sudo is required. Re-run stack.sh as root ONE TIME ONLY to set up sudo." |
|
152 | 157 |
|
153 | 158 |
# UEC images /etc/sudoers does not have a '#includedir'. add one. |
154 | 159 |
sudo grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers || |
... | ... |
@@ -163,7 +183,7 @@ else |
163 | 163 |
|
164 | 164 |
# Set up the rootwrap sudoers |
165 | 165 |
TEMPFILE=`mktemp` |
166 |
- echo "$USER ALL=(root) NOPASSWD: /usr/local/bin/nova-rootwrap" >$TEMPFILE |
|
166 |
+ echo "$USER ALL=(root) NOPASSWD: $NOVA_ROOTWRAP" >$TEMPFILE |
|
167 | 167 |
chmod 0440 $TEMPFILE |
168 | 168 |
sudo chown root:root $TEMPFILE |
169 | 169 |
sudo mv $TEMPFILE /etc/sudoers.d/nova-rootwrap |
... | ... |
@@ -549,6 +569,8 @@ fi |
549 | 549 |
# - ``# NOPRIME`` defers installation to be performed later in stack.sh |
550 | 550 |
# - ``# dist:DISTRO`` or ``dist:DISTRO1,DISTRO2`` limits the selection |
551 | 551 |
# of the package to the distros listed. The distro names are case insensitive. |
552 |
+# |
|
553 |
+# get_packages dir |
|
552 | 554 |
function get_packages() { |
553 | 555 |
local package_dir=$1 |
554 | 556 |
local file_to_parse |
... | ... |
@@ -558,7 +580,8 @@ function get_packages() { |
558 | 558 |
echo "No package directory supplied" |
559 | 559 |
return 1 |
560 | 560 |
fi |
561 |
- for service in general ${ENABLED_SERVICES//,/ }; do # Allow individual services to specify dependencies |
|
561 |
+ for service in general ${ENABLED_SERVICES//,/ }; do |
|
562 |
+ # Allow individual services to specify dependencies |
|
562 | 563 |
if [[ -e ${package_dir}/${service} ]]; then |
563 | 564 |
file_to_parse="${file_to_parse} $service" |
564 | 565 |
fi |
... | ... |
@@ -604,9 +627,13 @@ function get_packages() { |
604 | 604 |
done |
605 | 605 |
} |
606 | 606 |
|
607 |
-# install apt requirements |
|
608 |
-apt_get update |
|
609 |
-install_package $(get_packages $FILES/apts) |
|
607 |
+# install package requirements |
|
608 |
+if [[ "$os_PACKAGE" = "deb" ]]; then |
|
609 |
+ apt_get update |
|
610 |
+ install_package $(get_packages $FILES/apts) |
|
611 |
+else |
|
612 |
+ install_package $(get_packages $FILES/rpms) |
|
613 |
+fi |
|
610 | 614 |
|
611 | 615 |
# install python requirements |
612 | 616 |
pip_install $(get_packages $FILES/pips | sort -u) |
... | ... |
@@ -722,6 +749,10 @@ if is_service_enabled rabbit; then |
722 | 722 |
install_package rabbitmq-server > "$tfile" 2>&1 |
723 | 723 |
cat "$tfile" |
724 | 724 |
rm -f "$tfile" |
725 |
+ if [[ "$os_PACKAGE" = "rpm" ]]; then |
|
726 |
+ # RPM doesn't start the service |
|
727 |
+ restart_service rabbitmq-server |
|
728 |
+ fi |
|
725 | 729 |
# change the rabbit password since the default is "guest" |
726 | 730 |
sudo rabbitmqctl change_password guest $RABBIT_PASSWORD |
727 | 731 |
fi |
... | ... |
@@ -732,13 +763,15 @@ fi |
732 | 732 |
|
733 | 733 |
if is_service_enabled mysql; then |
734 | 734 |
|
735 |
- # Seed configuration with mysql password so that apt-get install doesn't |
|
736 |
- # prompt us for a password upon install. |
|
737 |
- cat <<MYSQL_PRESEED | sudo debconf-set-selections |
|
735 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
736 |
+ # Seed configuration with mysql password so that apt-get install doesn't |
|
737 |
+ # prompt us for a password upon install. |
|
738 |
+ cat <<MYSQL_PRESEED | sudo debconf-set-selections |
|
738 | 739 |
mysql-server-5.1 mysql-server/root_password password $MYSQL_PASSWORD |
739 | 740 |
mysql-server-5.1 mysql-server/root_password_again password $MYSQL_PASSWORD |
740 | 741 |
mysql-server-5.1 mysql-server/start_on_boot boolean true |
741 | 742 |
MYSQL_PRESEED |
743 |
+ fi |
|
742 | 744 |
|
743 | 745 |
# while ``.my.cnf`` is not needed for openstack to function, it is useful |
744 | 746 |
# as it allows you to access the mysql databases via ``mysql nova`` instead |
... | ... |
@@ -755,12 +788,25 @@ EOF |
755 | 755 |
|
756 | 756 |
# Install and start mysql-server |
757 | 757 |
install_package mysql-server |
758 |
+ if [[ "$os_PACKAGE" = "rpm" ]]; then |
|
759 |
+ # RPM doesn't start the service |
|
760 |
+ start_service mysqld |
|
761 |
+ # Set the root password - only works the first time |
|
762 |
+ sudo mysqladmin -u root password $MYSQL_PASSWORD || true |
|
763 |
+ fi |
|
758 | 764 |
# Update the DB to give user ‘$MYSQL_USER’@’%’ full control of the all databases: |
759 | 765 |
sudo mysql -uroot -p$MYSQL_PASSWORD -h127.0.0.1 -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' identified by '$MYSQL_PASSWORD';" |
760 | 766 |
|
761 | 767 |
# Edit /etc/mysql/my.cnf to change ‘bind-address’ from localhost (127.0.0.1) to any (0.0.0.0) and restart the mysql service: |
762 |
- sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf |
|
763 |
- restart_service mysql |
|
768 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
769 |
+ MY_CNF=/etc/mysql/my.cnf |
|
770 |
+ MYSQL=mysql |
|
771 |
+ else |
|
772 |
+ MY_CNF=/etc/my.cnf |
|
773 |
+ MYSQL=mysqld |
|
774 |
+ fi |
|
775 |
+ sudo sed -i 's/127.0.0.1/0.0.0.0/g' $MY_CNF |
|
776 |
+ restart_service $MYSQL |
|
764 | 777 |
fi |
765 | 778 |
|
766 | 779 |
if [ -z "$SCREEN_HARDSTATUS" ]; then |
... | ... |
@@ -820,10 +866,6 @@ screen -r stack -X hardstatus alwayslastline "$SCREEN_HARDSTATUS" |
820 | 820 |
|
821 | 821 |
if is_service_enabled horizon; then |
822 | 822 |
|
823 |
- # Install apache2, which is NOPRIME'd |
|
824 |
- install_package apache2 libapache2-mod-wsgi |
|
825 |
- |
|
826 |
- |
|
827 | 823 |
# Remove stale session database. |
828 | 824 |
rm -f $HORIZON_DIR/openstack_dashboard/local/dashboard_openstack.sqlite3 |
829 | 825 |
|
... | ... |
@@ -835,18 +877,38 @@ if is_service_enabled horizon; then |
835 | 835 |
# users). The user system is external (keystone). |
836 | 836 |
cd $HORIZON_DIR |
837 | 837 |
python manage.py syncdb |
838 |
+ cd $TOP_DIR |
|
838 | 839 |
|
839 | 840 |
# create an empty directory that apache uses as docroot |
840 | 841 |
sudo mkdir -p $HORIZON_DIR/.blackhole |
841 | 842 |
|
842 |
- ## Configure apache's 000-default to run horizon |
|
843 |
- sudo cp $FILES/000-default.template /etc/apache2/sites-enabled/000-default |
|
844 |
- sudo sed -e " |
|
843 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
844 |
+ # Install apache2, which is NOPRIME'd |
|
845 |
+ APACHE_NAME=apache2 |
|
846 |
+ APACHE_CONF=sites-available/horizon |
|
847 |
+ install_package apache2 libapache2-mod-wsgi |
|
848 |
+ # Clean up the old config name |
|
849 |
+ sudo rm -f /etc/apache2/sites-enabled/000-default |
|
850 |
+ # Be a good citizen and use the distro tools here |
|
851 |
+ sudo touch /etc/$APACHE_NAME/$APACHE_CONF |
|
852 |
+ sudo a2ensite horizon |
|
853 |
+ else |
|
854 |
+ # Install httpd, which is NOPRIME'd |
|
855 |
+ APACHE_NAME=httpd |
|
856 |
+ APACHE_CONF=conf.d/horizon.conf |
|
857 |
+ sudo rm -f /etc/httpd/conf.d/000-* |
|
858 |
+ install_package httpd mod_wsgi |
|
859 |
+ sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf |
|
860 |
+ fi |
|
861 |
+ ## Configure apache to run horizon |
|
862 |
+ sudo sh -c "sed -e \" |
|
845 | 863 |
s,%USER%,$APACHE_USER,g; |
846 | 864 |
s,%GROUP%,$APACHE_GROUP,g; |
847 | 865 |
s,%HORIZON_DIR%,$HORIZON_DIR,g; |
848 |
- " -i /etc/apache2/sites-enabled/000-default |
|
849 |
- restart_service apache2 |
|
866 |
+ s,%APACHE_NAME%,$APACHE_NAME,g; |
|
867 |
+ s,%DEST%,$DEST,g; |
|
868 |
+ \" $FILES/apache-horizon.template >/etc/$APACHE_NAME/$APACHE_CONF" |
|
869 |
+ restart_service $APACHE_NAME |
|
850 | 870 |
fi |
851 | 871 |
|
852 | 872 |
|
... | ... |
@@ -921,8 +983,13 @@ if is_service_enabled q-svc; then |
921 | 921 |
if [[ "$Q_PLUGIN" = "openvswitch" ]]; then |
922 | 922 |
# Install deps |
923 | 923 |
# FIXME add to files/apts/quantum, but don't install if not needed! |
924 |
- kernel_version=`cat /proc/version | cut -d " " -f3` |
|
925 |
- install_package openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version |
|
924 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
925 |
+ kernel_version=`cat /proc/version | cut -d " " -f3` |
|
926 |
+ install_package openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version |
|
927 |
+ else |
|
928 |
+ ### FIXME(dtroyer): Find RPMs for OpenVSwitch |
|
929 |
+ echo "OpenVSwitch packages need to be located" |
|
930 |
+ fi |
|
926 | 931 |
# Create database for the plugin/agent |
927 | 932 |
if is_service_enabled mysql; then |
928 | 933 |
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS ovs_quantum;' |
... | ... |
@@ -1044,7 +1111,12 @@ if is_service_enabled n-cpu; then |
1044 | 1044 |
|
1045 | 1045 |
# Virtualization Configuration |
1046 | 1046 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1047 |
- install_package libvirt-bin |
|
1047 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
1048 |
+ LIBVIRT_PKG_NAME=libvirt-bin |
|
1049 |
+ else |
|
1050 |
+ LIBVIRT_PKG_NAME=libvirt |
|
1051 |
+ fi |
|
1052 |
+ install_package $LIBVIRT_PKG_NAME |
|
1048 | 1053 |
|
1049 | 1054 |
# Force IP forwarding on, just on case |
1050 | 1055 |
sudo sysctl -w net.ipv4.ip_forward=1 |
... | ... |
@@ -1067,27 +1139,50 @@ if is_service_enabled n-cpu; then |
1067 | 1067 |
# splitting a system into many smaller parts. LXC uses cgroups and chroot |
1068 | 1068 |
# to simulate multiple systems. |
1069 | 1069 |
if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then |
1070 |
- if [[ "$DISTRO" > natty ]]; then |
|
1071 |
- install_package cgroup-lite |
|
1072 |
- else |
|
1073 |
- cgline="none /cgroup cgroup cpuacct,memory,devices,cpu,freezer,blkio 0 0" |
|
1074 |
- sudo mkdir -p /cgroup |
|
1075 |
- if ! grep -q cgroup /etc/fstab; then |
|
1076 |
- echo "$cgline" | sudo tee -a /etc/fstab |
|
1077 |
- fi |
|
1078 |
- if ! mount -n | grep -q cgroup; then |
|
1079 |
- sudo mount /cgroup |
|
1070 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
1071 |
+ if [[ "$DISTRO" > natty ]]; then |
|
1072 |
+ install_package cgroup-lite |
|
1073 |
+ else |
|
1074 |
+ cgline="none /cgroup cgroup cpuacct,memory,devices,cpu,freezer,blkio 0 0" |
|
1075 |
+ sudo mkdir -p /cgroup |
|
1076 |
+ if ! grep -q cgroup /etc/fstab; then |
|
1077 |
+ echo "$cgline" | sudo tee -a /etc/fstab |
|
1078 |
+ fi |
|
1079 |
+ if ! mount -n | grep -q cgroup; then |
|
1080 |
+ sudo mount /cgroup |
|
1081 |
+ fi |
|
1080 | 1082 |
fi |
1083 |
+ else |
|
1084 |
+ ### FIXME(dtroyer): figure this out |
|
1085 |
+ echo "RPM-based cgroup not implemented yet" |
|
1086 |
+ yum_install libcgroup-tools |
|
1081 | 1087 |
fi |
1082 | 1088 |
fi |
1083 | 1089 |
|
1090 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
1091 |
+ LIBVIRT_DAEMON=libvirt-bin |
|
1092 |
+ else |
|
1093 |
+ # http://wiki.libvirt.org/page/SSHPolicyKitSetup |
|
1094 |
+ if ! grep ^libvirtd: /etc/group >/dev/null; then |
|
1095 |
+ sudo groupadd libvirtd |
|
1096 |
+ fi |
|
1097 |
+ sudo bash -c 'cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla |
|
1098 |
+[libvirt Management Access] |
|
1099 |
+Identity=unix-group:libvirtd |
|
1100 |
+Action=org.libvirt.unix.manage |
|
1101 |
+ResultAny=yes |
|
1102 |
+ResultInactive=yes |
|
1103 |
+ResultActive=yes |
|
1104 |
+EOF' |
|
1105 |
+ LIBVIRT_DAEMON=libvirtd |
|
1106 |
+ fi |
|
1084 | 1107 |
# The user that nova runs as needs to be member of libvirtd group otherwise |
1085 | 1108 |
# nova-compute will be unable to use libvirt. |
1086 | 1109 |
sudo usermod -a -G libvirtd `whoami` |
1087 | 1110 |
# libvirt detects various settings on startup, as we potentially changed |
1088 | 1111 |
# the system configuration (modules, filesystems), we need to restart |
1089 | 1112 |
# libvirt to detect those changes. |
1090 |
- restart_service libvirt-bin |
|
1113 |
+ restart_service $LIBVIRT_DAEMON |
|
1091 | 1114 |
|
1092 | 1115 |
|
1093 | 1116 |
# Instance Storage |
... | ... |
@@ -1202,7 +1297,11 @@ if is_service_enabled swift; then |
1202 | 1202 |
s/%USER%/$USER/; |
1203 | 1203 |
s,%SWIFT_DATA_DIR%,$SWIFT_DATA_DIR,; |
1204 | 1204 |
" $FILES/swift/rsyncd.conf | sudo tee /etc/rsyncd.conf |
1205 |
- sudo sed -i '/^RSYNC_ENABLE=false/ { s/false/true/ }' /etc/default/rsync |
|
1205 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
1206 |
+ sudo sed -i '/^RSYNC_ENABLE=false/ { s/false/true/ }' /etc/default/rsync |
|
1207 |
+ else |
|
1208 |
+ sudo sed -i '/disable *= *yes/ { s/yes/no/ }' /etc/xinetd.d/rsync |
|
1209 |
+ fi |
|
1206 | 1210 |
|
1207 | 1211 |
# By default Swift will be installed with the tempauth middleware |
1208 | 1212 |
# which has some default username and password if you have |
... | ... |
@@ -1267,10 +1366,10 @@ if is_service_enabled swift; then |
1267 | 1267 |
swift_log_dir=${SWIFT_DATA_DIR}/logs |
1268 | 1268 |
rm -rf ${swift_log_dir} |
1269 | 1269 |
mkdir -p ${swift_log_dir}/hourly |
1270 |
- sudo chown -R syslog:adm ${swift_log_dir} |
|
1270 |
+ sudo chown -R $USER:adm ${swift_log_dir} |
|
1271 | 1271 |
sed "s,%SWIFT_LOGDIR%,${swift_log_dir}," $FILES/swift/rsyslog.conf | sudo \ |
1272 | 1272 |
tee /etc/rsyslog.d/10-swift.conf |
1273 |
- sudo restart rsyslog |
|
1273 |
+ restart_service rsyslog |
|
1274 | 1274 |
|
1275 | 1275 |
# This is where we create three different rings for swift with |
1276 | 1276 |
# different object servers binding on different ports. |
... | ... |
@@ -1304,10 +1403,12 @@ if is_service_enabled swift; then |
1304 | 1304 |
|
1305 | 1305 |
} && popd >/dev/null |
1306 | 1306 |
|
1307 |
- sudo chmod +x /usr/local/bin/swift-* |
|
1308 |
- |
|
1309 | 1307 |
# We then can start rsync. |
1310 |
- sudo /etc/init.d/rsync restart || : |
|
1308 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
1309 |
+ sudo /etc/init.d/rsync restart || : |
|
1310 |
+ else |
|
1311 |
+ sudo systemctl start xinetd.service |
|
1312 |
+ fi |
|
1311 | 1313 |
|
1312 | 1314 |
# First spawn all the swift services then kill the |
1313 | 1315 |
# proxy service so we can run it in foreground in screen. |
... | ... |
@@ -1332,9 +1433,6 @@ if is_service_enabled n-vol; then |
1332 | 1332 |
# |
1333 | 1333 |
# By default, the backing file is 2G in size, and is stored in /opt/stack. |
1334 | 1334 |
|
1335 |
- # install the package |
|
1336 |
- install_package tgt |
|
1337 |
- |
|
1338 | 1335 |
if ! sudo vgs $VOLUME_GROUP; then |
1339 | 1336 |
VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:-$DEST/nova-volumes-backing-file} |
1340 | 1337 |
VOLUME_BACKING_FILE_SIZE=${VOLUME_BACKING_FILE_SIZE:-2052M} |
... | ... |
@@ -1357,10 +1455,15 @@ if is_service_enabled n-vol; then |
1357 | 1357 |
done |
1358 | 1358 |
fi |
1359 | 1359 |
|
1360 |
- # tgt in oneiric doesn't restart properly if tgtd isn't running |
|
1361 |
- # do it in two steps |
|
1362 |
- sudo stop tgt || true |
|
1363 |
- sudo start tgt |
|
1360 |
+ if [[ "$os_PACKAGE" = "deb" ]]; then |
|
1361 |
+ # tgt in oneiric doesn't restart properly if tgtd isn't running |
|
1362 |
+ # do it in two steps |
|
1363 |
+ sudo stop tgt || true |
|
1364 |
+ sudo start tgt |
|
1365 |
+ else |
|
1366 |
+ # bypass redirection to systemctl during restart |
|
1367 |
+ sudo /sbin/service --skip-redirect tgtd restart |
|
1368 |
+ fi |
|
1364 | 1369 |
fi |
1365 | 1370 |
|
1366 | 1371 |
NOVA_CONF=nova.conf |
... | ... |
@@ -1377,7 +1480,7 @@ add_nova_opt "[DEFAULT]" |
1377 | 1377 |
add_nova_opt "verbose=True" |
1378 | 1378 |
add_nova_opt "auth_strategy=keystone" |
1379 | 1379 |
add_nova_opt "allow_resize_to_same_host=True" |
1380 |
-add_nova_opt "root_helper=sudo /usr/local/bin/nova-rootwrap" |
|
1380 |
+add_nova_opt "root_helper=sudo $NOVA_ROOTWRAP" |
|
1381 | 1381 |
add_nova_opt "compute_scheduler_driver=$SCHEDULER" |
1382 | 1382 |
add_nova_opt "dhcpbridge_flagfile=$NOVA_CONF_DIR/$NOVA_CONF" |
1383 | 1383 |
add_nova_opt "fixed_range=$FIXED_RANGE" |
... | ... |
@@ -1661,7 +1764,7 @@ screen_it n-sch "cd $NOVA_DIR && $NOVA_DIR/bin/nova-scheduler" |
1661 | 1661 |
screen_it n-novnc "cd $NOVNC_DIR && ./utils/nova-novncproxy --config-file $NOVA_CONF_DIR/$NOVA_CONF --web ." |
1662 | 1662 |
screen_it n-xvnc "cd $NOVA_DIR && ./bin/nova-xvpvncproxy --config-file $NOVA_CONF_DIR/$NOVA_CONF" |
1663 | 1663 |
screen_it n-cauth "cd $NOVA_DIR && ./bin/nova-consoleauth" |
1664 |
-screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/apache2/error.log" |
|
1664 |
+screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/$APACHE_NAME/horizon_error.log" |
|
1665 | 1665 |
screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v" |
1666 | 1666 |
|
1667 | 1667 |
# Starting the nova-objectstore only if swift service is not enabled. |