Turn on opendaylight scenario 27/36927/2
authorMichael Polenchuk <mpolenchuk@mirantis.com>
Tue, 4 Jul 2017 11:54:11 +0000 (15:54 +0400)
committerMichael Polenchuk <mpolenchuk@mirantis.com>
Wed, 5 Jul 2017 13:06:35 +0000 (17:06 +0400)
* fix formula & reclass cluster model
* bring in running states

Change-Id: I8e66e69045f5c745f9aa6f59f7ce6d66b5bf1c95
Signed-off-by: Michael Polenchuk <mpolenchuk@mirantis.com>
18 files changed:
ci/deploy.sh
mcp/config/os-nosdn-nofeature-noha.yaml
mcp/config/os-nosdn-ovs-noha.yaml
mcp/config/os-odl_l2-nofeature-noha.yaml
mcp/config/states/dpdk [new file with mode: 0755]
mcp/config/states/networks [new file with mode: 0755]
mcp/config/states/neutron_compute [new file with mode: 0755]
mcp/config/states/opendaylight [new file with mode: 0755]
mcp/config/states/openstack [new file with mode: 0755]
mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/compute.yml
mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/control.yml
mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/gateway.yml
mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml
mcp/salt-formulas/opendaylight/client.sls
mcp/scripts/dpdk.sh [deleted file]
mcp/scripts/lib.sh
mcp/scripts/openstack.sh [deleted file]
mcp/scripts/salt.sh

index 77030a4..f98246d 100755 (executable)
@@ -264,12 +264,13 @@ update_pxe_network
 start_vms virtual_nodes
 check_connection
 
-# Openstack cluster setup
 ./salt.sh
-./openstack.sh
 
-# Enable dpdk on computes
-[[ "$DEPLOY_SCENARIO" =~ (ovs|dpdk) ]] && ./dpdk.sh
+# Openstack cluster setup
+for state in "${cluster_states[@]}"; do
+    echo "STATE: $state"
+    ssh ${SSH_OPTS} ubuntu@${SALT_MASTER} sudo /root/fuel/mcp/config/states/$state
+done
 
 ## Disable Fuel deployment engine
 #
index 526ea57..7208d89 100644 (file)
@@ -1,5 +1,9 @@
 cluster:
   domain: virtual-mcp-ocata-ovs.local
+  states:
+    - openstack
+    - neutron_compute
+    - networks
 virtual:
   nodes:
     - cfg01
index ef35d72..ab88221 100644 (file)
@@ -1,5 +1,10 @@
 cluster:
   domain: virtual-mcp-ocata-ovs-dpdk.local
+  states:
+    - dpdk
+    - openstack
+    - neutron_compute
+    - networks
 virtual:
   nodes:
     - cfg01
index d981079..ef96732 100644 (file)
@@ -1,5 +1,9 @@
 cluster:
   domain: virtual-mcp-ocata-odl.local
+  states:
+    - opendaylight
+    - openstack
+    - networks
 virtual:
   nodes:
     - cfg01
diff --git a/mcp/config/states/dpdk b/mcp/config/states/dpdk
new file mode 100755 (executable)
index 0000000..3e8b223
--- /dev/null
@@ -0,0 +1,4 @@
+salt -C 'I@nova:compute' system.reboot
+salt -C 'I@nova:compute' test.ping
+
+salt -C 'I@nova:compute' state.sls linux
diff --git a/mcp/config/states/networks b/mcp/config/states/networks
new file mode 100755 (executable)
index 0000000..10f71c2
--- /dev/null
@@ -0,0 +1,3 @@
+salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack compute service list; openstack network agent list; openstack stack list; openstack volume list"
+salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack network create --share --external --provider-network-type flat --provider-physical-network physnet1 floating_net"
+salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack subnet create --gateway 10.16.0.1 --no-dhcp --allocation-pool start=10.16.0.130,end=10.16.0.254 --network floating_net --subnet-range 10.16.0.0/24 floating_subnet"
diff --git a/mcp/config/states/neutron_compute b/mcp/config/states/neutron_compute
new file mode 100755 (executable)
index 0000000..e2ffec6
--- /dev/null
@@ -0,0 +1 @@
+salt -I 'neutron:compute' state.sls neutron
diff --git a/mcp/config/states/opendaylight b/mcp/config/states/opendaylight
new file mode 100755 (executable)
index 0000000..3b1cf75
--- /dev/null
@@ -0,0 +1,3 @@
+salt -I 'opendaylight:server' state.sls opendaylight
+salt -I 'opendaylight:client' state.sls opendaylight.client
+salt -I 'neutron:server' state.sls opendaylight.client
diff --git a/mcp/config/states/openstack b/mcp/config/states/openstack
new file mode 100755 (executable)
index 0000000..3a15c2e
--- /dev/null
@@ -0,0 +1,20 @@
+salt -C 'I@rabbitmq:server' state.sls rabbitmq
+salt -C 'I@rabbitmq:server' cmd.run "rabbitmqctl status"
+
+salt -C 'I@mysql:server' state.sls mysql
+salt -C 'I@memcached:server' state.sls memcached
+
+salt -C 'I@keystone:server' state.sls keystone.server
+salt -C 'I@keystone:server' service.restart apache2
+salt -C 'I@keystone:server' state.sls keystone.client
+salt -C 'I@keystone:server' cmd.run ". /root/keystonercv3; openstack service list"
+
+salt -C 'I@glance:server' state.sls glance
+salt -C 'I@nova:controller' state.sls nova
+salt -C 'I@heat:server' state.sls heat
+salt -C 'I@cinder:controller' state.sls cinder
+
+salt -C 'I@neutron:server' state.sls neutron
+salt -C 'I@neutron:gateway' state.sls neutron
+
+salt -C 'I@nova:compute' state.sls nova
index f0aed44..fdbff06 100644 (file)
@@ -3,7 +3,6 @@ classes:
 - system.linux.system.repo.mcp.extra
 - system.linux.system.repo.saltstack.xenial
 - system.nova.compute.single
-- system.neutron.control.opendaylight.single
 - service.neutron.compute.single
 - cluster.virtual-mcp-ocata-odl
 parameters:
@@ -33,15 +32,7 @@ parameters:
       ovsdb_server_iface: ptcp:6639:127.0.0.1
       ovsdb_odl_iface: tcp:${_param:opendaylight_service_host}:6640
       tunnel_ip: ${_param:tenant_address}
-      provider_mappings: br-floating:float-to-ex
   linux:
-    system:
-      repo:
-        uca:
-          source: "deb http://ubuntu-cloud.archive.canonical.com/ubuntu xenial-updates/ocata main"
-          architectures: amd64
-          key_id: EC4926EA
-          key_server: keyserver.ubuntu.com
     network:
       bridge: openvswitch
       interface:
index c8b6480..1918b87 100644 (file)
@@ -15,7 +15,7 @@ classes:
 - system.keystone.client.service.cinder3
 - system.glance.control.single
 - system.nova.control.single
-- system.neutron.control.openvswitch.single
+- system.neutron.control.opendaylight.single
 - system.cinder.control.single
 - system.heat.server.single
 - service.mysql.server.single
index 522998d..4ea51f3 100644 (file)
@@ -2,8 +2,7 @@ classes:
 - system.linux.system.repo.mcp.openstack
 - system.linux.system.repo.mcp.extra
 - system.linux.system.repo.saltstack.xenial
-- system.neutron.control.opendaylight.single
-- service.neutron.gateway.single
+- system.neutron.gateway.opendaylight.single
 - cluster.virtual-mcp-ocata-odl
 parameters:
   _param:
@@ -12,9 +11,15 @@ parameters:
     external_interface: ens6
     interface_mtu: 9000
     linux_system_codename: xenial
+    neutron_agents:
+    - neutron-l3-agent
+    - neutron-dhcp-agent
+    - neutron-metadata-agent
   neutron:
     gateway:
       agent_mode: ${_param:neutron_gateway_agent_mode}
+      pkgs: ${_param:neutron_agents}
+      services: ${_param:neutron_agents}
   opendaylight:
     client:
       ovsdb_server_iface: ptcp:6639:127.0.0.1
@@ -22,13 +27,6 @@ parameters:
       tunnel_ip: ${_param:tenant_address}
       provider_mappings: br-floating:float-to-ex
   linux:
-    system:
-      repo:
-        uca:
-          source: "deb http://ubuntu-cloud.archive.canonical.com/ubuntu xenial-updates/ocata main"
-          architectures: amd64
-          key_id: EC4926EA
-          key_server: keyserver.ubuntu.com
     network:
       bridge: openvswitch
       interface:
index 73445ac..9857b9a 100644 (file)
@@ -89,6 +89,13 @@ parameters:
     keystone_aodh_password: opnfv_secret
     aodh_service_host: 172.16.10.108
   linux:
+    system:
+      repo:
+        uca:
+          source: "deb http://ubuntu-cloud.archive.canonical.com/ubuntu xenial-updates/ocata main"
+          architectures: amd64
+          key_id: EC4926EA
+          key_server: keyserver.ubuntu.com
     network:
       host:
         ctl:
index 1abe874..2a56d49 100644 (file)
@@ -5,6 +5,7 @@ opendaylight_client_packages:
   pkg.installed:
   - pkgs: {{ client.pkgs }}
 
+{%- if pillar.linux.network.bridge is defined and pillar.linux.network.bridge == 'openvswitch' %}
 ovs_set_manager:
   cmd.run:
   - name: "ovs-vsctl set-manager {{ client.ovsdb_server_iface }} {{ client.ovsdb_odl_iface }}"
@@ -17,11 +18,14 @@ ovs_set_tunnel_endpoint:
   - require:
     - cmd: ovs_set_manager
 
+{%- if client.provider_mappings is defined %}
 ovs_set_provider_mapping:
   cmd.run:
   - name: "ovs-vsctl set Open_vSwitch . other_config:provider_mappings={{ client.provider_mappings }}"
   - unless: "ovs-vsctl get Open_vSwitch . other_config | fgrep provider_mappings"
   - require:
     - cmd: ovs_set_manager
+{%- endif %}
 
 {%- endif %}
+{%- endif %}
diff --git a/mcp/scripts/dpdk.sh b/mcp/scripts/dpdk.sh
deleted file mode 100755 (executable)
index faa4390..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-#
-# Enable DPDK on compute nodes
-#
-
-ssh ${SSH_OPTS} ubuntu@${SALT_MASTER} bash -s << DPDK_INSTALL_END
-  sudo -i
-
-  salt -C 'I@nova:compute' system.reboot
-  salt -C 'I@nova:compute' test.ping
-
-  salt -C 'I@nova:compute' state.sls linux
-  salt -C 'I@nova:compute' state.sls nova,neutron
-
-  salt -C 'I@keystone:server and *01*' cmd.run ". /root/keystonercv3; nova service-list; openstack network agent list"
-DPDK_INSTALL_END
index 50f441a..bf8e3c1 100644 (file)
@@ -95,7 +95,7 @@ check_connection() {
 
   # wait until ssh on Salt master is available
   while (($attempt <= $total_attempts)); do
-    ssh -i ${SSH_KEY} ubuntu@${SALT_MASTER} uptime
+    ssh -i ${SSH_OPTS} ubuntu@${SALT_MASTER} uptime
     case $? in
       0) echo "${attempt}> Success"; break ;;
       *) echo "${attempt}/${total_attempts}> ssh server ain't ready yet, waiting for ${sleep_time} seconds ..." ;;
diff --git a/mcp/scripts/openstack.sh b/mcp/scripts/openstack.sh
deleted file mode 100755 (executable)
index 88db83d..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-#
-# Deploy Openstack
-#
-
-ssh ${SSH_OPTS} ubuntu@${SALT_MASTER} bash -s << OPENSTACK_INSTALL_END
-  sudo -i
-
-  salt-call state.apply salt
-  salt '*' state.apply salt || salt '*' state.apply salt
-
-  salt -C 'I@salt:master' state.sls linux
-  salt -C '* and not cfg01*' state.sls linux
-
-  salt '*' state.sls ntp
-
-  salt -C 'I@rabbitmq:server' state.sls rabbitmq
-  salt -C 'I@rabbitmq:server' cmd.run "rabbitmqctl status"
-
-  salt -C 'I@mysql:server' state.sls mysql
-
-  salt -C 'I@memcached:server' state.sls memcached
-
-  salt -C 'I@keystone:server' state.sls keystone.server
-  salt -C 'I@keystone:server' cmd.run "systemctl restart apache2"
-  while true; do salt -C 'I@keystone:server' state.sls keystone.client && break; done
-  salt -C 'I@keystone:server' cmd.run ". /root/keystonercv3; openstack service list"
-
-  salt -C 'I@glance:server' state.sls glance
-  salt -C 'I@nova:controller' state.sls nova
-  salt -C 'I@heat:server' state.sls heat
-  salt -C 'I@cinder:controller' state.sls cinder
-
-  salt -C 'I@neutron:server' state.sls neutron
-  salt -C 'I@neutron:gateway' state.sls neutron
-
-  salt -C 'I@nova:compute' state.sls nova
-  salt -C 'I@neutron:compute' state.sls neutron
-
-  salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack compute service list; openstack network agent list; openstack stack list; openstack volume list"
-
-  salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack network create --share --external --provider-network-type flat --provider-physical-network physnet1 floating_net"
-  salt 'ctl01*' cmd.run ". /root/keystonercv3; openstack subnet create --gateway 10.16.0.1 --no-dhcp --allocation-pool start=10.16.0.130,end=10.16.0.254 --network floating_net --subnet-range 10.16.0.0/24 floating_subnet"
-OPENSTACK_INSTALL_END
index 56a6fb3..9378b6c 100755 (executable)
@@ -20,4 +20,19 @@ ssh ${SSH_OPTS} ubuntu@${SALT_MASTER} bash -s << SALT_INSTALL_END
   cd /srv/salt/scripts
   MASTER_HOSTNAME=cfg01.${CLUSTER_DOMAIN} DISTRIB_REVISION=nightly ./salt-master-init.sh
   salt-key -Ay
+
+  cp -r /root/fuel/mcp/metadata/service /usr/share/salt-formulas/reclass
+  cp -r /root/fuel/mcp/salt-formulas/* /usr/share/salt-formulas/env
+  cd /srv/salt/reclass/classes/service && ln -s /usr/share/salt-formulas/reclass/service/opendaylight
+
+  salt '*' saltutil.refresh_pillar
+  salt '*' saltutil.sync_all
+
+  salt-call state.apply salt
+  salt '*' state.apply salt || salt '*' state.apply salt
+
+  salt -C 'I@salt:master' state.sls linux
+  salt -C '* and not cfg01*' state.sls linux
+
+  salt '*' state.sls ntp
 SALT_INSTALL_END