| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 1 | # lib/nova | 
| Dean Troyer | 6d04fd7 | 2012-12-21 11:03:37 -0600 | [diff] [blame] | 2 | # Functions to control the configuration and operation of the **Nova** service | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 3 |  | 
|  | 4 | # Dependencies: | 
|  | 5 | # ``functions`` file | 
| Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 6 | # ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 7 | # ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined | 
|  | 8 | # ``LIBVIRT_TYPE`` must be defined | 
|  | 9 | # ``INSTANCE_NAME_PREFIX``, ``VOLUME_NAME_PREFIX`` must be defined | 
| Dean Troyer | bc071bc | 2012-10-01 14:06:44 -0500 | [diff] [blame] | 10 | # ``KEYSTONE_TOKEN_FORMAT`` must be defined | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 11 |  | 
|  | 12 | # ``stack.sh`` calls the entry points in this order: | 
|  | 13 | # | 
|  | 14 | # install_nova | 
|  | 15 | # configure_nova | 
| Dean Troyer | da7b809 | 2012-10-08 18:12:14 -0500 | [diff] [blame] | 16 | # create_nova_conf | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 17 | # init_nova | 
|  | 18 | # start_nova | 
|  | 19 | # stop_nova | 
|  | 20 | # cleanup_nova | 
|  | 21 |  | 
|  | 22 | # Save trace setting | 
|  | 23 | XTRACE=$(set +o | grep xtrace) | 
|  | 24 | set +o xtrace | 
|  | 25 |  | 
|  | 26 |  | 
|  | 27 | # Defaults | 
|  | 28 | # -------- | 
|  | 29 |  | 
|  | 30 | # Set up default directories | 
|  | 31 | NOVA_DIR=$DEST/nova | 
|  | 32 | NOVACLIENT_DIR=$DEST/python-novaclient | 
|  | 33 | NOVA_STATE_PATH=${NOVA_STATE_PATH:=$DATA_DIR/nova} | 
|  | 34 | # INSTANCES_PATH is the previous name for this | 
|  | 35 | NOVA_INSTANCES_PATH=${NOVA_INSTANCES_PATH:=${INSTANCES_PATH:=$NOVA_STATE_PATH/instances}} | 
| Dean Troyer | bc071bc | 2012-10-01 14:06:44 -0500 | [diff] [blame] | 36 | NOVA_AUTH_CACHE_DIR=${NOVA_AUTH_CACHE_DIR:-/var/cache/nova} | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 37 |  | 
|  | 38 | NOVA_CONF_DIR=/etc/nova | 
|  | 39 | NOVA_CONF=$NOVA_CONF_DIR/nova.conf | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 40 | NOVA_CELLS_CONF=$NOVA_CONF_DIR/nova-cells.conf | 
|  | 41 | NOVA_CELLS_DB=${NOVA_CELLS_DB:-nova_cell} | 
|  | 42 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 43 | NOVA_API_PASTE_INI=${NOVA_API_PASTE_INI:-$NOVA_CONF_DIR/api-paste.ini} | 
|  | 44 |  | 
| Dean Troyer | 3a3a2ba | 2012-12-11 15:26:24 -0600 | [diff] [blame] | 45 | # Public facing bits | 
|  | 46 | NOVA_SERVICE_HOST=${NOVA_SERVICE_HOST:-$SERVICE_HOST} | 
|  | 47 | NOVA_SERVICE_PORT=${NOVA_SERVICE_PORT:-8774} | 
|  | 48 | NOVA_SERVICE_PORT_INT=${NOVA_SERVICE_PORT_INT:-18774} | 
|  | 49 | NOVA_SERVICE_PROTOCOL=${NOVA_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL} | 
|  | 50 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 51 | # Support entry points installation of console scripts | 
|  | 52 | if [[ -d $NOVA_DIR/bin ]]; then | 
|  | 53 | NOVA_BIN_DIR=$NOVA_DIR/bin | 
|  | 54 | else | 
| Jakub Ruzicka | 4196d55 | 2013-01-30 15:35:54 +0100 | [diff] [blame] | 55 | NOVA_BIN_DIR=$(get_python_exec_prefix) | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 56 | fi | 
|  | 57 |  | 
|  | 58 | # Set the paths of certain binaries | 
| Vincent Untz | 856a11e | 2012-11-21 16:04:12 +0100 | [diff] [blame] | 59 | NOVA_ROOTWRAP=$(get_rootwrap_location nova) | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 60 |  | 
|  | 61 | # Allow rate limiting to be turned off for testing, like for Tempest | 
|  | 62 | # NOTE: Set API_RATE_LIMIT="False" to turn OFF rate limiting | 
|  | 63 | API_RATE_LIMIT=${API_RATE_LIMIT:-"True"} | 
|  | 64 |  | 
|  | 65 | # Nova supports pluggable schedulers.  The default ``FilterScheduler`` | 
|  | 66 | # should work in most cases. | 
|  | 67 | SCHEDULER=${SCHEDULER:-nova.scheduler.filter_scheduler.FilterScheduler} | 
|  | 68 |  | 
|  | 69 | QEMU_CONF=/etc/libvirt/qemu.conf | 
|  | 70 |  | 
| Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame] | 71 | NOVNC_DIR=$DEST/noVNC | 
|  | 72 | SPICE_DIR=$DEST/spice-html5 | 
|  | 73 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 74 |  | 
| Dean Troyer | b323691 | 2013-03-17 15:17:05 -0500 | [diff] [blame] | 75 | # Nova Network Configuration | 
|  | 76 | # -------------------------- | 
|  | 77 |  | 
|  | 78 | # Set defaults according to the virt driver | 
|  | 79 | if [ "$VIRT_DRIVER" = 'xenserver' ]; then | 
| Mate Lakat | 5a56cd6 | 2013-06-17 13:54:43 +0100 | [diff] [blame] | 80 | PUBLIC_INTERFACE_DEFAULT=eth2 | 
| Dean Troyer | b323691 | 2013-03-17 15:17:05 -0500 | [diff] [blame] | 81 | GUEST_INTERFACE_DEFAULT=eth1 | 
|  | 82 | # Allow ``build_domU.sh`` to specify the flat network bridge via kernel args | 
| Mate Lakat | f652e0f | 2013-05-21 18:12:48 +0100 | [diff] [blame] | 83 | FLAT_NETWORK_BRIDGE_DEFAULT=$(sed -e 's/.* flat_network_bridge=\([[:alnum:]]*\).*$/\1/g' /proc/cmdline) | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 84 | if is_service_enabled neutron; then | 
| Mate Lakat | f652e0f | 2013-05-21 18:12:48 +0100 | [diff] [blame] | 85 | XEN_INTEGRATION_BRIDGE=$(sed -e 's/.* xen_integration_bridge=\([[:alnum:]]*\).*$/\1/g' /proc/cmdline) | 
|  | 86 | fi | 
| Dean Troyer | b323691 | 2013-03-17 15:17:05 -0500 | [diff] [blame] | 87 | elif [ "$VIRT_DRIVER" = 'baremetal' ]; then | 
|  | 88 | NETWORK_MANAGER=${NETWORK_MANAGER:-FlatManager} | 
|  | 89 | PUBLIC_INTERFACE_DEFAULT=eth0 | 
|  | 90 | FLAT_INTERFACE=${FLAT_INTERFACE:-eth0} | 
|  | 91 | FLAT_NETWORK_BRIDGE_DEFAULT=br100 | 
|  | 92 | STUB_NETWORK=${STUB_NETWORK:-False} | 
|  | 93 | else | 
|  | 94 | PUBLIC_INTERFACE_DEFAULT=br100 | 
|  | 95 | GUEST_INTERFACE_DEFAULT=eth0 | 
|  | 96 | FLAT_NETWORK_BRIDGE_DEFAULT=br100 | 
|  | 97 | fi | 
|  | 98 |  | 
|  | 99 | NETWORK_MANAGER=${NETWORK_MANAGER:-${NET_MAN:-FlatDHCPManager}} | 
|  | 100 | PUBLIC_INTERFACE=${PUBLIC_INTERFACE:-$PUBLIC_INTERFACE_DEFAULT} | 
|  | 101 | VLAN_INTERFACE=${VLAN_INTERFACE:-$GUEST_INTERFACE_DEFAULT} | 
|  | 102 | FLAT_NETWORK_BRIDGE=${FLAT_NETWORK_BRIDGE:-$FLAT_NETWORK_BRIDGE_DEFAULT} | 
|  | 103 | EC2_DMZ_HOST=${EC2_DMZ_HOST:-$SERVICE_HOST} | 
|  | 104 |  | 
|  | 105 | # If you are using the FlatDHCP network mode on multiple hosts, set the | 
|  | 106 | # ``FLAT_INTERFACE`` variable but make sure that the interface doesn't already | 
|  | 107 | # have an IP or you risk breaking things. | 
|  | 108 | # | 
|  | 109 | # **DHCP Warning**:  If your flat interface device uses DHCP, there will be a | 
|  | 110 | # hiccup while the network is moved from the flat interface to the flat network | 
|  | 111 | # bridge.  This will happen when you launch your first instance.  Upon launch | 
|  | 112 | # you will lose all connectivity to the node, and the VM launch will probably | 
|  | 113 | # fail. | 
|  | 114 | # | 
|  | 115 | # If you are running on a single node and don't need to access the VMs from | 
|  | 116 | # devices other than that node, you can set ``FLAT_INTERFACE=`` | 
|  | 117 | # This will stop nova from bridging any interfaces into ``FLAT_NETWORK_BRIDGE``. | 
| Davanum Srinivas | b93b74c | 2013-03-21 21:25:05 -0400 | [diff] [blame] | 118 | FLAT_INTERFACE=${FLAT_INTERFACE:-$GUEST_INTERFACE_DEFAULT} | 
| Dean Troyer | b323691 | 2013-03-17 15:17:05 -0500 | [diff] [blame] | 119 |  | 
|  | 120 | # ``MULTI_HOST`` is a mode where each compute node runs its own network node.  This | 
|  | 121 | # allows network operations and routing for a VM to occur on the server that is | 
|  | 122 | # running the VM - removing a SPOF and bandwidth bottleneck. | 
|  | 123 | MULTI_HOST=`trueorfalse False $MULTI_HOST` | 
|  | 124 |  | 
|  | 125 | # Test floating pool and range are used for testing.  They are defined | 
|  | 126 | # here until the admin APIs can replace nova-manage | 
|  | 127 | TEST_FLOATING_POOL=${TEST_FLOATING_POOL:-test} | 
|  | 128 | TEST_FLOATING_RANGE=${TEST_FLOATING_RANGE:-192.168.253.0/29} | 
|  | 129 |  | 
|  | 130 |  | 
| Dean Troyer | cc6b443 | 2013-04-08 15:38:03 -0500 | [diff] [blame] | 131 | # Functions | 
|  | 132 | # --------- | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 133 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 134 | # Helper to clean iptables rules | 
|  | 135 | function clean_iptables() { | 
|  | 136 | # Delete rules | 
|  | 137 | sudo iptables -S -v | sed "s/-c [0-9]* [0-9]* //g" | grep "nova" | grep "\-A" |  sed "s/-A/-D/g" | awk '{print "sudo iptables",$0}' | bash | 
|  | 138 | # Delete nat rules | 
|  | 139 | sudo iptables -S -v -t nat | sed "s/-c [0-9]* [0-9]* //g" | grep "nova" |  grep "\-A" | sed "s/-A/-D/g" | awk '{print "sudo iptables -t nat",$0}' | bash | 
|  | 140 | # Delete chains | 
|  | 141 | sudo iptables -S -v | sed "s/-c [0-9]* [0-9]* //g" | grep "nova" | grep "\-N" |  sed "s/-N/-X/g" | awk '{print "sudo iptables",$0}' | bash | 
|  | 142 | # Delete nat chains | 
|  | 143 | sudo iptables -S -v -t nat | sed "s/-c [0-9]* [0-9]* //g" | grep "nova" |  grep "\-N" | sed "s/-N/-X/g" | awk '{print "sudo iptables -t nat",$0}' | bash | 
|  | 144 | } | 
|  | 145 |  | 
|  | 146 | # cleanup_nova() - Remove residual data files, anything left over from previous | 
|  | 147 | # runs that a clean run would need to clean up | 
|  | 148 | function cleanup_nova() { | 
|  | 149 | if is_service_enabled n-cpu; then | 
|  | 150 | # Clean iptables from previous runs | 
|  | 151 | clean_iptables | 
|  | 152 |  | 
|  | 153 | # Destroy old instances | 
|  | 154 | instances=`sudo virsh list --all | grep $INSTANCE_NAME_PREFIX | sed "s/.*\($INSTANCE_NAME_PREFIX[0-9a-fA-F]*\).*/\1/g"` | 
|  | 155 | if [ ! "$instances" = "" ]; then | 
|  | 156 | echo $instances | xargs -n1 sudo virsh destroy || true | 
| Daniel P. Berrange | d52008a | 2013-05-20 15:03:43 +0100 | [diff] [blame] | 157 | echo $instances | xargs -n1 sudo virsh undefine --managed-save || true | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 158 | fi | 
|  | 159 |  | 
|  | 160 | # Logout and delete iscsi sessions | 
| Dan Smith | c0fad2b | 2013-03-28 12:22:25 -0700 | [diff] [blame] | 161 | tgts=$(sudo iscsiadm --mode node | grep $VOLUME_NAME_PREFIX | cut -d ' ' -f2) | 
|  | 162 | for target in $tgts; do | 
|  | 163 | sudo iscsiadm --mode node -T $target --logout || true | 
|  | 164 | done | 
|  | 165 | sudo iscsiadm --mode node --op delete || true | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 166 |  | 
|  | 167 | # Clean out the instances directory. | 
|  | 168 | sudo rm -rf $NOVA_INSTANCES_PATH/* | 
|  | 169 | fi | 
| Dean Troyer | 995eb92 | 2013-03-07 16:11:40 -0600 | [diff] [blame] | 170 |  | 
|  | 171 | sudo rm -rf $NOVA_STATE_PATH $NOVA_AUTH_CACHE_DIR | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 172 | } | 
|  | 173 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 174 | # configure_nova_rootwrap() - configure Nova's rootwrap | 
|  | 175 | function configure_nova_rootwrap() { | 
|  | 176 | # Deploy new rootwrap filters files (owned by root). | 
|  | 177 | # Wipe any existing rootwrap.d files first | 
|  | 178 | if [[ -d $NOVA_CONF_DIR/rootwrap.d ]]; then | 
|  | 179 | sudo rm -rf $NOVA_CONF_DIR/rootwrap.d | 
|  | 180 | fi | 
|  | 181 | # Deploy filters to /etc/nova/rootwrap.d | 
|  | 182 | sudo mkdir -m 755 $NOVA_CONF_DIR/rootwrap.d | 
|  | 183 | sudo cp $NOVA_DIR/etc/nova/rootwrap.d/*.filters $NOVA_CONF_DIR/rootwrap.d | 
|  | 184 | sudo chown -R root:root $NOVA_CONF_DIR/rootwrap.d | 
|  | 185 | sudo chmod 644 $NOVA_CONF_DIR/rootwrap.d/* | 
|  | 186 | # Set up rootwrap.conf, pointing to /etc/nova/rootwrap.d | 
|  | 187 | sudo cp $NOVA_DIR/etc/nova/rootwrap.conf $NOVA_CONF_DIR/ | 
|  | 188 | sudo sed -e "s:^filters_path=.*$:filters_path=$NOVA_CONF_DIR/rootwrap.d:" -i $NOVA_CONF_DIR/rootwrap.conf | 
|  | 189 | sudo chown root:root $NOVA_CONF_DIR/rootwrap.conf | 
|  | 190 | sudo chmod 0644 $NOVA_CONF_DIR/rootwrap.conf | 
|  | 191 | # Specify rootwrap.conf as first parameter to nova-rootwrap | 
|  | 192 | ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP $NOVA_CONF_DIR/rootwrap.conf *" | 
|  | 193 |  | 
|  | 194 | # Set up the rootwrap sudoers for nova | 
|  | 195 | TEMPFILE=`mktemp` | 
|  | 196 | echo "$USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD" >$TEMPFILE | 
|  | 197 | chmod 0440 $TEMPFILE | 
|  | 198 | sudo chown root:root $TEMPFILE | 
|  | 199 | sudo mv $TEMPFILE /etc/sudoers.d/nova-rootwrap | 
|  | 200 | } | 
|  | 201 |  | 
|  | 202 | # configure_nova() - Set config files, create data dirs, etc | 
|  | 203 | function configure_nova() { | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 204 | # Put config files in ``/etc/nova`` for everyone to find | 
|  | 205 | if [[ ! -d $NOVA_CONF_DIR ]]; then | 
|  | 206 | sudo mkdir -p $NOVA_CONF_DIR | 
|  | 207 | fi | 
| Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 208 | sudo chown $STACK_USER $NOVA_CONF_DIR | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 209 |  | 
|  | 210 | cp -p $NOVA_DIR/etc/nova/policy.json $NOVA_CONF_DIR | 
|  | 211 |  | 
|  | 212 | configure_nova_rootwrap | 
|  | 213 |  | 
|  | 214 | if is_service_enabled n-api; then | 
|  | 215 | # Use the sample http middleware configuration supplied in the | 
|  | 216 | # Nova sources.  This paste config adds the configuration required | 
|  | 217 | # for Nova to validate Keystone tokens. | 
|  | 218 |  | 
|  | 219 | # Remove legacy paste config if present | 
|  | 220 | rm -f $NOVA_DIR/bin/nova-api-paste.ini | 
|  | 221 |  | 
|  | 222 | # Get the sample configuration file in place | 
|  | 223 | cp $NOVA_DIR/etc/nova/api-paste.ini $NOVA_CONF_DIR | 
|  | 224 |  | 
| Mate Lakat | a6601a5 | 2013-03-13 13:35:47 +0000 | [diff] [blame] | 225 | iniset $NOVA_API_PASTE_INI filter:authtoken auth_host $KEYSTONE_AUTH_HOST | 
| Dean Troyer | 3a3a2ba | 2012-12-11 15:26:24 -0600 | [diff] [blame] | 226 | if is_service_enabled tls-proxy; then | 
| Mate Lakat | a6601a5 | 2013-03-13 13:35:47 +0000 | [diff] [blame] | 227 | iniset $NOVA_API_PASTE_INI filter:authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL | 
| Dean Troyer | 3a3a2ba | 2012-12-11 15:26:24 -0600 | [diff] [blame] | 228 | fi | 
| Dean Troyer | b205cc8 | 2013-02-11 17:34:39 -0600 | [diff] [blame] | 229 | iniset $NOVA_API_PASTE_INI filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME | 
|  | 230 | iniset $NOVA_API_PASTE_INI filter:authtoken admin_user nova | 
|  | 231 | iniset $NOVA_API_PASTE_INI filter:authtoken admin_password $SERVICE_PASSWORD | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 232 | fi | 
|  | 233 |  | 
| Akihiro MOTOKI | 5e3deb6 | 2012-12-11 17:09:02 +0900 | [diff] [blame] | 234 | iniset $NOVA_API_PASTE_INI filter:authtoken signing_dir $NOVA_AUTH_CACHE_DIR | 
| Dean Troyer | bc071bc | 2012-10-01 14:06:44 -0500 | [diff] [blame] | 235 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 236 | if is_service_enabled n-cpu; then | 
|  | 237 | # Force IP forwarding on, just on case | 
|  | 238 | sudo sysctl -w net.ipv4.ip_forward=1 | 
|  | 239 |  | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 240 | if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then | 
|  | 241 | # Attempt to load modules: network block device - used to manage qcow images | 
|  | 242 | sudo modprobe nbd || true | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 243 |  | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 244 | # Check for kvm (hardware based virtualization).  If unable to initialize | 
|  | 245 | # kvm, we drop back to the slower emulation mode (qemu).  Note: many systems | 
|  | 246 | # come with hardware virtualization disabled in BIOS. | 
|  | 247 | if [[ "$LIBVIRT_TYPE" == "kvm" ]]; then | 
|  | 248 | sudo modprobe kvm || true | 
|  | 249 | if [ ! -e /dev/kvm ]; then | 
|  | 250 | echo "WARNING: Switching to QEMU" | 
|  | 251 | LIBVIRT_TYPE=qemu | 
|  | 252 | if which selinuxenabled 2>&1 > /dev/null && selinuxenabled; then | 
|  | 253 | # https://bugzilla.redhat.com/show_bug.cgi?id=753589 | 
|  | 254 | sudo setsebool virt_use_execmem on | 
|  | 255 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 256 | fi | 
|  | 257 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 258 |  | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 259 | # Install and configure **LXC** if specified.  LXC is another approach to | 
|  | 260 | # splitting a system into many smaller parts.  LXC uses cgroups and chroot | 
|  | 261 | # to simulate multiple systems. | 
|  | 262 | if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then | 
|  | 263 | if is_ubuntu; then | 
|  | 264 | if [[ ! "$DISTRO" > natty ]]; then | 
|  | 265 | cgline="none /cgroup cgroup cpuacct,memory,devices,cpu,freezer,blkio 0 0" | 
|  | 266 | sudo mkdir -p /cgroup | 
|  | 267 | if ! grep -q cgroup /etc/fstab; then | 
|  | 268 | echo "$cgline" | sudo tee -a /etc/fstab | 
|  | 269 | fi | 
|  | 270 | if ! mount -n | grep -q cgroup; then | 
|  | 271 | sudo mount /cgroup | 
|  | 272 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 273 | fi | 
|  | 274 | fi | 
|  | 275 | fi | 
|  | 276 | fi | 
|  | 277 |  | 
| Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 278 | # Prepare directories and packages for baremetal driver | 
|  | 279 | if is_baremetal; then | 
|  | 280 | configure_baremetal_nova_dirs | 
|  | 281 | fi | 
|  | 282 |  | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 283 | if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then | 
| Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 284 | if is_service_enabled neutron && is_neutron_ovs_base_plugin && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF; then | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 285 | # Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces | 
|  | 286 | cat <<EOF | sudo tee -a $QEMU_CONF | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 287 | cgroup_device_acl = [ | 
|  | 288 | "/dev/null", "/dev/full", "/dev/zero", | 
|  | 289 | "/dev/random", "/dev/urandom", | 
|  | 290 | "/dev/ptmx", "/dev/kvm", "/dev/kqemu", | 
|  | 291 | "/dev/rtc", "/dev/hpet","/dev/net/tun", | 
|  | 292 | ] | 
|  | 293 | EOF | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 294 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 295 |  | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 296 | if is_ubuntu; then | 
|  | 297 | LIBVIRT_DAEMON=libvirt-bin | 
|  | 298 | else | 
|  | 299 | LIBVIRT_DAEMON=libvirtd | 
|  | 300 | fi | 
| Vincent Untz | f1c094c | 2012-12-05 17:59:04 +0100 | [diff] [blame] | 301 |  | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 302 | if is_fedora || is_suse; then | 
| Dean Troyer | 1a6d449 | 2013-06-03 16:47:36 -0500 | [diff] [blame] | 303 | if is_fedora && [[ $DISTRO =~ (rhel6) || "$os_RELEASE" -le "17" ]]; then | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 304 | sudo bash -c "cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla | 
| Ralf Haferkamp | 76ca9a9 | 2013-04-12 12:39:58 +0200 | [diff] [blame] | 305 | [libvirt Management Access] | 
| Émilien Macchi | b2ef890 | 2013-05-04 00:48:20 +0200 | [diff] [blame] | 306 | Identity=unix-group:$LIBVIRT_GROUP | 
| Ralf Haferkamp | 76ca9a9 | 2013-04-12 12:39:58 +0200 | [diff] [blame] | 307 | Action=org.libvirt.unix.manage | 
|  | 308 | ResultAny=yes | 
|  | 309 | ResultInactive=yes | 
|  | 310 | ResultActive=yes | 
| Émilien Macchi | b2ef890 | 2013-05-04 00:48:20 +0200 | [diff] [blame] | 311 | EOF" | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 312 | elif is_suse && [[ $os_RELEASE = 12.2 || "$os_VENDOR" = "SUSE LINUX" ]]; then | 
|  | 313 | # openSUSE < 12.3 or SLE | 
|  | 314 | # Work around the fact that polkit-default-privs overrules pklas | 
|  | 315 | # with 'unix-group:$group'. | 
|  | 316 | sudo bash -c "cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla | 
| Ralf Haferkamp | 76ca9a9 | 2013-04-12 12:39:58 +0200 | [diff] [blame] | 317 | [libvirt Management Access] | 
|  | 318 | Identity=unix-user:$USER | 
|  | 319 | Action=org.libvirt.unix.manage | 
|  | 320 | ResultAny=yes | 
|  | 321 | ResultInactive=yes | 
|  | 322 | ResultActive=yes | 
|  | 323 | EOF" | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 324 | else | 
|  | 325 | # Starting with fedora 18 and opensuse-12.3 enable stack-user to | 
|  | 326 | # virsh -c qemu:///system by creating a policy-kit rule for | 
|  | 327 | # stack-user using the new Javascript syntax | 
|  | 328 | rules_dir=/etc/polkit-1/rules.d | 
|  | 329 | sudo mkdir -p $rules_dir | 
|  | 330 | sudo bash -c "cat <<EOF > $rules_dir/50-libvirt-$STACK_USER.rules | 
| Sunil Thaha | a534e0b | 2013-01-21 17:00:50 +1000 | [diff] [blame] | 331 | polkit.addRule(function(action, subject) { | 
|  | 332 | if (action.id == 'org.libvirt.unix.manage' && | 
|  | 333 | subject.user == '"$STACK_USER"') { | 
|  | 334 | return polkit.Result.YES; | 
|  | 335 | } | 
|  | 336 | }); | 
|  | 337 | EOF" | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 338 | unset rules_dir | 
|  | 339 | fi | 
| Sunil Thaha | a534e0b | 2013-01-21 17:00:50 +1000 | [diff] [blame] | 340 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 341 |  | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 342 | # The user that nova runs as needs to be member of **libvirtd** group otherwise | 
|  | 343 | # nova-compute will be unable to use libvirt. | 
|  | 344 | if ! getent group $LIBVIRT_GROUP >/dev/null; then | 
|  | 345 | sudo groupadd $LIBVIRT_GROUP | 
|  | 346 | fi | 
|  | 347 | add_user_to_group $STACK_USER $LIBVIRT_GROUP | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 348 |  | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 349 | # libvirt detects various settings on startup, as we potentially changed | 
|  | 350 | # the system configuration (modules, filesystems), we need to restart | 
|  | 351 | # libvirt to detect those changes. | 
|  | 352 | restart_service $LIBVIRT_DAEMON | 
|  | 353 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 354 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 355 | # Instance Storage | 
|  | 356 | # ---------------- | 
|  | 357 |  | 
|  | 358 | # Nova stores each instance in its own directory. | 
| Doug Hellmann | cf9eef8 | 2013-03-25 19:34:48 -0400 | [diff] [blame] | 359 | sudo mkdir -p $NOVA_INSTANCES_PATH | 
|  | 360 | sudo chown -R $STACK_USER $NOVA_INSTANCES_PATH | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 361 |  | 
|  | 362 | # You can specify a different disk to be mounted and used for backing the | 
|  | 363 | # virtual machines.  If there is a partition labeled nova-instances we | 
|  | 364 | # mount it (ext filesystems can be labeled via e2label). | 
|  | 365 | if [ -L /dev/disk/by-label/nova-instances ]; then | 
|  | 366 | if ! mount -n | grep -q $NOVA_INSTANCES_PATH; then | 
|  | 367 | sudo mount -L nova-instances $NOVA_INSTANCES_PATH | 
| Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 368 | sudo chown -R $STACK_USER $NOVA_INSTANCES_PATH | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 369 | fi | 
|  | 370 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 371 | fi | 
|  | 372 | } | 
|  | 373 |  | 
| Dean Troyer | a0dce26 | 2012-12-11 16:52:37 -0600 | [diff] [blame] | 374 | # create_nova_accounts() - Set up common required nova accounts | 
|  | 375 |  | 
|  | 376 | # Tenant               User       Roles | 
|  | 377 | # ------------------------------------------------------------------ | 
|  | 378 | # service              nova       admin, [ResellerAdmin (swift only)] | 
|  | 379 |  | 
|  | 380 | # Migrated from keystone_data.sh | 
|  | 381 | create_nova_accounts() { | 
|  | 382 |  | 
|  | 383 | SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }") | 
|  | 384 | ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }") | 
|  | 385 |  | 
|  | 386 | # Nova | 
|  | 387 | if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then | 
|  | 388 | NOVA_USER=$(keystone user-create \ | 
|  | 389 | --name=nova \ | 
|  | 390 | --pass="$SERVICE_PASSWORD" \ | 
|  | 391 | --tenant_id $SERVICE_TENANT \ | 
|  | 392 | --email=nova@example.com \ | 
|  | 393 | | grep " id " | get_field 2) | 
|  | 394 | keystone user-role-add \ | 
|  | 395 | --tenant_id $SERVICE_TENANT \ | 
|  | 396 | --user_id $NOVA_USER \ | 
|  | 397 | --role_id $ADMIN_ROLE | 
|  | 398 | if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then | 
|  | 399 | NOVA_SERVICE=$(keystone service-create \ | 
|  | 400 | --name=nova \ | 
|  | 401 | --type=compute \ | 
|  | 402 | --description="Nova Compute Service" \ | 
|  | 403 | | grep " id " | get_field 2) | 
|  | 404 | keystone endpoint-create \ | 
|  | 405 | --region RegionOne \ | 
|  | 406 | --service_id $NOVA_SERVICE \ | 
| Dean Troyer | 3a3a2ba | 2012-12-11 15:26:24 -0600 | [diff] [blame] | 407 | --publicurl "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2/\$(tenant_id)s" \ | 
|  | 408 | --adminurl "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2/\$(tenant_id)s" \ | 
|  | 409 | --internalurl "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2/\$(tenant_id)s" | 
| Andrea Frittoli | 806233e | 2013-06-17 15:34:54 +0100 | [diff] [blame] | 410 | NOVA_V3_SERVICE=$(keystone service-create \ | 
|  | 411 | --name=nova \ | 
|  | 412 | --type=computev3 \ | 
|  | 413 | --description="Nova Compute Service V3" \ | 
|  | 414 | | grep " id " | get_field 2) | 
|  | 415 | keystone endpoint-create \ | 
|  | 416 | --region RegionOne \ | 
|  | 417 | --service_id $NOVA_V3_SERVICE \ | 
|  | 418 | --publicurl "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v3" \ | 
|  | 419 | --adminurl "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v3" \ | 
|  | 420 | --internalurl "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v3" | 
| Dean Troyer | a0dce26 | 2012-12-11 16:52:37 -0600 | [diff] [blame] | 421 | fi | 
|  | 422 | fi | 
|  | 423 | } | 
|  | 424 |  | 
| Dean Troyer | da7b809 | 2012-10-08 18:12:14 -0500 | [diff] [blame] | 425 | # create_nova_conf() - Create a new nova.conf file | 
|  | 426 | function create_nova_conf() { | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 427 | # Remove legacy ``nova.conf`` | 
|  | 428 | rm -f $NOVA_DIR/bin/nova.conf | 
|  | 429 |  | 
|  | 430 | # (Re)create ``nova.conf`` | 
| Dean Troyer | 3cf1ffb | 2012-10-02 11:51:27 -0500 | [diff] [blame] | 431 | rm -f $NOVA_CONF | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 432 | iniset $NOVA_CONF DEFAULT verbose "True" | 
| Joe Gordon | 8750b3d | 2013-01-17 23:49:50 -0500 | [diff] [blame] | 433 | iniset $NOVA_CONF DEFAULT debug "True" | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 434 | iniset $NOVA_CONF DEFAULT auth_strategy "keystone" | 
|  | 435 | iniset $NOVA_CONF DEFAULT allow_resize_to_same_host "True" | 
|  | 436 | iniset $NOVA_CONF DEFAULT api_paste_config "$NOVA_API_PASTE_INI" | 
|  | 437 | iniset $NOVA_CONF DEFAULT rootwrap_config "$NOVA_CONF_DIR/rootwrap.conf" | 
| Scott Moser | 50686e5 | 2013-07-17 11:32:35 -0400 | [diff] [blame] | 438 | iniset $NOVA_CONF DEFAULT scheduler_driver "$SCHEDULER" | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 439 | iniset $NOVA_CONF DEFAULT dhcpbridge_flagfile "$NOVA_CONF" | 
|  | 440 | iniset $NOVA_CONF DEFAULT force_dhcp_release "True" | 
| mathrock | 27c0695 | 2013-03-13 00:23:18 -0400 | [diff] [blame] | 441 | iniset $NOVA_CONF DEFAULT fixed_range "" | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 442 | iniset $NOVA_CONF DEFAULT default_floating_pool "$PUBLIC_NETWORK_NAME" | 
|  | 443 | iniset $NOVA_CONF DEFAULT s3_host "$SERVICE_HOST" | 
|  | 444 | iniset $NOVA_CONF DEFAULT s3_port "$S3_SERVICE_PORT" | 
|  | 445 | iniset $NOVA_CONF DEFAULT osapi_compute_extension "nova.api.openstack.compute.contrib.standard_extensions" | 
|  | 446 | iniset $NOVA_CONF DEFAULT my_ip "$HOST_IP" | 
| Attila Fazekas | 7e79d91 | 2013-03-03 12:23:04 +0100 | [diff] [blame] | 447 | iniset $NOVA_CONF DEFAULT sql_connection `database_connection_url nova` | 
| Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 448 | if is_baremetal; then | 
| Attila Fazekas | 7e79d91 | 2013-03-03 12:23:04 +0100 | [diff] [blame] | 449 | iniset $NOVA_CONF baremetal sql_connection `database_connection_url nova_bm` | 
| Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 450 | fi | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 451 | if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then | 
|  | 452 | iniset $NOVA_CONF DEFAULT libvirt_type "$LIBVIRT_TYPE" | 
|  | 453 | iniset $NOVA_CONF DEFAULT libvirt_cpu_mode "none" | 
|  | 454 | fi | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 455 | iniset $NOVA_CONF DEFAULT instance_name_template "${INSTANCE_NAME_PREFIX}%08x" | 
| Chris Yeoh | 1b4d91b | 2013-06-03 16:23:01 +0930 | [diff] [blame] | 456 | iniset $NOVA_CONF osapi_v3 enabled "True" | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 457 |  | 
| Ian Wienand | 00fd79d | 2013-06-06 11:19:16 +1000 | [diff] [blame] | 458 | if is_fedora; then | 
|  | 459 | # nova defaults to /usr/local/bin, but fedora pip likes to | 
|  | 460 | # install things in /usr/bin | 
|  | 461 | iniset $NOVA_CONF DEFAULT bindir "/usr/bin" | 
|  | 462 | fi | 
|  | 463 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 464 | if is_service_enabled n-api; then | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 465 | iniset $NOVA_CONF DEFAULT enabled_apis "$NOVA_ENABLED_APIS" | 
| Dean Troyer | 3a3a2ba | 2012-12-11 15:26:24 -0600 | [diff] [blame] | 466 | if is_service_enabled tls-proxy; then | 
|  | 467 | # Set the service port for a proxy to take the original | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 468 | iniset $NOVA_CONF DEFAULT osapi_compute_listen_port "$NOVA_SERVICE_PORT_INT" | 
| Dean Troyer | 3a3a2ba | 2012-12-11 15:26:24 -0600 | [diff] [blame] | 469 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 470 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 471 | if is_service_enabled cinder; then | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 472 | iniset $NOVA_CONF DEFAULT volume_api_class "nova.volume.cinder.API" | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 473 | fi | 
|  | 474 | if [ -n "$NOVA_STATE_PATH" ]; then | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 475 | iniset $NOVA_CONF DEFAULT state_path "$NOVA_STATE_PATH" | 
|  | 476 | iniset $NOVA_CONF DEFAULT lock_path "$NOVA_STATE_PATH" | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 477 | fi | 
|  | 478 | if [ -n "$NOVA_INSTANCES_PATH" ]; then | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 479 | iniset $NOVA_CONF DEFAULT instances_path "$NOVA_INSTANCES_PATH" | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 480 | fi | 
|  | 481 | if [ "$MULTI_HOST" != "False" ]; then | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 482 | iniset $NOVA_CONF DEFAULT multi_host "True" | 
|  | 483 | iniset $NOVA_CONF DEFAULT send_arp_for_ha "True" | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 484 | fi | 
|  | 485 | if [ "$SYSLOG" != "False" ]; then | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 486 | iniset $NOVA_CONF DEFAULT use_syslog "True" | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 487 | fi | 
|  | 488 | if [ "$API_RATE_LIMIT" != "True" ]; then | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 489 | iniset $NOVA_CONF DEFAULT api_rate_limit "False" | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 490 | fi | 
|  | 491 | if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then | 
|  | 492 | # Add color to logging output | 
| Joe Gordon | 07db713 | 2013-01-30 13:07:25 -0800 | [diff] [blame] | 493 | iniset $NOVA_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%(user_name)s %(project_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" | 
|  | 494 | iniset $NOVA_CONF DEFAULT logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 495 | iniset $NOVA_CONF DEFAULT logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m" | 
| Joe Gordon | 07db713 | 2013-01-30 13:07:25 -0800 | [diff] [blame] | 496 | iniset $NOVA_CONF DEFAULT logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m" | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 497 | else | 
|  | 498 | # Show user_name and project_name instead of user_id and project_id | 
| Joe Gordon | 07db713 | 2013-01-30 13:07:25 -0800 | [diff] [blame] | 499 | iniset $NOVA_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s" | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 500 | fi | 
| Eoghan Glynn | 1fcc6a1 | 2012-10-25 14:57:14 +0000 | [diff] [blame] | 501 | if is_service_enabled ceilometer; then | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 502 | iniset $NOVA_CONF DEFAULT instance_usage_audit "True" | 
|  | 503 | iniset $NOVA_CONF DEFAULT instance_usage_audit_period "hour" | 
| Julien Danjou | a9787d0 | 2013-07-02 11:30:40 +0200 | [diff] [blame] | 504 | iniset $NOVA_CONF DEFAULT notify_on_state_change "vm_and_task_state" | 
| Lianhao Lu | 239f324 | 2013-03-01 15:54:02 +0800 | [diff] [blame] | 505 | iniset_multiline $NOVA_CONF DEFAULT notification_driver "nova.openstack.common.notifier.rpc_notifier" "ceilometer.compute.nova_notifier" | 
| Eoghan Glynn | 1fcc6a1 | 2012-10-25 14:57:14 +0000 | [diff] [blame] | 506 | fi | 
|  | 507 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 508 | # Provide some transition from ``EXTRA_FLAGS`` to ``EXTRA_OPTS`` | 
|  | 509 | if [[ -z "$EXTRA_OPTS" && -n "$EXTRA_FLAGS" ]]; then | 
|  | 510 | EXTRA_OPTS=$EXTRA_FLAGS | 
|  | 511 | fi | 
|  | 512 |  | 
|  | 513 | # Define extra nova conf flags by defining the array ``EXTRA_OPTS``. | 
|  | 514 | # For Example: ``EXTRA_OPTS=(foo=true bar=2)`` | 
|  | 515 | for I in "${EXTRA_OPTS[@]}"; do | 
| Dean Troyer | dff9512 | 2013-01-10 20:51:28 -0600 | [diff] [blame] | 516 | # Replace the first '=' with ' ' for iniset syntax | 
|  | 517 | iniset $NOVA_CONF DEFAULT ${I/=/ } | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 518 | done | 
| Dean Troyer | b323691 | 2013-03-17 15:17:05 -0500 | [diff] [blame] | 519 |  | 
|  | 520 | # All nova-compute workers need to know the vnc configuration options | 
|  | 521 | # These settings don't hurt anything if n-xvnc and n-novnc are disabled | 
|  | 522 | if is_service_enabled n-cpu; then | 
|  | 523 | NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:6080/vnc_auto.html"} | 
|  | 524 | iniset $NOVA_CONF DEFAULT novncproxy_base_url "$NOVNCPROXY_URL" | 
|  | 525 | XVPVNCPROXY_URL=${XVPVNCPROXY_URL:-"http://$SERVICE_HOST:6081/console"} | 
|  | 526 | iniset $NOVA_CONF DEFAULT xvpvncproxy_base_url "$XVPVNCPROXY_URL" | 
|  | 527 | SPICEHTML5PROXY_URL=${SPICEHTML5PROXY_URL:-"http://$SERVICE_HOST:6082/spice_auto.html"} | 
|  | 528 | iniset $NOVA_CONF spice html5proxy_base_url "$SPICEHTML5PROXY_URL" | 
|  | 529 | fi | 
|  | 530 | if [ "$VIRT_DRIVER" = 'xenserver' ]; then | 
|  | 531 | VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=169.254.0.1} | 
|  | 532 | else | 
|  | 533 | VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=127.0.0.1} | 
|  | 534 | fi | 
|  | 535 |  | 
| Dean Troyer | cc6b443 | 2013-04-08 15:38:03 -0500 | [diff] [blame] | 536 | if is_service_enabled n-novnc || is_service_enabled n-xvnc; then | 
| Dean Troyer | b323691 | 2013-03-17 15:17:05 -0500 | [diff] [blame] | 537 | # Address on which instance vncservers will listen on compute hosts. | 
|  | 538 | # For multi-host, this should be the management ip of the compute host. | 
|  | 539 | VNCSERVER_LISTEN=${VNCSERVER_LISTEN=127.0.0.1} | 
|  | 540 | iniset $NOVA_CONF DEFAULT vnc_enabled true | 
|  | 541 | iniset $NOVA_CONF DEFAULT vncserver_listen "$VNCSERVER_LISTEN" | 
|  | 542 | iniset $NOVA_CONF DEFAULT vncserver_proxyclient_address "$VNCSERVER_PROXYCLIENT_ADDRESS" | 
|  | 543 | else | 
|  | 544 | iniset $NOVA_CONF DEFAULT vnc_enabled false | 
|  | 545 | fi | 
|  | 546 |  | 
|  | 547 | if is_service_enabled n-spice; then | 
|  | 548 | # Address on which instance spiceservers will listen on compute hosts. | 
|  | 549 | # For multi-host, this should be the management ip of the compute host. | 
|  | 550 | SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS=127.0.0.1} | 
|  | 551 | SPICESERVER_LISTEN=${SPICESERVER_LISTEN=127.0.0.1} | 
|  | 552 | iniset $NOVA_CONF spice enabled true | 
|  | 553 | iniset $NOVA_CONF spice server_listen "$SPICESERVER_LISTEN" | 
|  | 554 | iniset $NOVA_CONF spice server_proxyclient_address "$SPICESERVER_PROXYCLIENT_ADDRESS" | 
|  | 555 | else | 
|  | 556 | iniset $NOVA_CONF spice enabled false | 
|  | 557 | fi | 
|  | 558 |  | 
|  | 559 | iniset $NOVA_CONF DEFAULT ec2_dmz_host "$EC2_DMZ_HOST" | 
|  | 560 | iniset_rpc_backend nova $NOVA_CONF DEFAULT | 
|  | 561 | iniset $NOVA_CONF DEFAULT glance_api_servers "$GLANCE_HOSTPORT" | 
| Dean Troyer | da7b809 | 2012-10-08 18:12:14 -0500 | [diff] [blame] | 562 | } | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 563 |  | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 564 | function init_nova_cells() { | 
|  | 565 | if is_service_enabled n-cell; then | 
|  | 566 | cp $NOVA_CONF $NOVA_CELLS_CONF | 
|  | 567 | iniset $NOVA_CELLS_CONF DEFAULT sql_connection `database_connection_url $NOVA_CELLS_DB` | 
|  | 568 | iniset $NOVA_CELLS_CONF DEFAULT rabbit_virtual_host child_cell | 
|  | 569 | iniset $NOVA_CELLS_CONF DEFAULT dhcpbridge_flagfile $NOVA_CELLS_CONF | 
|  | 570 | iniset $NOVA_CELLS_CONF cells enable True | 
| Chris Behrens | c62c2b9 | 2013-07-24 03:56:13 -0700 | [diff] [blame] | 571 | iniset $NOVA_CELLS_CONF cells cell_type compute | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 572 | iniset $NOVA_CELLS_CONF cells name child | 
|  | 573 |  | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 574 | iniset $NOVA_CONF cells enable True | 
| Chris Behrens | c62c2b9 | 2013-07-24 03:56:13 -0700 | [diff] [blame] | 575 | iniset $NOVA_CONF cells cell_type api | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 576 | iniset $NOVA_CONF cells name region | 
|  | 577 |  | 
|  | 578 | if is_service_enabled n-api-meta; then | 
|  | 579 | NOVA_ENABLED_APIS=$(echo $NOVA_ENABLED_APIS | sed "s/,metadata//") | 
|  | 580 | iniset $NOVA_CONF DEFAULT enabled_apis $NOVA_ENABLED_APIS | 
|  | 581 | iniset $NOVA_CELLS_CONF DEFAULT enabled_apis metadata | 
|  | 582 | fi | 
|  | 583 |  | 
|  | 584 | $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF db sync | 
|  | 585 | $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF cell create --name=region --cell_type=parent --username=guest --hostname=$RABBIT_HOST --port=5672 --password=$RABBIT_PASSWORD --virtual_host=/ --woffset=0 --wscale=1 | 
|  | 586 | $NOVA_BIN_DIR/nova-manage cell create --name=child --cell_type=child --username=guest --hostname=$RABBIT_HOST --port=5672 --password=$RABBIT_PASSWORD --virtual_host=child_cell --woffset=0 --wscale=1 | 
|  | 587 | fi | 
|  | 588 | } | 
|  | 589 |  | 
| Dean Troyer | f03bafe | 2013-02-12 10:58:28 -0600 | [diff] [blame] | 590 | # create_nova_cache_dir() - Part of the init_nova() process | 
|  | 591 | function create_nova_cache_dir() { | 
|  | 592 | # Create cache dir | 
|  | 593 | sudo mkdir -p $NOVA_AUTH_CACHE_DIR | 
|  | 594 | sudo chown $STACK_USER $NOVA_AUTH_CACHE_DIR | 
|  | 595 | rm -f $NOVA_AUTH_CACHE_DIR/* | 
|  | 596 | } | 
|  | 597 |  | 
| Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 598 | function create_nova_conf_nova_network() { | 
| Dean Troyer | b323691 | 2013-03-17 15:17:05 -0500 | [diff] [blame] | 599 | iniset $NOVA_CONF DEFAULT network_manager "nova.network.manager.$NETWORK_MANAGER" | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 600 | iniset $NOVA_CONF DEFAULT public_interface "$PUBLIC_INTERFACE" | 
|  | 601 | iniset $NOVA_CONF DEFAULT vlan_interface "$VLAN_INTERFACE" | 
|  | 602 | iniset $NOVA_CONF DEFAULT flat_network_bridge "$FLAT_NETWORK_BRIDGE" | 
| Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 603 | if [ -n "$FLAT_INTERFACE" ]; then | 
| Devananda van der Veen | 9bc47db | 2012-12-12 16:52:55 -0800 | [diff] [blame] | 604 | iniset $NOVA_CONF DEFAULT flat_interface "$FLAT_INTERFACE" | 
| Akihiro MOTOKI | 66afb47 | 2012-12-21 15:34:13 +0900 | [diff] [blame] | 605 | fi | 
|  | 606 | } | 
|  | 607 |  | 
| Dean Troyer | f03bafe | 2013-02-12 10:58:28 -0600 | [diff] [blame] | 608 | # create_nova_keys_dir() - Part of the init_nova() process | 
|  | 609 | function create_nova_keys_dir() { | 
|  | 610 | # Create keys dir | 
|  | 611 | sudo mkdir -p ${NOVA_STATE_PATH}/keys | 
|  | 612 | sudo chown -R $STACK_USER ${NOVA_STATE_PATH} | 
|  | 613 | } | 
|  | 614 |  | 
| Dean Troyer | da7b809 | 2012-10-08 18:12:14 -0500 | [diff] [blame] | 615 | # init_nova() - Initialize databases, etc. | 
|  | 616 | function init_nova() { | 
| Dean Troyer | f03bafe | 2013-02-12 10:58:28 -0600 | [diff] [blame] | 617 | # All nova components talk to a central database. | 
|  | 618 | # Only do this step once on the API node for an entire cluster. | 
| Bob Melander | c439b5d | 2012-12-19 14:49:34 +0100 | [diff] [blame] | 619 | if is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-api; then | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 620 | # (Re)create nova database | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 621 | # Explicitly use latin1: to avoid lp#829209, nova expects the database to | 
|  | 622 | # use latin1 by default, and then upgrades the database to utf8 (see the | 
|  | 623 | # 082_essex.py in nova) | 
| Terry Wilson | 428af5a | 2012-11-01 16:12:39 -0400 | [diff] [blame] | 624 | recreate_database nova latin1 | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 625 |  | 
| Dean Troyer | f03bafe | 2013-02-12 10:58:28 -0600 | [diff] [blame] | 626 | # Migrate nova database | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 627 | $NOVA_BIN_DIR/nova-manage db sync | 
| Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 628 |  | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 629 | if is_service_enabled n-cell; then | 
|  | 630 | recreate_database $NOVA_CELLS_DB latin1 | 
|  | 631 | fi | 
|  | 632 |  | 
| Devananda van der Veen | f35cf91 | 2012-11-12 17:58:38 -0800 | [diff] [blame] | 633 | # (Re)create nova baremetal database | 
|  | 634 | if is_baremetal; then | 
|  | 635 | recreate_database nova_bm latin1 | 
|  | 636 | $NOVA_BIN_DIR/nova-baremetal-manage db sync | 
|  | 637 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 638 | fi | 
|  | 639 |  | 
| Dean Troyer | f03bafe | 2013-02-12 10:58:28 -0600 | [diff] [blame] | 640 | create_nova_cache_dir | 
|  | 641 | create_nova_keys_dir | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 642 | } | 
|  | 643 |  | 
|  | 644 | # install_novaclient() - Collect source and prepare | 
|  | 645 | function install_novaclient() { | 
|  | 646 | git_clone $NOVACLIENT_REPO $NOVACLIENT_DIR $NOVACLIENT_BRANCH | 
| Dean Troyer | 253a1a3 | 2013-04-01 18:23:22 -0500 | [diff] [blame] | 647 | setup_develop $NOVACLIENT_DIR | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 648 | } | 
|  | 649 |  | 
|  | 650 | # install_nova() - Collect source and prepare | 
|  | 651 | function install_nova() { | 
|  | 652 | if is_service_enabled n-cpu; then | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 653 | if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then | 
| Vincent Untz | c18b965 | 2012-12-04 12:36:34 +0100 | [diff] [blame] | 654 | if is_ubuntu; then | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 655 | install_package kvm | 
|  | 656 | install_package libvirt-bin | 
|  | 657 | install_package python-libvirt | 
|  | 658 | elif is_fedora || is_suse; then | 
|  | 659 | install_package kvm | 
|  | 660 | install_package libvirt | 
|  | 661 | install_package libvirt-python | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 662 | else | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 663 | exit_distro_not_supported "libvirt installation" | 
|  | 664 | fi | 
|  | 665 |  | 
|  | 666 | # Install and configure **LXC** if specified.  LXC is another approach to | 
|  | 667 | # splitting a system into many smaller parts.  LXC uses cgroups and chroot | 
|  | 668 | # to simulate multiple systems. | 
|  | 669 | if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then | 
|  | 670 | if is_ubuntu; then | 
|  | 671 | if [[ "$DISTRO" > natty ]]; then | 
|  | 672 | install_package cgroup-lite | 
|  | 673 | fi | 
|  | 674 | else | 
|  | 675 | ### FIXME(dtroyer): figure this out | 
|  | 676 | echo "RPM-based cgroup not implemented yet" | 
|  | 677 | yum_install libcgroup-tools | 
|  | 678 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 679 | fi | 
|  | 680 | fi | 
|  | 681 | fi | 
|  | 682 |  | 
|  | 683 | git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH | 
| Dean Troyer | 253a1a3 | 2013-04-01 18:23:22 -0500 | [diff] [blame] | 684 | setup_develop $NOVA_DIR | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 685 | } | 
|  | 686 |  | 
| Dean Troyer | 3a3a2ba | 2012-12-11 15:26:24 -0600 | [diff] [blame] | 687 | # start_nova_api() - Start the API process ahead of other things | 
|  | 688 | function start_nova_api() { | 
|  | 689 | # Get right service port for testing | 
|  | 690 | local service_port=$NOVA_SERVICE_PORT | 
|  | 691 | if is_service_enabled tls-proxy; then | 
|  | 692 | service_port=$NOVA_SERVICE_PORT_INT | 
|  | 693 | fi | 
|  | 694 |  | 
|  | 695 | screen_it n-api "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-api" | 
|  | 696 | echo "Waiting for nova-api to start..." | 
|  | 697 | if ! wait_for_service $SERVICE_TIMEOUT http://$SERVICE_HOST:$service_port; then | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 698 | die $LINENO "nova-api did not start" | 
| Dean Troyer | 3a3a2ba | 2012-12-11 15:26:24 -0600 | [diff] [blame] | 699 | fi | 
|  | 700 |  | 
|  | 701 | # Start proxies if enabled | 
|  | 702 | if is_service_enabled tls-proxy; then | 
|  | 703 | start_tls_proxy '*' $NOVA_SERVICE_PORT $NOVA_SERVICE_HOST $NOVA_SERVICE_PORT_INT & | 
|  | 704 | fi | 
|  | 705 | } | 
|  | 706 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 707 | # start_nova() - Start running processes, including screen | 
|  | 708 | function start_nova() { | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 709 | NOVA_CONF_BOTTOM=$NOVA_CONF | 
|  | 710 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 711 | # ``screen_it`` checks ``is_service_enabled``, it is not needed here | 
| Russell Bryant | ff7f308 | 2012-11-29 22:00:51 -0500 | [diff] [blame] | 712 | screen_it n-cond "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-conductor" | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 713 |  | 
|  | 714 | if is_service_enabled n-cell; then | 
|  | 715 | NOVA_CONF_BOTTOM=$NOVA_CELLS_CONF | 
|  | 716 | screen_it n-cond "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-conductor --config-file $NOVA_CELLS_CONF" | 
| Chris Behrens | c62c2b9 | 2013-07-24 03:56:13 -0700 | [diff] [blame] | 717 | screen_it n-cell-region "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CONF" | 
|  | 718 | screen_it n-cell-child "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cells --config-file $NOVA_CELLS_CONF" | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 719 | fi | 
|  | 720 |  | 
| Bob Ball | b1e49bf | 2013-05-30 16:47:19 +0100 | [diff] [blame] | 721 | if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then | 
|  | 722 | # The group **$LIBVIRT_GROUP** is added to the current user in this script. | 
|  | 723 | # Use 'sg' to execute nova-compute as a member of the **$LIBVIRT_GROUP** group. | 
|  | 724 | screen_it n-cpu "cd $NOVA_DIR && sg $LIBVIRT_GROUP '$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CONF_BOTTOM'" | 
|  | 725 | else | 
|  | 726 | screen_it n-cpu "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-compute --config-file $NOVA_CONF_BOTTOM" | 
|  | 727 | fi | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 728 | screen_it n-crt "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cert" | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 729 | screen_it n-net "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-network --config-file $NOVA_CONF_BOTTOM" | 
|  | 730 | screen_it n-sch "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-scheduler --config-file $NOVA_CONF_BOTTOM" | 
|  | 731 | screen_it n-api-meta "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-api-metadata --config-file $NOVA_CONF_BOTTOM" | 
|  | 732 |  | 
| Daniel P. Berrange | 3edddd1 | 2013-01-03 12:06:47 +0000 | [diff] [blame] | 733 | screen_it n-novnc "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-novncproxy --config-file $NOVA_CONF --web $NOVNC_DIR" | 
| Monty Taylor | 0edfd6f | 2012-11-23 15:00:38 -0800 | [diff] [blame] | 734 | screen_it n-xvnc "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-xvpvncproxy --config-file $NOVA_CONF" | 
| Daniel P. Berrange | d10e12f | 2013-01-03 11:51:42 +0000 | [diff] [blame] | 735 | screen_it n-spice "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-spicehtml5proxy --config-file $NOVA_CONF --web $SPICE_DIR" | 
| Monty Taylor | 0edfd6f | 2012-11-23 15:00:38 -0800 | [diff] [blame] | 736 | screen_it n-cauth "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-consoleauth" | 
| Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 737 |  | 
|  | 738 | # Starting the nova-objectstore only if swift3 service is not enabled. | 
|  | 739 | # Swift will act as s3 objectstore. | 
|  | 740 | is_service_enabled swift3 || \ | 
|  | 741 | screen_it n-obj "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-objectstore" | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 742 | } | 
|  | 743 |  | 
|  | 744 | # stop_nova() - Stop running processes (non-screen) | 
|  | 745 | function stop_nova() { | 
|  | 746 | # Kill the nova screen windows | 
| Kieran Spear | fb2a3ae | 2013-03-11 23:55:49 +0000 | [diff] [blame] | 747 | # Some services are listed here twice since more than one instance | 
|  | 748 | # of a service may be running in certain configs. | 
|  | 749 | for serv in n-api n-cpu n-crt n-net n-sch n-novnc n-xvnc n-cauth n-spice n-cond n-cond n-cell n-cell n-api-meta; do | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 750 | screen -S $SCREEN_NAME -p $serv -X kill | 
|  | 751 | done | 
|  | 752 | } | 
|  | 753 |  | 
| Dean Troyer | cc6b443 | 2013-04-08 15:38:03 -0500 | [diff] [blame] | 754 |  | 
| Dean Troyer | bf67c19 | 2012-09-21 15:09:37 -0500 | [diff] [blame] | 755 | # Restore xtrace | 
|  | 756 | $XTRACE | 
| Sean Dague | 584d90e | 2013-03-29 14:34:53 -0400 | [diff] [blame] | 757 |  | 
|  | 758 | # Local variables: | 
|  | 759 | # mode: shell-script | 
|  | 760 | # End: |