From d81783305d2837eb2d76f8f3098bd06f2b58a5d2 Mon Sep 17 00:00:00 2001 From: "chenshuai@huawei.com" Date: Mon, 18 Jan 2016 10:05:58 +0800 Subject: bugfix: opencontrail automation deployment scripts JIRA: COMPASS-277 Change-Id: Ia1f52c6e8e3de520cf06de99550c17879aaed2d7 Signed-off-by: chenshuai@huawei.com (cherry picked from commit 77944ac2791a631cfa785d16cc32dae8082b2719) --- .../tasks/provision/provision-compute.yml | 58 +++++++++++++++++----- 1 file changed, 46 insertions(+), 12 deletions(-) (limited to 'deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml') diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml index c8db15b6..30d836d9 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml @@ -77,6 +77,10 @@ - "sed -i -n -e '/auto .*/,$p' /tmp/contrail-interfaces-bottom" - "cat /tmp/contrail-interfaces-top /tmp/contrail-interfaces-bottom > /etc/network/interfaces" +- name: get last ip address + shell: expr substr `cat /etc/hostname` 5 1 + register: lastip + - name: "configure interface" lineinfile: dest: "/etc/network/interfaces" @@ -91,14 +95,25 @@ - "iface vhost0 inet static" - "\tpre-up /opt/contrail/bin/if-vhost0" - "\tnetwork_name application" - - "\taddress {{ contrail_vhost_address }}" + - "\taddress {{ contrail_vhost_address }}{{ lastip.stdout_lines[0] }}" - "\tnetmask {{ contrail_vhost_netmask }}" +################################################################################## + +- name: "copy vrouter script to compute" + template: + src: "../../templates/vrouter-functions.sh" + dest: "/opt/contrail/bin/vrouter-functions.sh" + - name: "load vrouter driver" command: su -s /bin/sh -c "insmod /var/lib/dkms/vrouter/2.21/build/vrouter.ko" + ignore_errors: true - name: "run vhost0 script" command: su -s /bin/sh -c "/opt/contrail/bin/if-vhost0" + ignore_errors: true + +################################################################################## - name: "delete temporary files" file: @@ -108,6 +123,8 @@ - "/tmp/contrail-interfaces-top" - "/tmp/contrail-interfaces-bottom" +################################################################################## + - name: "fix up contrail vrouter nodemgr config" ini_file: dest: "/etc/contrail/contrail-vrouter-nodemgr.conf" @@ -115,6 +132,27 @@ option: "server" value: "{{ contrail_haproxy_address }}" + +################################################################################## +########################### restart vrouter services ########################### + +- name: "restart supervisor service" + service: + name: "supervisor" + state: "restarted" + +- name: "restart vrouter nodemgr" + shell: ps aux | grep contrail-nodemgr | grep -v grep | awk '{print $2}' | xargs kill -9; + +- name: "restart vrouter agent" + service: + name: "contrail-vrouter-agent" + state: "restarted" + + +################################################################################## + + - name: "restart libvirt bin" service: name: "libvirt-bin" @@ -167,14 +205,14 @@ -################################################# -########### nova plugin workaround ############ -################################################# +####################################################################### +###################### nova plugin workaround ####################### +####################################################################### - name: "copy nova plugs on compute" - template: - src: "nova_contrail_vif.tar.gz" - dest: "/opt/nova_contrail_vif.tar.gz" + copy: + src: "../../templates/nova_contrail_vif.tar.gz" + dest: "/opt/nova_contrail_vif.tar.gz" - name: "unzip nova plugs" command: su -s /bin/sh -c "tar xzf /opt/nova_contrail_vif.tar.gz -C /opt/" @@ -182,15 +220,11 @@ - name: "remove original nova plugs" shell: rm -rf /usr/lib/python2.7/dist-packages/nova_contrail_vif/ -- name: "use new neutron plugs" +- name: "use new nova plugs" shell: mv /opt/nova_contrail_vif/ /usr/lib/python2.7/dist-packages/nova_contrail_vif/ ################################################# - - - - - name: "restart nova compute" service: name: "nova-compute" -- cgit 1.2.3-korg