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=8G root-disk=20G" --series $DEFAULT_SERIES
70 juju deploy --constraints mem=1G $CHARM_NEUTRON_GATEWAY_DEPLOY_OPTS "${CHARM_NEUTRON_GATEWAY:-neutron-gateway}" neutron-gateway
72 juju deploy --constraints "cpu-cores=$((1 + spare_cpus)) mem=4G root-disk=20G" $CHARM_NOVA_COMPUTE_DEPLOY_OPTS "${CHARM_NOVA_COMPUTE:-nova-compute}"
75 juju scp lxc-network.sh 1:
76 juju run --machine 1 "sudo ./lxc-network.sh"
77 juju deploy --to lxc:1 $CHARM_MYSQL_DEPLOY_OPTS "${CHARM_MYSQL:-mysql}"
78 juju deploy --to lxc:1 $CHARM_RABBITMQ_SERVER_DEPLOY_OPTS "${CHARM_RABBITMQ_SERVER:-rabbitmq-server}"
79 juju deploy --to lxc:1 $CHARM_KEYSTONE_DEPLOY_OPTS "${CHARM_KEYSTONE:-keystone}"
80 juju deploy --to lxc:1 $CHARM_NOVA_CLOUD_CONTROLLER_DEPLOY_OPTS "${CHARM_NOVA_CLOUD_CONTROLLER:-nova-cloud-controller}"
81 juju deploy --to lxc:1 $CHARM_NEUTRON_API_DEPLOY_OPTS "${CHARM_NEUTRON_API:-neutron-api}"
82 juju deploy --to lxc:1 $CHARM_GLANCE_DEPLOY_OPTS "${CHARM_GLANCE:-glance}"
83 juju deploy --to lxc:1 $CHARM_OPENSTACK_DASHBOARD_DEPLOY_OPTS "${CHARM_OPENSTACK_DASHBOARD:-openstack-dashboard}"
85 juju deploy --to lxc:1 $CHARM_ONOS_CONTROLLER_DEPLOY_OPTS "${CHARM_ONOS_CONTROLLER:-onos-controller}"
87 # relation must be set first
88 # no official way of knowing when this relation hook will fire
89 waitForService mysql keystone
90 juju add-relation keystone mysql
93 waitForService rabbitmq-server nova-cloud-controller glance
94 juju add-relation nova-cloud-controller mysql
95 juju add-relation nova-cloud-controller rabbitmq-server
96 juju add-relation nova-cloud-controller glance
97 juju add-relation nova-cloud-controller keystone
100 waitForService neutron-api
101 juju add-relation neutron-api mysql
102 juju add-relation neutron-api rabbitmq-server
103 juju add-relation neutron-api keystone
104 juju add-relation neutron-api nova-cloud-controller
107 waitForService openstack-dashboard neutron-gateway nova-compute
108 juju add-relation neutron-gateway mysql
109 juju add-relation neutron-gateway:amqp rabbitmq-server:amqp
110 juju add-relation neutron-gateway nova-cloud-controller
111 juju add-relation neutron-gateway neutron-api
112 juju add-relation nova-compute:shared-db mysql:shared-db
113 juju add-relation nova-compute:amqp rabbitmq-server:amqp
114 juju add-relation nova-compute glance
115 juju add-relation nova-compute nova-cloud-controller
116 juju add-relation glance mysql
117 juju add-relation glance keystone
118 juju add-relation openstack-dashboard keystone
122 waitForService onos-controller
123 juju add-relation neutron-api onos-controller
124 juju add-relation neutron-gateway onos-controller
125 juju add-relation nova-compute onos-controller
128 # enable kvm on compute
129 machine=$(unitMachine nova-compute 0)
130 juju scp compute.sh $machine:
131 juju run --machine $machine "sudo ./compute.sh"
133 mkdir -m 0700 -p cloud
134 controller_address=$(unitAddress keystone 0)
135 configOpenrc admin admin Admin http://$controller_address:5000/v2.0 RegionOne > cloud/admin-openrc
136 chmod 0600 cloud/admin-openrc
138 # keystone need some extra time before it become availble for cloud operations.
141 machine=$(unitMachine nova-cloud-controller 0)
142 juju scp cloud-setup.sh cloud/admin-openrc ~/.ssh/id_rsa.pub $machine:
143 juju run --machine $machine ./cloud-setup.sh
145 machine=$(unitMachine glance 0)
146 juju scp glance.sh cloud/admin-openrc $machine:
147 juju run --machine $machine ./glance.sh