5 juju status | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"machines\"][\"$1\"][\"agent-state\"]" 2> /dev/null
10 juju status | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"services\"][\"$1\"][\"units\"][\"$1/$2\"][\"agent-state\"]" 2> /dev/null
18 export OS_TENANT_NAME=$3
20 export OS_REGION_NAME=$5
26 juju status | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"services\"][\"$1\"][\"units\"][\"$1/$2\"][\"public-address\"]" 2> /dev/null
31 juju status | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"services\"][\"$1\"][\"units\"][\"$1/$2\"][\"machine\"]" 2> /dev/null
37 while [ "$(agentState $machine)" != started ]; do
46 while [ "$(agentStateUnit "$service" 0)" != started ]; do
59 spare_cpus=$(($(grep processor /proc/cpuinfo | wc -l) - 5))
60 if [ $spare_cpus -gt 0 ]; then
61 spare_cpus=$(((spare_cpus * 3) / 4))
67 [ $spare_cpus -ne 0 ] && extra_cpus=$((1 + (((spare_cpus - 1) * 3) / 4))) && spare_cpus=$((spare_cpus - extra_cpus))
68 juju add-machine --constraints "cpu-cores=$((1 + extra_cpus)) mem=12G root-disk=20G" --series $DEFAULT_SERIES
70 juju deploy --constraints mem=1G $CHARM_NEUTRON_GATEWAY_DEPLOY_OPTS "${CHARM_NEUTRON_GATEWAY:-quantum-gateway}" neutron-gateway
73 [ $spare_cpus -ne 0 ] && extra_cpus=$((1 + (((spare_cpus - 1) * 3) / 4))) && spare_cpus=$((spare_cpus - extra_cpus))
74 juju deploy --constraints "cpu-cores=$((1 + extra_cpus)) mem=4G root-disk=20G" $CHARM_NOVA_COMPUTE_DEPLOY_OPTS "${CHARM_NOVA_COMPUTE:-nova-compute}"
76 juju add-machine --constraints "cpu-cores=$((1 + spare_cpus)) mem=8G root-disk=20G" --series $DEFAULT_SERIES
79 juju scp lxc-network.sh 1:
80 juju run --machine 1 "sudo ./lxc-network.sh"
83 juju scp lxc-network.sh 4:
84 juju run --machine 4 "sudo ./lxc-network.sh"
86 juju deploy --to lxc:1 $CHARM_MYSQL_DEPLOY_OPTS "${CHARM_MYSQL:-mysql}"
87 juju deploy --to lxc:1 $CHARM_RABBITMQ_SERVER_DEPLOY_OPTS "${CHARM_RABBITMQ_SERVER:-rabbitmq-server}"
88 juju deploy --to lxc:1 $CHARM_KEYSTONE_DEPLOY_OPTS "${CHARM_KEYSTONE:-keystone}"
89 juju deploy --to lxc:1 $CHARM_NOVA_CLOUD_CONTROLLER_DEPLOY_OPTS "${CHARM_NOVA_CLOUD_CONTROLLER:-nova-cloud-controller}"
90 juju deploy --to lxc:1 $CHARM_NEUTRON_API_DEPLOY_OPTS "${CHARM_NEUTRON_API:-neutron-api}"
91 juju deploy --to lxc:1 $CHARM_GLANCE_DEPLOY_OPTS "${CHARM_GLANCE:-glance}"
92 juju deploy --to lxc:1 $CHARM_OPENSTACK_DASHBOARD_DEPLOY_OPTS "${CHARM_OPENSTACK_DASHBOARD:-openstack-dashboard}"
94 juju deploy --to lxc:1 $CHARM_ZOOKEEPER_DEPLOY_OPTS "${CHARM_ZOOKEEPER:-zookeeper}"
95 juju deploy --to lxc:1 $CHARM_CONTRAIL_CONFIGURATION_DEPLOY_OPTS "${CHARM_CONTRAIL_CONFIGURATION:-contrail-configuration}"
96 juju deploy --to lxc:1 $CHARM_CONTRAIL_CONTROL_DEPLOY_OPTS "${CHARM_CONTRAIL_CONTROL:-contrail-control}"
97 juju deploy --to lxc:1 $CHARM_CONTRAIL_ANALYTICS_DEPLOY_OPTS "${CHARM_CONTRAIL_ANALYTICS:-contrail-analytics}"
98 juju deploy --to lxc:1 $CHARM_CONTRAIL_WEBUI_DEPLOY_OPTS "${CHARM_CONTRAIL_WEBUI:-contrail-webui}"
99 juju deploy --to lxc:4 $CHARM_CASSANDRA_DEPLOY_OPTS "${CHARM_CASSANDRA:-cassandra}"
100 juju deploy $CHARM_NEUTRON_API_CONTRAIL_DEPLOY_OPTS "${CHARM_NEUTRON_API_CONTRAIL:-neutron-api-contrail}"
101 juju deploy $CHARM_NEUTRON_CONTRAIL_DEPLOY_OPTS "${CHARM_NEUTRON_CONTRAIL:-neutron-contrail}"
103 # relation must be set first
104 # no official way of knowing when this relation hook will fire
105 waitForService mysql keystone
106 juju add-relation keystone mysql
109 waitForService rabbitmq-server nova-cloud-controller glance openstack-dashboard neutron-gateway nova-compute
110 juju add-relation nova-cloud-controller mysql
111 juju add-relation nova-cloud-controller rabbitmq-server
112 juju add-relation nova-cloud-controller glance
113 juju add-relation nova-cloud-controller keystone
114 juju add-relation neutron-gateway mysql
115 juju add-relation neutron-gateway:amqp rabbitmq-server:amqp
116 juju add-relation neutron-gateway nova-cloud-controller
117 juju add-relation nova-compute:shared-db mysql:shared-db
118 juju add-relation nova-compute:amqp rabbitmq-server:amqp
119 juju add-relation nova-compute glance
120 juju add-relation nova-compute nova-cloud-controller
121 juju add-relation glance mysql
122 juju add-relation glance keystone
123 juju add-relation openstack-dashboard keystone
126 waitForService neutron-api
127 juju add-relation neutron-api mysql
128 juju add-relation neutron-api rabbitmq-server
129 juju add-relation neutron-api nova-cloud-controller
130 juju add-relation neutron-api keystone
131 juju add-relation neutron-api neutron-api-contrail
135 waitForService cassandra zookeeper contrail-configuration
136 juju add-relation contrail-configuration:cassandra cassandra:database
137 juju add-relation contrail-configuration zookeeper
138 juju add-relation contrail-configuration rabbitmq-server
139 juju add-relation contrail-configuration keystone
140 juju add-relation contrail-configuration neutron-gateway
143 waitForService contrail-control contrail-analytics
144 juju add-relation neutron-api-contrail contrail-configuration
145 juju add-relation neutron-api-contrail keystone
146 juju add-relation contrail-control:contrail-discovery contrail-configuration:contrail-discovery
147 juju add-relation contrail-control:contrail-ifmap contrail-configuration:contrail-ifmap
148 juju add-relation contrail-analytics:cassandra cassandra:database
149 juju add-relation contrail-analytics contrail-configuration
150 juju add-relation nova-compute neutron-contrail
151 juju add-relation neutron-contrail:contrail-discovery contrail-configuration:contrail-discovery
152 juju add-relation neutron-contrail neutron-gateway
153 juju add-relation neutron-contrail:contrail-api contrail-configuration:contrail-api
154 juju add-relation neutron-contrail keystone
157 waitForService contrail-webui
158 juju add-relation contrail-webui keystone
159 juju add-relation contrail-webui:contrail_api contrail-configuration:contrail-api
160 juju add-relation contrail-webui:contrail_discovery contrail-configuration:contrail-discovery
161 juju add-relation contrail-webui:cassandra cassandra:database
164 # enable kvm on compute
165 machine=$(unitMachine nova-compute 0)
166 juju scp compute.sh $machine:
167 juju run --machine $machine "sudo ./compute.sh"
169 mkdir -m 0700 -p cloud
170 controller_address=$(unitAddress keystone 0)
171 configOpenrc admin password Admin http://$controller_address:5000/v2.0 RegionOne > cloud/admin-openrc
172 chmod 0600 cloud/admin-openrc
174 machine=$(unitMachine nova-cloud-controller 0)
175 juju scp cloud-setup.sh cloud/admin-openrc ~/.ssh/id_rsa.pub $machine:
176 juju run --machine $machine ./cloud-setup.sh
178 # setup contrail routing
179 juju set contrail-configuration "floating-ip-pools=[ { project: admin, network: public-net, pool-name: floatingip_pool, target-projects: [ admin ] } ]"
180 juju set neutron-contrail "virtual-gateways=[ { project: admin, network: public-net, interface: vgw, subnets: [ 10.0.10.0/24 ], routes: [ 0.0.0.0/0 ] } ]"
182 machine=$(unitMachine glance 0)
183 juju scp glance.sh cloud/admin-openrc $machine:
184 juju run --machine $machine ./glance.sh
187 if [ -n "$CONFIGURE_HOST_ROUTING" ]; then
188 compute_address=$(unitAddress nova-compute 0)
189 sudo ip route replace 10.0.10.0/24 via $compute_address
190 sudo iptables -C FORWARD -s 10.0.10.0/24 -j ACCEPT 2> /dev/null || sudo iptables -I FORWARD 1 -s 10.0.10.0/24 -j ACCEPT
191 sudo iptables -C FORWARD -d 10.0.10.0/24 -j ACCEPT 2> /dev/null || sudo iptables -I FORWARD 2 -d 10.0.10.0/24 -j ACCEPT
192 sudo iptables -t nat -C POSTROUTING -s 10.0.10.0/24 ! -d 10.0.10.0/24 -j MASQUERADE 2> /dev/null || sudo iptables -t nat -A POSTROUTING -s 10.0.10.0/24 ! -d 10.0.10.0/24 -j MASQUERADE