summaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rw-r--r--deploy/adapters/ansible/openstack/templates/nova.conf5
-rw-r--r--deploy/adapters/ansible/roles/cinder-controller/templates/cinder.conf5
-rw-r--r--deploy/adapters/ansible/roles/heat/templates/heat.j25
-rw-r--r--deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py9
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_post_install_network_config7
-rw-r--r--deploy/adapters/cobbler/snippets/preseed_post_install_network_config16
-rw-r--r--deploy/adapters/cobbler/snippets/preseed_software_ansible2
-rw-r--r--deploy/bonding.py41
-rwxr-xr-xdeploy/compass_conf/templates/ansible_installer/openstack_newton/vars/HA-ansible-multinodes.tmpl2
-rw-r--r--deploy/conf/network_cfg.yaml18
-rwxr-xr-xdeploy/deploy_host.sh6
-rwxr-xr-xdeploy/launch.sh2
-rw-r--r--deploy/opera_adapter.py2
-rwxr-xr-xdeploy/prepare.sh2
14 files changed, 89 insertions, 33 deletions
diff --git a/deploy/adapters/ansible/openstack/templates/nova.conf b/deploy/adapters/ansible/openstack/templates/nova.conf
index 3cd2c03b..eb7ec053 100644
--- a/deploy/adapters/ansible/openstack/templates/nova.conf
+++ b/deploy/adapters/ansible/openstack/templates/nova.conf
@@ -3,11 +3,6 @@
{% set _ = memcached_servers.append('%s:11211'% host) %}
{% endfor %}
{% set memcached_servers = memcached_servers|join(',') %}
-{% if ansible_processor_vcpus > 10 %}
-{% set api_workers = ansible_processor_vcpus // 10 %}
-{% else %}
-{% set api_workers = 1 %}
-{% endif %}
[DEFAULT]
dhcpbridge_flagfile=/etc/nova/nova.conf
diff --git a/deploy/adapters/ansible/roles/cinder-controller/templates/cinder.conf b/deploy/adapters/ansible/roles/cinder-controller/templates/cinder.conf
index 8b035653..4ad2da2e 100644
--- a/deploy/adapters/ansible/roles/cinder-controller/templates/cinder.conf
+++ b/deploy/adapters/ansible/roles/cinder-controller/templates/cinder.conf
@@ -3,11 +3,6 @@
{% set _ = memcached_servers.append('%s:11211'% host) %}
{% endfor %}
{% set memcached_servers = memcached_servers|join(',') %}
-{% if ansible_processor_vcpus > 5 %}
-{% set api_workers = ansible_processor_vcpus // 5 %}
-{% else %}
-{% set api_workers = 1 %}
-{% endif %}
[DEFAULT]
rootwrap_config = /etc/cinder/rootwrap.conf
diff --git a/deploy/adapters/ansible/roles/heat/templates/heat.j2 b/deploy/adapters/ansible/roles/heat/templates/heat.j2
index d73bd70b..a8feb940 100644
--- a/deploy/adapters/ansible/roles/heat/templates/heat.j2
+++ b/deploy/adapters/ansible/roles/heat/templates/heat.j2
@@ -3,11 +3,6 @@
{% set _ = memcached_servers.append('%s:11211'% host) %}
{% endfor %}
{% set memcached_servers = memcached_servers|join(',') %}
-{% if ansible_processor_vcpus > 5 %}
-{% set api_workers = ansible_processor_vcpus // 5 %}
-{% else %}
-{% set api_workers = 1 %}
-{% endif %}
[DEFAULT]
heat_metadata_server_url = http://{{ internal_vip.ip }}:8000
diff --git a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
index ab13e088..64c0469e 100644
--- a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
+++ b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
@@ -10,6 +10,8 @@
import yaml
import netaddr
import os
+import platform
+import re
import log as logging
LOG = logging.getLogger("net-init")
@@ -88,6 +90,11 @@ def main(config):
setup_ips(config["ip_settings"], config["sys_intf_mappings"])
if __name__ == "__main__":
- os.system("service openvswitch-switch status|| service openvswitch-switch start") # noqa
+ if re.search('Ubuntu', platform.platform()):
+ os.system("service openvswitch-switch start")
+ elif re.search('redhat|centos', platform.platform()):
+ os.system("service openvswitch start")
+ else:
+ os.system("echo 'ERROR: no service named openvswitch'")
config = yaml.load(open(config_path))
main(config)
diff --git a/deploy/adapters/cobbler/snippets/kickstart_post_install_network_config b/deploy/adapters/cobbler/snippets/kickstart_post_install_network_config
index 2c089f92..1a5a7f66 100644
--- a/deploy/adapters/cobbler/snippets/kickstart_post_install_network_config
+++ b/deploy/adapters/cobbler/snippets/kickstart_post_install_network_config
@@ -426,9 +426,12 @@ declare -A used_logical_interfaces
used_logical_interfaces[$iname]=$iname
- #if $iface_type in ("slave","bond_slave","bridge_slave","bonded_bridge_slave")
+ #if $iface_type in ("slave","bridge_slave","bonded_bridge_slave")
#set $static = 1
#end if
+ #if $ip == ""
+ #set $static = ""
+ #end if
echo "DEVICE=$iname" > $devfile
echo "ONBOOT=yes" >> $devfile
@@ -514,7 +517,7 @@ echo "GATEWAY=$if_gateway" >> $devfile
echo "NETMASK=$netmask" >> $devfile
#end if
#else
-echo "BOOTPROTO=dhcp" >> $devfile
+echo "BOOTPROTO=manual" >> $devfile
#if $len($name_servers) > 0
echo "PEERDNS=no" >> $devfile
#end if
diff --git a/deploy/adapters/cobbler/snippets/preseed_post_install_network_config b/deploy/adapters/cobbler/snippets/preseed_post_install_network_config
index cb79c556..f15b6be2 100644
--- a/deploy/adapters/cobbler/snippets/preseed_post_install_network_config
+++ b/deploy/adapters/cobbler/snippets/preseed_post_install_network_config
@@ -50,14 +50,7 @@ echo "physical interfaces: \${physical_interfaces}" >> /tmp/network_log
# map physical interface to mac address
mac_names=""
for physical_interface in \${physical_interfaces}; do
- set \$(ip link show \${physical_interface})
-#if $osversion == "trusty"
- mac=\$(echo \$@ | cut -d' ' -f17)
-#elif $osversion == "xenial"
- mac=\$(echo \$@ | cut -d' ' -f17)
-#else
- mac=\$(echo \$@ | cut -d' ' -f13)
-#end if
+ mac=\$(ip link show \${physical_interface} | awk 'match(\$0,/link\/ether/) {print \$2}')
mac_name=\$(echo \${mac} |tr 'a-z' 'A-Z' | tr ':' '_')
if [ -z "\${mac_name}" ]; then
mac_names="\${mac_name}"
@@ -441,15 +434,18 @@ echo "" >> /etc/network/interfaces
used_logical_interface_$iname=$iname
- #if $iface_type in ("slave","bond_slave","bridge_slave","bonded_bridge_slave")
+ #if $iface_type in ("slave","bridge_slave","bonded_bridge_slave")
#set $static = 1
#end if
+ #if $ip == ""
+ #set $static = ""
+ #end if
echo "auto $iname" >> /etc/network/interfaces
#if $static
echo "iface $iname inet static" >> /etc/network/interfaces
#else
-echo "iface $iname inet dhcp" >> /etc/network/interfaces
+echo "iface $iname inet manual" >> /etc/network/interfaces
#end if
#if $iface_type not in ("master","bond","bridge","bonded_bridge_slave")
diff --git a/deploy/adapters/cobbler/snippets/preseed_software_ansible b/deploy/adapters/cobbler/snippets/preseed_software_ansible
index cde79356..5516c893 100644
--- a/deploy/adapters/cobbler/snippets/preseed_software_ansible
+++ b/deploy/adapters/cobbler/snippets/preseed_software_ansible
@@ -1 +1 @@
-d-i pkgsel/include string ntp ssh openssh-server wget vim
+d-i pkgsel/include string ntp ssh openssh-server wget vim ifenslave
diff --git a/deploy/bonding.py b/deploy/bonding.py
new file mode 100644
index 00000000..27e76daa
--- /dev/null
+++ b/deploy/bonding.py
@@ -0,0 +1,41 @@
+import os
+import sys
+import yaml
+
+
+def exec_cmd(cmd):
+ print cmd
+ os.system(cmd)
+
+
+def create_bonding(network_info, rsa_file, compass_ip):
+ for bond in network_info['bond_mappings']:
+ bond_name = bond['name']
+ host_name = bond.get('host')
+ interfaces = bond.get('bond-slaves')
+ bond_mode = bond['bond-mode']
+ bond_miimon = bond['bond-miimon']
+ lacp_rate = bond['bond-lacp_rate']
+ xmit_hash_policy = bond['bond-xmit_hash_policy']
+ bond_mtu = bond['mtu']
+ if interfaces:
+ for host in host_name:
+ for interface in interfaces:
+ exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ -i %s root@%s \
+ 'cobbler system edit --name=%s --interface=%s --interface-type=bond_slave --interface-master=%s'" # noqa
+ % (rsa_file, compass_ip, host, interface, bond_name)) # noqa
+
+ exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ -i %s root@%s \
+ 'cobbler system edit --name=%s --interface=%s --interface-type=bond --bonding-opts=\"miimon=%s mode=%s lacp_rate=%s xmit_hash_policy=%s mtu=%s\"'" # noqa
+ % (rsa_file, compass_ip, host, bond_name, bond_miimon, bond_mode, lacp_rate, xmit_hash_policy, bond_mtu)) # noqa
+
+if __name__ == "__main__":
+ assert(len(sys.argv) == 4)
+ create_bonding(
+ yaml.load(
+ open(
+ sys.argv[1])),
+ sys.argv[2],
+ sys.argv[3])
diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_newton/vars/HA-ansible-multinodes.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_newton/vars/HA-ansible-multinodes.tmpl
index ac82a981..bc349fce 100755
--- a/deploy/compass_conf/templates/ansible_installer/openstack_newton/vars/HA-ansible-multinodes.tmpl
+++ b/deploy/compass_conf/templates/ansible_installer/openstack_newton/vars/HA-ansible-multinodes.tmpl
@@ -199,6 +199,8 @@ INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS: "{{ internal_ip }}"
build_in_image: http://192.168.121.12:9999/img/cirros-0.3.3-x86_64-disk.img
build_in_image_name: cirros-0.3.3-x86_64-disk.img
+api_workers: 1
+
physical_device: /dev/sdb
odl_username: admin
diff --git a/deploy/conf/network_cfg.yaml b/deploy/conf/network_cfg.yaml
index 28224b66..5e704e80 100644
--- a/deploy/conf/network_cfg.yaml
+++ b/deploy/conf/network_cfg.yaml
@@ -9,7 +9,23 @@
---
nic_mappings: []
-bond_mappings: []
+
+bond_mappings:
+ - name: bond1
+ host:
+ - host1
+ - host2
+ - host3
+ - host4
+ - host5
+ bond-slaves:
+ - eth1
+ - eth2
+ bond-mode: 802.3ad
+ bond-miimon: 100
+ bond-lacp_rate: fast
+ bond-xmit_hash_policy: layer2
+ mtu: 9000
provider_net_mappings:
- name: br-prv
diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh
index bf27b31a..8c863045 100755
--- a/deploy/deploy_host.sh
+++ b/deploy/deploy_host.sh
@@ -13,6 +13,10 @@ function rename_nics(){
python $COMPASS_DIR/deploy/rename_nics.py $DHA $rsa_file $MGMT_IP $OS_VERSION
}
+function add_bonding(){
+ python $COMPASS_DIR/deploy/bonding.py $NETWORK $rsa_file $MGMT_IP
+}
+
function deploy_host(){
export AYNC_TIMEOUT=20
ssh $ssh_args root@${MGMT_IP} mkdir -p /opt/compass/bin/ansible_callbacks
@@ -22,7 +26,7 @@ function deploy_host(){
scp $ssh_args -r ${COMPASS_DIR}/deploy/adapters/ansible/ansible_modules/* root@${MGMT_IP}:/opt/ansible-modules
# avoid nodes reboot to fast, cobbler can not give response
- (sleep $AYNC_TIMEOUT; rename_nics; reboot_hosts) &
+ (sleep $AYNC_TIMEOUT; add_bonding; rename_nics; reboot_hosts) &
if [[ "$REDEPLOY_HOST" == true ]]; then
deploy_flag="redeploy"
else
diff --git a/deploy/launch.sh b/deploy/launch.sh
index 51b502f2..51094b29 100755
--- a/deploy/launch.sh
+++ b/deploy/launch.sh
@@ -148,3 +148,5 @@ if [[ ${DHA##*/} =~ "openo" ]]; then
exit 1
fi
fi
+
+echo 'compass deploy success'
diff --git a/deploy/opera_adapter.py b/deploy/opera_adapter.py
index f83638d7..137aba54 100644
--- a/deploy/opera_adapter.py
+++ b/deploy/opera_adapter.py
@@ -119,7 +119,7 @@ if __name__ == "__main__":
dump_file(openo_config, openo_config_file)
sync_admin_openrc(network, admin_openrc_file)
- p2 = subprocess.Popen("sudo ./opera_launch.sh", cwd=opera_dir, shell=True)
+ p2 = subprocess.Popen("./opera_launch.sh", cwd=opera_dir, shell=True)
p2.communicate()
if p2.returncode != 0:
print('./opera_launch.sh fail')
diff --git a/deploy/prepare.sh b/deploy/prepare.sh
index c2023223..b7e5bfa1 100755
--- a/deploy/prepare.sh
+++ b/deploy/prepare.sh
@@ -74,7 +74,7 @@ function _prepare_python_env() {
else
sudo apt-get update -y
sudo apt-get install -y --force-yes mkisofs bc curl ipmitool openvswitch-switch
- sudo apt-get install -y --force-yes git python-dev python-pip figlet
+ sudo apt-get install -y --force-yes git python-dev python-pip figlet sshpass
sudo apt-get install -y --force-yes libxslt-dev libxml2-dev libvirt-dev build-essential qemu-utils qemu-kvm libvirt-bin virtinst libmysqld-dev
sudo apt-get install -y --force-yes libffi-dev libssl-dev