@@ -112,6 +112,13 @@ else
112112 NOVA_ROOTWRAP=/usr/bin/nova-rootwrap
113113fi
114114
115+ # ``stack.sh`` keeps function libraries here
116+ # Make sure ``$TOP_DIR/lib`` directory is present
117+ if [ ! -d $TOP_DIR /lib ]; then
118+ echo " ERROR: missing devstack/lib - did you grab more than just stack.sh?"
119+ exit 1
120+ fi
121+
115122# stack.sh keeps the list of ``apt`` and ``pip`` dependencies in external
116123# files, along with config templates and other useful files. You can find these
117124# in the ``files`` directory (next to this script). We will reference this
@@ -130,6 +137,12 @@ if type -p screen >/dev/null && screen -ls | egrep -q "[0-9].stack"; then
130137 exit 1
131138fi
132139
140+ # Make sure we only have one volume service enabled.
141+ if is_service_enabled cinder && is_service_enabled n-vol; then
142+ echo " ERROR: n-vol and cinder must not be enabled at the same time"
143+ exit 1
144+ fi
145+
133146# OpenStack is designed to be run as a regular user (Horizon will fail to run
134147# as root, since apache refused to startup serve content from root user). If
135148# ``stack.sh`` is run as **root**, it automatically creates a **stack** user with
201214# prerequisites and initialize ``$DEST``.
202215OFFLINE=` trueorfalse False $OFFLINE `
203216
217+ # Destination path for service data
218+ DATA_DIR=${DATA_DIR:- ${DEST} / data}
219+ sudo mkdir -p $DATA_DIR
220+ sudo chown ` whoami` $DATA_DIR
221+
222+
223+ # Projects
224+ # --------
225+
226+ # Get project function libraries
227+ source $TOP_DIR /lib/cinder
228+
229+
204230# Set the destination directories for openstack projects
205231NOVA_DIR=$DEST /nova
206232HORIZON_DIR=$DEST /horizon
@@ -234,7 +260,7 @@ M_HOST=${M_HOST:-localhost}
234260M_MAC_RANGE=${M_MAC_RANGE:- FE-EE-DD-00-00-00/ 24}
235261
236262# Name of the lvm volume group to use/create for iscsi volumes
237- VOLUME_GROUP=${VOLUME_GROUP:- nova -volumes}
263+ VOLUME_GROUP=${VOLUME_GROUP:- stack -volumes}
238264VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:- volume-}
239265INSTANCE_NAME_PREFIX=${INSTANCE_NAME_PREFIX:- instance-}
240266
@@ -607,6 +633,10 @@ function get_packages() {
607633 if [[ ! $file_to_parse =~ glance ]]; then
608634 file_to_parse=" ${file_to_parse} glance"
609635 fi
636+ elif [[ $service == c-* ]]; then
637+ if [[ ! $file_to_parse =~ cinder ]]; then
638+ file_to_parse=" ${file_to_parse} cinder"
639+ fi
610640 elif [[ $service == n-* ]]; then
611641 if [[ ! $file_to_parse =~ nova ]]; then
612642 file_to_parse=" ${file_to_parse} nova"
@@ -704,10 +734,12 @@ if is_service_enabled m-svc; then
704734 # melange
705735 git_clone $MELANGE_REPO $MELANGE_DIR $MELANGE_BRANCH
706736fi
707-
708737if is_service_enabled melange; then
709738 git_clone $MELANGECLIENT_REPO $MELANGECLIENT_DIR $MELANGECLIENT_BRANCH
710739fi
740+ if is_service_enabled cinder; then
741+ install_cinder
742+ fi
711743
712744
713745# Initialization
743775if is_service_enabled melange; then
744776 setup_develop $MELANGECLIENT_DIR
745777fi
778+ if is_service_enabled cinder; then
779+ configure_cinder
780+ fi
746781
747782# Do this _after_ glance is installed to override the old binary
748783setup_develop $GLANCECLIENT_DIR
@@ -1643,17 +1678,18 @@ fi
16431678# Volume Service
16441679# --------------
16451680
1646- if is_service_enabled n-vol; then
1647- #
1648- # Configure a default volume group called 'nova-volumes' for the nova-volume
1681+ if is_service_enabled cinder; then
1682+ init_cinder
1683+ elif is_service_enabled n-vol; then
1684+ # Configure a default volume group called '` stack-volumes` ' for the volume
16491685 # service if it does not yet exist. If you don't wish to use a file backed
1650- # volume group, create your own volume group called 'nova -volumes' before
1651- # invoking stack.sh.
1686+ # volume group, create your own volume group called ` ` stack -volumes` ` before
1687+ # invoking ` ` stack.sh` ` .
16521688 #
1653- # By default, the backing file is 2G in size, and is stored in /opt/stack.
1689+ # By default, the backing file is 2G in size, and is stored in ` ` /opt/stack/data ` ` .
16541690
16551691 if ! sudo vgs $VOLUME_GROUP ; then
1656- VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:- $DEST / nova-volumes -backing-file}
1692+ VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:- $DATA_DIR / ${VOLUME_GROUP} -backing-file}
16571693 VOLUME_BACKING_FILE_SIZE=${VOLUME_BACKING_FILE_SIZE:- 2052M}
16581694 # Only create if the file doesn't already exists
16591695 [[ -f $VOLUME_BACKING_FILE ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE
@@ -1801,6 +1837,10 @@ else
18011837 add_nova_opt "logging_context_format_string=%(asctime)s %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
18021838fi
18031839
1840+ # If cinder is enabled, use the cinder volume driver
1841+ if is_service_enabled cinder; then
1842+ add_nova_opt "volume_api_class=nova.volume.cinder.API"
1843+ fi
18041844
18051845# Provide some transition from EXTRA_FLAGS to EXTRA_OPTS
18061846if [[ -z "$EXTRA_OPTS " && -n "$EXTRA_FLAGS " ]]; then
19682008
19692009# launch the nova-api and wait for it to answer before continuing
19702010if is_service_enabled n-api; then
2011+ add_nova_opt "enabled_apis=$NOVA_ENABLED_APIS "
19712012 screen_it n-api "cd $NOVA_DIR && $NOVA_DIR /bin/nova-api"
19722013 echo "Waiting for nova-api to start..."
19732014 if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://127.0.0.1:8774; do sleep 1; done"; then
@@ -2003,6 +2044,9 @@ screen_it n-sch "cd $NOVA_DIR && $NOVA_DIR/bin/nova-scheduler"
20032044screen_it n-novnc "cd $NOVNC_DIR && ./utils/nova-novncproxy --config-file $NOVA_CONF_DIR /$NOVA_CONF --web ."
20042045screen_it n-xvnc "cd $NOVA_DIR && ./bin/nova-xvpvncproxy --config-file $NOVA_CONF_DIR /$NOVA_CONF "
20052046screen_it n-cauth "cd $NOVA_DIR && ./bin/nova-consoleauth"
2047+ if is_service_enabled cinder; then
2048+ start_cinder
2049+ fi
20062050screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/$APACHE_NAME /horizon_error.log"
20072051screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR /bin/swift-proxy-server ${SWIFT_CONFIG_DIR} /proxy-server.conf -v"
20082052
0 commit comments