From de6a685915bc8bd5444217bca511da35c94b4d59 Mon Sep 17 00:00:00 2001 From: Michael Polenchuk Date: Tue, 4 Jul 2017 15:54:11 +0400 Subject: [PATCH] Turn on opendaylight scenario * fix formula & reclass cluster model * bring in running states Change-Id: I8e66e69045f5c745f9aa6f59f7ce6d66b5bf1c95 Signed-off-by: Michael Polenchuk --- ci/deploy.sh | 9 +++-- mcp/config/os-nosdn-nofeature-noha.yaml | 4 ++ mcp/config/os-nosdn-ovs-noha.yaml | 5 +++ mcp/config/os-odl_l2-nofeature-noha.yaml | 4 ++ mcp/config/states/dpdk | 4 ++ mcp/config/states/networks | 3 ++ mcp/config/states/neutron_compute | 1 + mcp/config/states/opendaylight | 3 ++ mcp/config/states/openstack | 20 ++++++++++ .../virtual-mcp-ocata-odl/openstack/compute.yml | 9 ----- .../virtual-mcp-ocata-odl/openstack/control.yml | 2 +- .../virtual-mcp-ocata-odl/openstack/gateway.yml | 16 ++++---- .../virtual-mcp-ocata-odl/openstack/init.yml | 7 ++++ mcp/salt-formulas/opendaylight/client.sls | 4 ++ mcp/scripts/dpdk.sh | 16 -------- mcp/scripts/lib.sh | 2 +- mcp/scripts/openstack.sh | 44 ---------------------- mcp/scripts/salt.sh | 15 ++++++++ 18 files changed, 84 insertions(+), 84 deletions(-) create mode 100755 mcp/config/states/dpdk create mode 100755 mcp/config/states/networks create mode 100755 mcp/config/states/neutron_compute create mode 100755 mcp/config/states/opendaylight create mode 100755 mcp/config/states/openstack delete mode 100755 mcp/scripts/dpdk.sh delete mode 100755 mcp/scripts/openstack.sh diff --git a/ci/deploy.sh b/ci/deploy.sh index 77030a44d..f98246d3d 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -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 # diff --git a/mcp/config/os-nosdn-nofeature-noha.yaml b/mcp/config/os-nosdn-nofeature-noha.yaml index 526ea5763..7208d89f2 100644 --- a/mcp/config/os-nosdn-nofeature-noha.yaml +++ b/mcp/config/os-nosdn-nofeature-noha.yaml @@ -1,5 +1,9 @@ cluster: domain: virtual-mcp-ocata-ovs.local + states: + - openstack + - neutron_compute + - networks virtual: nodes: - cfg01 diff --git a/mcp/config/os-nosdn-ovs-noha.yaml b/mcp/config/os-nosdn-ovs-noha.yaml index ef35d72d3..ab882215b 100644 --- a/mcp/config/os-nosdn-ovs-noha.yaml +++ b/mcp/config/os-nosdn-ovs-noha.yaml @@ -1,5 +1,10 @@ cluster: domain: virtual-mcp-ocata-ovs-dpdk.local + states: + - dpdk + - openstack + - neutron_compute + - networks virtual: nodes: - cfg01 diff --git a/mcp/config/os-odl_l2-nofeature-noha.yaml b/mcp/config/os-odl_l2-nofeature-noha.yaml index d9810791b..ef967320f 100644 --- a/mcp/config/os-odl_l2-nofeature-noha.yaml +++ b/mcp/config/os-odl_l2-nofeature-noha.yaml @@ -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 index 000000000..3e8b22345 --- /dev/null +++ b/mcp/config/states/dpdk @@ -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 index 000000000..10f71c213 --- /dev/null +++ b/mcp/config/states/networks @@ -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 index 000000000..e2ffec6be --- /dev/null +++ b/mcp/config/states/neutron_compute @@ -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 index 000000000..3b1cf7594 --- /dev/null +++ b/mcp/config/states/opendaylight @@ -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 index 000000000..3a15c2e51 --- /dev/null +++ b/mcp/config/states/openstack @@ -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 diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/compute.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/compute.yml index f0aed44e4..fdbff06b5 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/compute.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/compute.yml @@ -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: diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/control.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/control.yml index c8b6480cc..1918b87be 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/control.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/control.yml @@ -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 diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/gateway.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/gateway.yml index 522998d24..4ea51f36f 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/gateway.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/gateway.yml @@ -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: diff --git a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml index 73445ac07..9857b9a76 100644 --- a/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml +++ b/mcp/reclass/classes/cluster/virtual-mcp-ocata-odl/openstack/init.yml @@ -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: diff --git a/mcp/salt-formulas/opendaylight/client.sls b/mcp/salt-formulas/opendaylight/client.sls index 1abe8743f..2a56d49dd 100644 --- a/mcp/salt-formulas/opendaylight/client.sls +++ b/mcp/salt-formulas/opendaylight/client.sls @@ -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 index faa4390d3..000000000 --- a/mcp/scripts/dpdk.sh +++ /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 diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh index 50f441a78..bf8e3c100 100644 --- a/mcp/scripts/lib.sh +++ b/mcp/scripts/lib.sh @@ -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 index 88db83d49..000000000 --- a/mcp/scripts/openstack.sh +++ /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 diff --git a/mcp/scripts/salt.sh b/mcp/scripts/salt.sh index 56a6fb3b8..9378b6c43 100755 --- a/mcp/scripts/salt.sh +++ b/mcp/scripts/salt.sh @@ -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 -- 2.16.6