bug fix: using external_vip as linked dashboard ip 05/1905/3
authorbaigk <baiguoku@huawei.com>
Wed, 23 Sep 2015 06:23:44 +0000 (14:23 +0800)
committerbaigk <baiguoku@huawei.com>
Wed, 23 Sep 2015 16:22:30 +0000 (00:22 +0800)
JIRA: COMPASS-72

Change-Id: I9ab8f6042635a7a06f1a4e2fb3222f790a5bee76
Signed-off-by: baigk <baiguoku@huawei.com>
deploy/adapters/ansible/roles/dashboard/tasks/main.yml
deploy/adapters/ansible/roles/dashboard/templates/ports.j2 [deleted file]
deploy/adapters/ansible/roles/dashboard/vars/Debian.yml
deploy/adapters/ansible/roles/dashboard/vars/RedHat.yml
deploy/adapters/ansible/roles/ha/templates/haproxy.cfg
deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
deploy/conf/network_cfg.yaml

index 9206fda..dd5c6fd 100644 (file)
@@ -1,13 +1,20 @@
 ---
 - include_vars: "{{ ansible_os_family }}.yml"
 
+- name: install http packages
+  action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+  with_items: http_packages
+
+- name: set http config
+  lineinfile: dest={{ http_config_file }} regexp='^Listen 80' line='Listen {{ internal_ip }}:80'
+
+- name: restart http services
+  service: name={{ http_service }} state=restarted enabled=yes
+
 - name: install dashboard packages
   action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
   with_items: packages | union(packages_noarch)
 
-- name: set apache2 config
-  template: src=ports.j2 dest=/etc/apache2/ports.conf backup=yes
-
 - name: remove ubuntu theme
   action: "{{ ansible_pkg_mgr }} name=openstack-dashboard-ubuntu-theme state=absent"
 
diff --git a/deploy/adapters/ansible/roles/dashboard/templates/ports.j2 b/deploy/adapters/ansible/roles/dashboard/templates/ports.j2
deleted file mode 100644 (file)
index 0bfa042..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# if you just change the port or add more ports here, you will likely also
-# have to change the VirtualHost statement in
-# /etc/apache2/sites-enabled/000-default.conf
-
-Listen {{ internal_ip }}:80
-
-<IfModule ssl_module>
-    Listen 443
-</IfModule>
-
-<IfModule mod_gnutls.c>
-    Listen 443
-</IfModule>
-
-# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
index fee64c3..97c4af4 100644 (file)
@@ -1,8 +1,13 @@
 ---
-packages:
+http_packages:
   - apache2
   - libapache2-mod-wsgi
 
+http_service: apache2
+
+packages: []
+
 services:
-  - apache2
   - memcached
+
+http_config_file: "/etc/apache2/ports.conf"
index f0acce9..5e84901 100644 (file)
@@ -1,8 +1,13 @@
 ---
-packages:
+http_packages:
   - httpd
+
+http_service: httpd
+
+packages:
   - mod_wsgi
   - python-memcached
 
-services:
-  - httpd
+services: []
+
+http_config_file: "/etc/httpd/conf/httpd.conf"
index 8f026fa..27aa5b2 100644 (file)
@@ -27,6 +27,7 @@ defaults
 
 listen  proxy-glance_registry_cluster
     bind {{ internal_vip.ip }}:9191
+    bind {{ public_vip.ip }}:9191
     option tcpka
     option tcplog
     balance source
@@ -47,6 +48,7 @@ listen  proxy-glance_api_cluster
 
 listen  proxy-nova-novncproxy
     bind {{ internal_vip.ip }}:6080
+    bind {{ public_vip.ip }}:6080
     option tcpka
     option tcplog
     balance source
@@ -56,6 +58,7 @@ listen  proxy-nova-novncproxy
 
 listen  proxy-network
     bind {{ internal_vip.ip }}:9696
+    bind {{ public_vip.ip }}:9696
     option tcpka
     option tcplog
     balance source
@@ -65,6 +68,7 @@ listen  proxy-network
 
 listen  proxy-volume
     bind {{ internal_vip.ip }}:8776
+    bind {{ public_vip.ip }}:8776
     option tcpka
     option httpchk
     option tcplog
@@ -75,6 +79,7 @@ listen  proxy-volume
 
 listen  proxy-keystone_admin_cluster
     bind {{ internal_vip.ip }}:35357
+    bind {{ public_vip.ip }}:35357
     option tcpka
     option httpchk
     option tcplog
@@ -85,6 +90,7 @@ listen  proxy-keystone_admin_cluster
 
 listen  proxy-keystone_public_internal_cluster
     bind {{ internal_vip.ip }}:5000
+    bind {{ public_vip.ip }}:5000
     option tcpka
     option httpchk
     option tcplog
index b46abce..5e6520a 100644 (file)
@@ -30,7 +30,8 @@ def add_ovs_port(ovs_br, ifname, vlan_id=None):
     cmd = "ovs-vsctl --may-exist add-port %s %s" % (ovs_br, ifname)
     if vlan_id:
         cmd += " tag=%s" % vlan_id
-    cmd += " -- set Interface %s type=internal" % ifname
+    cmd += " -- set Interface %s type=internal;" % ifname
+    cmd += "ip link set %s up;" % ifname
     LOG.info("add_ovs_port: cmd=%s" % cmd)
     os.system(cmd)
 
@@ -44,11 +45,14 @@ def setup_intfs(sys_intf_mappings):
         else:
             pass
 
-def setup_ips(ip_settings):
+def setup_ips(ip_settings, sys_intf_mappings):
     LOG.info("setup_ips enter")
     for intf_info in ip_settings.values():
         network = netaddr.IPNetwork(intf_info["cidr"])
-        intf_name = intf_info["alias"]
+        if sys_intf_mappings[intf_info["name"]]["type"] == "ovs":
+            intf_name = intf_info["name"]
+        else:
+            intf_name = intf_info["alias"]
         cmd = "ip addr add %s/%s brd %s dev %s;" \
               % (intf_info["ip"], intf_info["netmask"], str(network.broadcast),intf_name)
         if "gw" in intf_info:
@@ -65,7 +69,7 @@ def setup_ips(ip_settings):
 def main(config):
     setup_bondings(config["bond_mappings"])
     setup_intfs(config["sys_intf_mappings"])
-    setup_ips(config["ip_settings"])
+    setup_ips(config["ip_settings"], config["sys_intf_mappings"])
 
 if __name__ == "__main__":
     os.system("service openvswitch-switch status|| service openvswitch-switch start")
index a5f2c79..d79ff8e 100644 (file)
@@ -13,7 +13,7 @@ provider_net_mappings:
 sys_intf_mappings:
   - name: mgmt
     interface: eth1
-    vlan_tag: 2
+    vlan_tag: 101
     type: vlan
     role:
       - controller
@@ -21,7 +21,7 @@ sys_intf_mappings:
 
   - name: storage
     interface: eth1
-    vlan_tag: 3
+    vlan_tag: 102
     type: vlan
     role:
       - controller
@@ -29,8 +29,7 @@ sys_intf_mappings:
 
   - name: external
     interface: br-prv
-    vlan_tag: 4
-    type: vlan
+    type: ovs
     role:
       - controller
       - compute
@@ -56,10 +55,10 @@ ip_settings:
 
   - name: external
     ip_ranges:
-    - - "172.16.3.2"
-      - "172.16.3.100"
-    cidr: "172.16.3.0/24"
-    gw: "172.16.3.1"
+    - - "192.168.50.210"
+      - "192.168.50.220"
+    cidr: "192.168.50.0/24"
+    gw: "192.168.50.1"
     role:
       - controller
       - compute
@@ -70,7 +69,7 @@ internal_vip:
   interface: mgmt
 
 public_vip:
-  ip: 172.16.3.222
+  ip: 192.168.50.240
   netmask: "24"
   interface: external
 
@@ -84,7 +83,7 @@ public_net_info:
   router: router-ext
   enable_dhcp: False
   no_gateway: False
-  external_gw: "172.16.3.1"
-  floating_ip_cidr: "172.16.3.0/24"
-  floating_ip_start: "172.16.3.100"
-  floating_ip_end: "172.16.3.254"
+  external_gw: "192.168.50.1"
+  floating_ip_cidr: "192.168.50.0/24"
+  floating_ip_start: "192.168.50.221"
+  floating_ip_end: "192.168.50.231"