Browse Source

Set up the kolla-cli and inventory for the vagrant dev environment

When bootstrapping the vagrant dev environment run commands on the
operator node to set up the kolla-cli, and to set up the host
inventory as appropriate for either multinode or aio deployment.

Change-Id: I7765d5302329919dce6317d78b84af1c7bf572b3
tags/7.0.0.0b3
Mark Giles 11 months ago
parent
commit
680c288b36
2 changed files with 53 additions and 8 deletions
  1. 2
    2
      contrib/dev/vagrant/Vagrantfile
  2. 51
    6
      contrib/dev/vagrant/bootstrap.sh

+ 2
- 2
contrib/dev/vagrant/Vagrantfile View File

@@ -232,7 +232,7 @@ Vagrant.configure(2) do |config|
232 232
   # The operator controls the deployment
233 233
   config.vm.define "operator", primary: true do |admin|
234 234
     admin.vm.hostname = "operator.local"
235
-    admin.vm.provision :shell, path: PROVISION_SCRIPT, args: "operator #{MULTINODE ? 'multinode' : 'aio'} #{kolla_path} #{kolla_ansible_path} #{kolla_cli_path}"
235
+    admin.vm.provision :shell, path: PROVISION_SCRIPT, args: "operator #{MULTINODE ? 'multinode' : 'aio'} #{kolla_path} #{kolla_ansible_path} #{kolla_cli_path} #{NUMBER_OF_COMPUTE_NODES} #{NUMBER_OF_STORAGE_NODES} #{NUMBER_OF_NETWORK_NODES} #{NUMBER_OF_CONTROL_NODES}"
236 236
     admin.vm.synced_folder kolla_ansible_repo_path, kolla_ansible_path, create:"True", type: get_default(:sync_method)
237 237
     admin.vm.synced_folder kolla_repo_path, kolla_path, create:"True", type: get_default(:sync_method)
238 238
     admin.vm.synced_folder kolla_cli_repo_path, kolla_cli_path, create:"True", type: get_default(:sync_method)
@@ -256,7 +256,7 @@ Vagrant.configure(2) do |config|
256 256
         hostname = "#{node_type}0#{i}"
257 257
         config.vm.define hostname do |node|
258 258
           node.vm.hostname = "#{hostname}.local"
259
-          node.vm.provision :shell, path: PROVISION_SCRIPT, args: "#{hostname} multinode #{kolla_path} #{kolla_ansible_path} #{kolla_cli_path}"
259
+          node.vm.provision :shell, path: PROVISION_SCRIPT, args: "#{hostname} multinode #{kolla_path} #{kolla_ansible_path} #{kolla_cli_path} #{NUMBER_OF_COMPUTE_NODES} #{NUMBER_OF_STORAGE_NODES} #{NUMBER_OF_NETWORK_NODES} #{NUMBER_OF_CONTROL_NODES}"
260 260
           node.vm.synced_folder File.join(vagrant_dir, 'storage', node_type), "/data/host", create:"True", type: get_default(:sync_method)
261 261
           node.vm.synced_folder File.join(vagrant_dir, 'storage', 'shared'), "/data/shared", create:"True", type: get_default(:sync_method)
262 262
           node.vm.synced_folder ".", vagrant_shared_folder, disabled: true

+ 51
- 6
contrib/dev/vagrant/bootstrap.sh View File

@@ -11,6 +11,10 @@ MODE=$2
11 11
 KOLLA_PATH=$3
12 12
 KOLLA_ANSIBLE_PATH=$4
13 13
 KOLLA_CLI_PATH=$5
14
+NUMBER_OF_COMPUTE_NODES=$6
15
+NUMBER_OF_STORAGE_NODES=$7
16
+NUMBER_OF_NETWORK_NODES=$8
17
+NUMBER_OF_CONTROL_NODES=$9
14 18
 
15 19
 export http_proxy=
16 20
 export https_proxy=
@@ -151,14 +155,54 @@ function configure_kolla {
151 155
     # Use local docker registry
152 156
     sed -i -r "s,^[# ]*namespace *=.+$,namespace = ${REGISTRY}/lokolla," /etc/kolla/kolla-build.conf
153 157
     sed -i -r "s,^[# ]*push *=.+$,push = True," /etc/kolla/kolla-build.conf
154
-    sed -i -r "s,^[# ]*docker_registry:.+$,docker_registry: \"${REGISTRY}\"," /etc/kolla/globals.yml
155
-    sed -i -r "s,^[# ]*docker_namespace:.+$,docker_namespace: \"lokolla\"," /etc/kolla/globals.yml
156
-    sed -i -r "s,^[# ]*docker_insecure_registry:.+$,docker_insecure_registry: \"True\"," /etc/kolla/globals.yml
158
+    kolla-cli property set docker_registry ${REGISTRY}
159
+    kolla-cli property set docker_namespace lokolla
160
+    kolla-cli property set docker_insecure_registry True
157 161
     # Set network interfaces
158
-    sed -i -r "s,^[# ]*network_interface:.+$,network_interface: \"eth1\"," /etc/kolla/globals.yml
159
-    sed -i -r "s,^[# ]*neutron_external_interface:.+$,neutron_external_interface: \"eth2\"," /etc/kolla/globals.yml
162
+    kolla-cli property set network_interface eth1
163
+    kolla-cli property set neutron_external_interface eth2
160 164
     # Set VIP address to be on the vagrant private network
161
-    sed -i -r "s,^[# ]*kolla_internal_vip_address:.+$,kolla_internal_vip_address: \"172.28.128.254\"," /etc/kolla/globals.yml
165
+    kolla-cli property set kolla_internal_vip_address 172.28.128.254
166
+}
167
+
168
+function configure_kolla_cli {
169
+    # Run the CLI setup script
170
+    pushd ${KOLLA_CLI_PATH}
171
+    python ./cli_setup.py
172
+    popd
173
+
174
+    # Set up the kolla-cli inventory
175
+    if [ "$MODE" == 'aio' ]; then
176
+        kolla-cli setdeploy local
177
+        kolla-cli host add localhost
178
+        for group in control deployment monitoring network storage; do
179
+            kolla-cli group addhost $group localhost
180
+        done
181
+    else
182
+        for node_num in $(seq 1 ${NUMBER_OF_COMPUTE_NODES}); do
183
+            node_name="compute0${node_num}"
184
+            kolla-cli host add $node_name
185
+            kolla-cli group addhost external-compute $node_name
186
+        done
187
+
188
+        for node_num in $(seq 1 ${NUMBER_OF_STORAGE_NODES}); do
189
+            node_name="storage0${node_num}"
190
+            kolla-cli host add $node_name
191
+            kolla-cli group addhost storage $node_name
192
+        done
193
+
194
+        for node_num in $(seq 1 ${NUMBER_OF_NETWORK_NODES}); do
195
+            node_name="network0${node_num}"
196
+            kolla-cli host add $node_name
197
+            kolla-cli group addhost network $node_name
198
+        done
199
+
200
+        for node_num in $(seq 1 ${NUMBER_OF_CONTROL_NODES}); do
201
+            node_name="control0${node_num}"
202
+            kolla-cli host add $node_name
203
+            kolla-cli group addhost control $node_name
204
+        done
205
+    fi
162 206
 }
163 207
 
164 208
 # Configure the operator node and install some additional packages.
@@ -192,6 +236,7 @@ function configure_operator {
192 236
     mkdir -p /usr/share/kolla
193 237
     chown -R vagrant: /etc/kolla /usr/share/kolla
194 238
 
239
+    configure_kolla_cli
195 240
     configure_kolla
196 241
 
197 242
     # Make sure Ansible uses scp.

Loading…
Cancel
Save