bugfix: change recreating neutron_ml2 db to recreating neutron db 17/5217/2
authorchenshuai@huawei.com <chenshuai@huawei.com>
Fri, 25 Dec 2015 01:00:33 +0000 (09:00 +0800)
committershuai chen <chenshuai@huawei.com>
Fri, 25 Dec 2015 08:54:50 +0000 (08:54 +0000)
JIRA: COMPASS-215

Change-Id: I29421e582df2472cbd6263283f46753b7f0296c2
Signed-off-by: chenshuai@huawei.com <chenshuai@huawei.com>
deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg

index 738da5b..1eb517b 100755 (executable)
@@ -9,12 +9,4 @@
   include: openvswitch.yml
   when: groups['odl']|length !=0 and inventory_hostname not in groups['odl']
 
-- meta: flush_handlers
 
-- name: check out new flow table if enable
-  shell: ovs-ofctl --protocol=OpenFlow13 dump-flows br-int | grep CONTROLLER; while [ $? -ne 0 ]; do sleep 10; ovs-ofctl --protocol=OpenFlow13 dump-flows br-int | grep CONTROLLER; done
-  when: groups['odl']|length !=0
-
-#- name: remove controller from br-prv
-#  shell: ovs-vsctl del-controller br-prv;
-#  when: groups['odl']|length !=0
index 2cd4e23..24b6932 100755 (executable)
@@ -57,8 +57,8 @@
 - name: extract odl package
 #  unarchive: src=/opt/{{ odl_pkg_name }} dest={{ odl_home }} group=odl owner=odl mode=0775 copy=no
   command: su -s /bin/sh -c "tar xzf /opt/{{ odl_pkg_name }} -C {{ odl_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files" odl
-  notify:
-    - restart odl service
+#  notify:
+#    - restart odl service
 
 - name: opendaylight system file
   template:
     owner: odl
     group: odl
     mode: 0775
-  notify:
-    - restart odl service
+#  notify:
+#    - restart odl service
 
 - name: create tomcat config
   template:
     src: tomcat-server.xml
     dest: "{{ odl_home }}/configuration/tomcat-server.xml"
-  notify:
-    - restart odl service
+#  notify:
+#    - restart odl service
 
 
 - name: install odl pip packages
   template:
     src: akka.conf
     dest: "{{ odl_home }}/configuration/initial/akka.conf"
-  notify:
-    - restart odl service
+#  notify:
+#    - restart odl service
 
 
 - name: create module-shards config
   template:
     src: module-shards.conf
     dest: "{{ odl_home }}/configuration/initial/module-shards.conf"
-  notify:
-    - restart odl service
+#  notify:
+#    - restart odl service
 
 #- name: copy Jolokia-OSGi config
 #  shell: >
 #- name: copy Jolokia-OSGi jar config
 #  copy: src=roles/odl_cluster/templates/jolokia-osgi-1.1.5.jar  dest="{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/"
 
-- name: remove KARAF Data Directory
-  shell: >
-    rm -rf {{ odl_home }}/data/*;
+- name: remove karaf data directory
+  shell: rm -rf {{ odl_home }}/data/*;
 
 #- name: chown OpenDaylight Directory and Files
 #  shell: >
 ##########################################################################################################
 ################################    OpenDayLight connect with OpenStack   ################################
 ##########################################################################################################
-- name: Turn off neutron-server Daemon on control node
-  shell: sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ; 
-
-- name: Turn off neutron-server on control node
+- name: turn off neutron-server neutron-plugins-openvswitch-agent Daemon on control node
+  shell: >
+    sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
+    sed -i '/neutron-server/d' /opt/service;
+    sed -i '/keepalived/d' /opt/service;
+     
+- name: turn off neutron-server on control node
   service: name=neutron-server state=stopped
 
+- name: turn off keepalived on control node
+  service: name=keepalived state=stopped
+
 #- name: Install Crudini
 #  apt: name={{ item }} state=present
 #  with_items:
 #    - crudini
 
-- name: Run OpenVSwitch Script
-  include: openvswitch.yml
-
 
-- name: chown OpenDaylight Directory and Files
+- name: chown opendaylight directory and files
   shell: >
     chown -R odl:odl "{{ odl_home }}";
     chown odl:odl "{{ service_file.dst }}";
 
+- name: start opendaylight
+  service: name=opendaylight state=started
+
+- name: check if opendaylight running
+  shell: netstat -lpen --tcp | grep java |  grep 6653; while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java |  grep 6653; done
+
+- name: run openvswitch script
+  include: openvswitch.yml
+
+
 #- name: Configure Neutron1
 #  shell: >
 #    crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
 #- name: Execute ML2 Configuration File
 #  command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
 
-- name: Configure Neutron2
-  shell: >
-    mysql -e "drop database if exists neutron_ml2;";
-    mysql -e "create database neutron_ml2 character set utf8;";
-    mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';";
-    su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron;
+- name: drop and recreate neutron database
+  shell: mysql -e "drop database if exists neutron;";
+         mysql -e "create database neutron character set utf8;";
+         mysql -e "grant all on neutron.* to 'neutron'@'%' identified by 'console';";
+         su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron;
+  when: inventory_hostname == haproxy_hosts.keys()[0]
 
-- name: Restart neutron-server
+- name: restart neutron-server
   service: name=neutron-server state=started
 
-- name: Add service daemon
+- name: add service daemon
   shell: > 
     echo opendaylight >> /opt/service ;
     echo neutron-server >> /opt/service ;
+
+- name: restart neutron-l3-agent server
+  service: name=neutron-l3-agent state=restarted
+
+- name: restart neutron-dhcp-agent server
+  service: name=neutron-dhcp-agent state=restarted
+
+- name: restart neutron-metadata-agent server
+  service: name=neutron-metadata-agent state=restarted
index 6f063c7..3415131 100755 (executable)
@@ -9,9 +9,8 @@
   action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
   with_items: compute_packages | union(compute_packages_noarch)
 
-- name: Adjust Service Daemon
-  shell: >
-    sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
+- name: remove neutron-openvswitch-agent service daemon
+  shell: sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
 
 - name: shut down and disable Neutron's openvswitch  agent services
   service: name=neutron-plugin-openvswitch-agent state=stopped
     rm -rf /etc/openvswitch/conf.db ;
     service openvswitch-switch start ;
 
-- name: Set OpenDaylight as the manager
-  command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
+#- name: Set OpenDaylight as the manager
+#  command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
+
+
+- name: recover br-int
+  shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config={'local_ip'=' {{ internal_ip }} '};
 
+#'
 ##################################################################
 ################  Recover External network #######################
 ##################################################################
+
 - name: add ovs bridge
   openvswitch_bridge: bridge={{ item["name"] }} state=present
   with_items: "{{ network_cfg['provider_net_mappings'] }}"
     - recover_network.py
   when: extbr.rc == 0
 
-- name: Recover external script
+- name: recover external script
   shell: python /opt/setup_networks/recover_network.py
   when: extbr.rc == 0
 
-- name: start and disable Neutron's agent services
+- name: restart keepalived
   shell: service keepalived restart
   when: inventory_hostname in groups['odl'] and extbr.rc == 0
+  ignore_errors: True
 
 ##################################################################
 ##################################################################
 ##################################################################
 
+- name: set opendaylight as the manager
+  command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
 
+- name: check br-int
+  shell: ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-int; done
 
-
-#- name: start and disable Neutron's agent services
-#  service: name=neutron-plugin-openvswitch-agent state=started
-
-- name: Configure Neutron1
+- name: configure opendaylight -> ml2
   shell: >
     crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
     crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan;
+    crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling True;
 
 #- name: Adjust Service Daemon
 #  shell: >
 #    sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
 #    echo opendaylight >> /opt/service ;
 
-- name: Create ML2 Configuration File
+- name: copy ml2 configuration script
   template:
     src: ml2_conf.sh
     dest: "/opt/ml2_conf.sh"
     mode: 0777
 
-- name: Execute ML2 Configuration File
+- name: execute ml2 configuration script
   command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
index 05c66ff..e9953e7 100755 (executable)
@@ -41,7 +41,12 @@ featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.3/xml/features
 #
 # Comma separated list of features to install at startup
 #
-featuresBoot=config,standard,region,package,kar,ssh,management,odl-base-all,odl-restconf,odl-ovsdb-openstack,odl-dlux-all,odl-mdsal-apidocs,odl-mdsal-clustering,odl-openflowplugin-flow-services
+featuresBoot=config,standard,region,package,kar,ssh,management,odl-ovsdb-openstack
+
+#,odl-restconf-all,odl-aaa-authn,odl-dlux-all
+
+# odl-base-all,odl-restconf,odl-ovsdb-openstack,odl-dlux-all,odl-mdsal-apidocs
+#,odl-mdsal-clustering,odl-openflowplugin-flow-services
 
 #
 # Defines if the boot features are started in asynchronous mode (in a dedicated thread)