From 4a3ac44c6c7ad647554edf687c5c937be0ba38fc Mon Sep 17 00:00:00 2001
From: raman-mann <ramandeep.mann@aricent.com>
Date: Thu, 6 Sep 2018 06:48:12 -0600
Subject: [PATCH 1/6] changes for controller HA

---
 .../ansible_utils/ansible_configuration.py    | 119 +++++++++---------
 .../kolla/multinode_kolla_controller.yaml     |  14 +++
 2 files changed, 74 insertions(+), 59 deletions(-)

diff --git a/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py b/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py
index 00d5ce0..4621acc 100755
--- a/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py
+++ b/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py
@@ -260,20 +260,22 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
         if ret != 0:
             logger.info('FAILED IN SETTING DOCKER REGISTRY')
             exit(1)
-
-    copy_key_pb = pkg_resources.resource_filename(
-        consts.KOLLA_PB_PKG, consts.KOLLA_COPY_KEY)
-    apbl.launch_ansible_playbook(
-        iplist, copy_key_pb, {
-            'target': ip_control, 'PROXY_DATA_FILE': proxy_data_file,
-            'VARIABLE_FILE': variable_file})
-    for key_ip in iplist:
-        push_key_pb = pkg_resources.resource_filename(
-            consts.KOLLA_PB_PKG, consts.KOLLA_PUSH_KEY)
+    for controller in list_controller:
+        print "copy key from raman"
+        print controller
+        copy_key_pb = pkg_resources.resource_filename(
+            consts.KOLLA_PB_PKG, consts.KOLLA_COPY_KEY)
         apbl.launch_ansible_playbook(
-            iplist, push_key_pb, {
-                'target': key_ip, 'PROXY_DATA_FILE': proxy_data_file,
+            iplist, copy_key_pb, {
+                'target': controller, 'PROXY_DATA_FILE': proxy_data_file,
                 'VARIABLE_FILE': variable_file})
+        for key_ip in iplist:
+            push_key_pb = pkg_resources.resource_filename(
+                consts.KOLLA_PB_PKG, consts.KOLLA_PUSH_KEY)
+            apbl.launch_ansible_playbook(
+                iplist, push_key_pb, {
+                    'target': key_ip, 'PROXY_DATA_FILE': proxy_data_file,
+                    'VARIABLE_FILE': variable_file})
 
     if not list_all:
         logger.info(
@@ -330,52 +332,51 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
                else:
                  logger.info(
                    "***********PLAYBOOK EXECUTED SUCCESSFULLY***********")
-
-        for controller_ip in list_controller:
-            if len(list_storage) == 1:
-                ceph_pb = pkg_resources.resource_filename(
-                    consts.KOLLA_PB_PKG, consts.KOLLA_CEPH_SETUP)
-                apbl.launch_ansible_playbook(
-                    iplist, ceph_pb, {
-                        'target': controller_ip,
-                        'VARIABLE_FILE': variable_file,
-                        'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH})
-            for key,value in host_sriov_interface_node_map.iteritems():
-              if key is node_ip:
-                 sriov_interface=value
-                 nova_str = ""
-                 sriov_str = ""
-                    
-                 if sriov_interface is not None: 
-                   for iface in sriov_interface:
-                     nova_str = '{}{{"devname":"{}", "physical_network": "physnet1"}},'.format(nova_str,iface)
-                     sriov_str = '{}physnet1:{},'.format(sriov_str,iface) 
-                   sriov_str = sriov_str.rstrip(",")
-                   nova_str = "[" + nova_str.rstrip(",") + "]"
-
-            multi_node_pb = pkg_resources.resource_filename(
-                consts.KOLLA_PB_PKG,
-                consts.MULTI_NODE_KOLLA_CONTROLLER_YAML)
-            ret_controller = apbl.launch_ansible_playbook(
-                iplist, multi_node_pb,
-                {'target': controller_ip, 'DOCKER_OPTS': docker_opts,
-                 'DOCKER_REGISTRY_IP': docker_registry_ip,
-                 'kolla_base': kolla_base, 'kolla_install': kolla_install,
-                 'PROXY_DATA_FILE': proxy_data_file,
-                 'VARIABLE_FILE': variable_file,
-                 'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH,
-                 'EXT_SUB': ext_sub, 'EXT_GW': ext_gw,
-                 'START_IP': ip_pool_start, 'END_IP': ip_pool_end,
-                 'DEFAULT': default, 'VXLAN': vxlan,
-                 'GIT_BRANCH': git_branch, 'KOLLA_TAG': kolla_tag,
-                 'KOLLA_ANSIBLE_TAG': kolla_ansible_tag,
-                 'CHECK_VAR': check_var, 'PULL_HUB': pull_from_hub,
-                 'GET_TAG': get_tag, 'SRIOV_INTERFACE': sriov_interface,
-                 'SRIOV_STRING': sriov_str,'NOVA_STRING': nova_str})
-            if ret_controller != 0:
-                logger.info("FAILED IN CONTROLLER" )
-                print(ret_controller)
-                exit(1)
+#        for controller_ip in list_controller:
+        if len(list_storage) == 1:
+            ceph_pb = pkg_resources.resource_filename(
+                consts.KOLLA_PB_PKG, consts.KOLLA_CEPH_SETUP)
+            apbl.launch_ansible_playbook(
+                iplist, ceph_pb, {
+                    'target': controller_ip,
+                    'VARIABLE_FILE': variable_file,
+                    'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH})
+        for key,value in host_sriov_interface_node_map.iteritems():
+          if key is node_ip:
+             sriov_interface=value
+             nova_str = ""
+             sriov_str = ""
+                
+             if sriov_interface is not None: 
+               for iface in sriov_interface:
+                 nova_str = '{}{{"devname":"{}", "physical_network": "physnet1"}},'.format(nova_str,iface)
+                 sriov_str = '{}physnet1:{},'.format(sriov_str,iface) 
+               sriov_str = sriov_str.rstrip(",")
+               nova_str = "[" + nova_str.rstrip(",") + "]"
+ 
+        multi_node_pb = pkg_resources.resource_filename(
+            consts.KOLLA_PB_PKG,
+            consts.MULTI_NODE_KOLLA_CONTROLLER_YAML)
+        ret_controller = apbl.launch_ansible_playbook(
+            iplist, multi_node_pb,
+            {'target': list_controller, 'DOCKER_OPTS': docker_opts,
+             'DOCKER_REGISTRY_IP': docker_registry_ip,
+             'kolla_base': kolla_base, 'kolla_install': kolla_install,
+             'PROXY_DATA_FILE': proxy_data_file,
+             'VARIABLE_FILE': variable_file,
+             'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH,
+             'EXT_SUB': ext_sub, 'EXT_GW': ext_gw,
+             'START_IP': ip_pool_start, 'END_IP': ip_pool_end,
+             'DEFAULT': default, 'VXLAN': vxlan,
+             'GIT_BRANCH': git_branch, 'KOLLA_TAG': kolla_tag,
+             'KOLLA_ANSIBLE_TAG': kolla_ansible_tag,
+             'CHECK_VAR': check_var, 'PULL_HUB': pull_from_hub,
+             'GET_TAG': get_tag, 'SRIOV_INTERFACE': sriov_interface,
+             'SRIOV_STRING': sriov_str,'NOVA_STRING': nova_str,'active_controller':list_controller[0]})
+        if ret_controller != 0:
+            logger.info("FAILED IN CONTROLLER" )
+            print(ret_controller)
+            exit(1)
 
         for node_ip in list_node:
            if dpdk_enable!="yes":
@@ -423,7 +424,7 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
                     'KOLLA_TAG': kolla_tag,
                     'KOLLA_ANSIBLE_TAG': kolla_ansible_tag,
                     'SRIOV_STRING': sriov_str,'NOVA_STRING': nova_str,
-                    'CONTROLLER_IP': ip_control})
+                    'CONTROLLER_IP': list_controller[0]})
             if ret != 0:
                 logger.error(" FAILED IN COMPUTE")
                 exit(1)
diff --git a/snaps_openstack/ansible_p/commission/openstack/playbooks/deploy_mode/kolla/multinode_kolla_controller.yaml b/snaps_openstack/ansible_p/commission/openstack/playbooks/deploy_mode/kolla/multinode_kolla_controller.yaml
index 093244c..3135433 100644
--- a/snaps_openstack/ansible_p/commission/openstack/playbooks/deploy_mode/kolla/multinode_kolla_controller.yaml
+++ b/snaps_openstack/ansible_p/commission/openstack/playbooks/deploy_mode/kolla/multinode_kolla_controller.yaml
@@ -442,6 +442,20 @@
          scheduler_available_filters = nova.scheduler.filters.all_filters
       when: enable_neutron_sriov == "yes" and CHECK_VAR == "absent"
 
+- hosts: "{{ active_controller }}"
+  become: true
+  vars_files:
+    - "{{ PROXY_DATA_FILE }}"
+    - "{{ VARIABLE_FILE }}"
+    - "{{BASE_FILE_PATH}}globals.yml"
+    - "{{BASE_FILE_PATH}}netvars.yml"
+
+  environment:
+    http_proxy: "{{ http_proxy }}"
+    https_proxy: "{{ https_proxy }}"
+    no_proxy: "{{ no_proxy }}"
+
+  tasks:
     - name: kolla generate passwords
       command: kolla-genpwd
 

From b168d56f339843fb83b0bd8d91b98237a7753f67 Mon Sep 17 00:00:00 2001
From: raman-mann <ramandeep.mann@aricent.com>
Date: Thu, 13 Sep 2018 08:08:46 -0600
Subject: [PATCH 2/6] resolved PEP8 issues

---
 .../ansible_utils/ansible_configuration.py    | 236 +++++++++---------
 1 file changed, 118 insertions(+), 118 deletions(-)

diff --git a/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py b/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py
index 4621acc..a165e4e 100755
--- a/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py
+++ b/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py
@@ -62,7 +62,7 @@ def provision_preparation(proxy_dict, user_dict):
 
 
 def clean_up_kolla(list_ip, docker_registry, service_list,
-                   operation, pull_from_hub, host_storage_node_map,dpdk_enable):
+                   operation, pull_from_hub, host_storage_node_map, dpdk_enable):
     """
     This method is responsible for the cleanup of openstack services
     """
@@ -73,28 +73,28 @@ def clean_up_kolla(list_ip, docker_registry, service_list,
             list_ip, cleanup_hosts_pb, {
                 'PROXY_DATA_FILE': proxy_data_file,
                 'VARIABLE_FILE': variable_file,
-                'DPDK_ENABLE':dpdk_enable})
+                'DPDK_ENABLE': dpdk_enable})
         if ret != 0:
             logger.info('FAILED IN CLEANUP')
             exit(1)
         if 'cinder' in service_list:
-            for key,value in host_storage_node_map.iteritems():
-               ip = key
-               second_storage = value
-               logger.info(ip)
-               logger.info(second_storage)   
-               remove_storage_pb = pkg_resources.resource_filename(
-                   consts.KOLLA_PB_PKG, consts.KOLLA_REMOVE_STORAGE)
-               ret_storage = apbl.launch_ansible_playbook(
-                   list_ip, remove_storage_pb, {
-                       'target': ip,
-                       'PROXY_DATA_FILE': proxy_data_file,
-                       'VARIABLE_FILE': variable_file,
-                       'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH,
-                       'SECOND_STORAGE': second_storage})
-               if ret_storage != 0:
-                   logger.info('FAILED')
-                   exit(1)
+            for key, value in host_storage_node_map.iteritems():
+                ip = key
+                second_storage = value
+                logger.info(ip)
+                logger.info(second_storage)
+                remove_storage_pb = pkg_resources.resource_filename(
+                    consts.KOLLA_PB_PKG, consts.KOLLA_REMOVE_STORAGE)
+                ret_storage = apbl.launch_ansible_playbook(
+                    list_ip, remove_storage_pb, {
+                        'target': ip,
+                        'PROXY_DATA_FILE': proxy_data_file,
+                        'VARIABLE_FILE': variable_file,
+                        'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH,
+                        'SECOND_STORAGE': second_storage})
+                if ret_storage != 0:
+                    logger.info('FAILED')
+                    exit(1)
 
         remove_images_pb = pkg_resources.resource_filename(
             consts.KOLLA_PB_PKG, consts.KOLLA_REMOVE_IMAGES)
@@ -134,7 +134,7 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
                               ip_pool_end, operation,
                               host_cpu_map, reserve_memory, base_size, count,
                               default, vxlan, pull_from_hub, host_storage_node_map, host_sriov_interface_node_map,
-							  dpdk_enable):
+                              dpdk_enable):
     if pull_from_hub != "yes":
         docker_opts = "--insecure-registry  " + docker_registry + ":" + str(
             docker_port)
@@ -150,7 +150,7 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
     list_controller = []
     list_compute = []
     ip_control = None
-    second_storage = None 
+    second_storage = None
     for key, value in host_name_map.items():
         ip = value
         host_name = key
@@ -231,7 +231,7 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
                 'GIT_BRANCH': git_branch,
                 'KOLLA_TAG': kolla_tag,
                 'KOLLA_ANSIBLE_TAG': kolla_ansible_tag,
-                'LIST_ALL':iplist})
+                'LIST_ALL': iplist})
         logger.info(ret)
         print('#####################################################')
         if ret != 0:
@@ -282,56 +282,56 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
             '**********************MULTINODE_DEPLOYMENT**********************')
         if list_storage:
             for storage_ip in list_storage:
-              for key,value in host_storage_node_map.iteritems():
-                if key is storage_ip:
-                  second_storage=value 
-                  set_storage_pb = pkg_resources.resource_filename(
-                    consts.KOLLA_PB_PKG, consts.KOLLA_SET_STORAGE)
-                  ret_storage = apbl.launch_ansible_playbook(
-                    iplist, set_storage_pb, {
-                        'target': storage_ip,
-                        'PROXY_DATA_FILE': proxy_data_file,
-                        'VARIABLE_FILE': variable_file,
-                        'SECOND_STORAGE': second_storage,
-                        'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH,
-                        'OPERATION': operation, 'BASE_SIZE': base_size,
-                        'COUNT': count})
+                for key, value in host_storage_node_map.iteritems():
+                    if key is storage_ip:
+                        second_storage = value
+                        set_storage_pb = pkg_resources.resource_filename(
+                            consts.KOLLA_PB_PKG, consts.KOLLA_SET_STORAGE)
+                        ret_storage = apbl.launch_ansible_playbook(
+                            iplist, set_storage_pb, {
+                                'target': storage_ip,
+                                'PROXY_DATA_FILE': proxy_data_file,
+                                'VARIABLE_FILE': variable_file,
+                                'SECOND_STORAGE': second_storage,
+                                'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH,
+                                'OPERATION': operation, 'BASE_SIZE': base_size,
+                                'COUNT': count})
+
+                        if ret_storage != 0:
+                            logger.info("FAILED IN SETTING STORAGE")
+                            exit(1)
 
-                  if ret_storage != 0:
-                    logger.info("FAILED IN SETTING STORAGE")
-                    exit(1)
-        
         for node_ip in list_node:
-          for key,value in host_sriov_interface_node_map.iteritems():
-            if key is node_ip:
-               sriov_interface=value
-               multi_node_pb = pkg_resources.resource_filename(
-                   consts.KOLLA_PB_PKG,
-                   consts.MULTI_NODE_KOLLA_COMPUTE_YAML)
-               ret = apbl.launch_ansible_playbook(
-                 iplist, multi_node_pb, {
-                     'DOCKER_OPTS': docker_opts,
-                     'DOCKER_REGISTRY_IP': docker_registry_ip,
-                     'target': node_ip,
-                     'PROXY_DATA_FILE': proxy_data_file,
-                     'VARIABLE_FILE': variable_file,
-                     'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH,
-                     'SECOND_STORAGE': second_storage,
-                     'BASE_SIZE': base_size,
-                     'COUNT': count, 'GIT_BRANCH': git_branch,
-                     'KOLLA_TAG': kolla_tag,
-                     'KOLLA_ANSIBLE_TAG': kolla_ansible_tag,
-                     'DEFAULT': default, 'VXLAN': vxlan,
-                     'PULL_HUB': pull_from_hub,
-                     'SRIOV_INTERFACE': sriov_interface})
-
-               if ret != 0:
-                  print(ret)
-                  logger.info("FAILED IN COMPUTE")
-                  exit(1)
-               else:
-                 logger.info(
-                   "***********PLAYBOOK EXECUTED SUCCESSFULLY***********")
+            for key, value in host_sriov_interface_node_map.iteritems():
+                if key is node_ip:
+                    sriov_interface = value
+                    multi_node_pb = pkg_resources.resource_filename(
+                        consts.KOLLA_PB_PKG,
+                        consts.MULTI_NODE_KOLLA_COMPUTE_YAML)
+                    ret = apbl.launch_ansible_playbook(
+                        iplist, multi_node_pb, {
+                            'DOCKER_OPTS': docker_opts,
+                            'DOCKER_REGISTRY_IP': docker_registry_ip,
+                            'target': node_ip,
+                            'PROXY_DATA_FILE': proxy_data_file,
+                            'VARIABLE_FILE': variable_file,
+                            'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH,
+                            'SECOND_STORAGE': second_storage,
+                            'BASE_SIZE': base_size,
+                            'COUNT': count, 'GIT_BRANCH': git_branch,
+                            'KOLLA_TAG': kolla_tag,
+                            'KOLLA_ANSIBLE_TAG': kolla_ansible_tag,
+                            'DEFAULT': default, 'VXLAN': vxlan,
+                            'PULL_HUB': pull_from_hub,
+                            'SRIOV_INTERFACE': sriov_interface})
+
+                    if ret != 0:
+                        print(ret)
+                        logger.info("FAILED IN COMPUTE")
+                        exit(1)
+                    else:
+                        logger.info(
+                            "***********PLAYBOOK EXECUTED SUCCESSFULLY***********")
 #        for controller_ip in list_controller:
         if len(list_storage) == 1:
             ceph_pb = pkg_resources.resource_filename(
@@ -341,19 +341,19 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
                     'target': controller_ip,
                     'VARIABLE_FILE': variable_file,
                     'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH})
-        for key,value in host_sriov_interface_node_map.iteritems():
-          if key is node_ip:
-             sriov_interface=value
-             nova_str = ""
-             sriov_str = ""
-                
-             if sriov_interface is not None: 
-               for iface in sriov_interface:
-                 nova_str = '{}{{"devname":"{}", "physical_network": "physnet1"}},'.format(nova_str,iface)
-                 sriov_str = '{}physnet1:{},'.format(sriov_str,iface) 
-               sriov_str = sriov_str.rstrip(",")
-               nova_str = "[" + nova_str.rstrip(",") + "]"
- 
+        for key, value in host_sriov_interface_node_map.iteritems():
+            if key is node_ip:
+                sriov_interface = value
+                nova_str = ""
+                sriov_str = ""
+
+                if sriov_interface is not None:
+                    for iface in sriov_interface:
+                        nova_str = '{}{{"devname":"{}", "physical_network": "physnet1"}},'.format(nova_str, iface)
+                        sriov_str = '{}physnet1:{},'.format(sriov_str, iface)
+                    sriov_str = sriov_str.rstrip(",")
+                    nova_str = "[" + nova_str.rstrip(",") + "]"
+
         multi_node_pb = pkg_resources.resource_filename(
             consts.KOLLA_PB_PKG,
             consts.MULTI_NODE_KOLLA_CONTROLLER_YAML)
@@ -372,42 +372,42 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
              'KOLLA_ANSIBLE_TAG': kolla_ansible_tag,
              'CHECK_VAR': check_var, 'PULL_HUB': pull_from_hub,
              'GET_TAG': get_tag, 'SRIOV_INTERFACE': sriov_interface,
-             'SRIOV_STRING': sriov_str,'NOVA_STRING': nova_str,'active_controller':list_controller[0]})
+             'SRIOV_STRING': sriov_str, 'NOVA_STRING': nova_str, 'active_controller': list_controller[0]})
         if ret_controller != 0:
-            logger.info("FAILED IN CONTROLLER" )
+            logger.info("FAILED IN CONTROLLER")
             print(ret_controller)
             exit(1)
 
         for node_ip in list_node:
-           if dpdk_enable!="yes":
-              multi_node_pb = pkg_resources.resource_filename(
-                  consts.KOLLA_PB_PKG,
-                  consts.MULTI_NODE_KOLLA_ISO_NWK_YAML)
-              ret = apbl.launch_ansible_playbook(
-                  iplist, multi_node_pb, {
-                      'target': node_ip,
-                      'PROXY_DATA_FILE': proxy_data_file,
-                      'VARIABLE_FILE': variable_file,
-                      'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH})
-              if ret != 0:
-                  logger.error("NETWORK ADAPTATION FAILED IN COMPUTE")
-                  exit(1)
-              else:
-                  logger.info(
-                      "*********ISO NWK PLAYBOOK EXECUTED SUCCESSFULLY*********")
+            if dpdk_enable != "yes":
+                multi_node_pb = pkg_resources.resource_filename(
+                    consts.KOLLA_PB_PKG,
+                    consts.MULTI_NODE_KOLLA_ISO_NWK_YAML)
+                ret = apbl.launch_ansible_playbook(
+                    iplist, multi_node_pb, {
+                        'target': node_ip,
+                        'PROXY_DATA_FILE': proxy_data_file,
+                        'VARIABLE_FILE': variable_file,
+                        'BASE_FILE_PATH': consts.KOLLA_SOURCE_PATH})
+                if ret != 0:
+                    logger.error("NETWORK ADAPTATION FAILED IN COMPUTE")
+                    exit(1)
+                else:
+                    logger.info(
+                        "*********ISO NWK PLAYBOOK EXECUTED SUCCESSFULLY*********")
 
         for node_ip in list_compute:
-            for key,value in host_sriov_interface_node_map.iteritems():
+            for key, value in host_sriov_interface_node_map.iteritems():
                 if key is node_ip:
-                   sriov_interface=value
-                   nova_str = ""
-                   sriov_str = ""
-                   if sriov_interface is not None: 
-                       for iface in sriov_interface:
-                         nova_str = '{}{{"devname":"{}", "physical_network": "physnet1"}},'.format(nova_str,iface)
-                         sriov_str = '{}physnet1:{},'.format(sriov_str,iface)                         
-                       sriov_str = sriov_str.rstrip(",")
-                       nova_str = "[" + nova_str.rstrip(",") + "]"
+                    sriov_interface = value
+                    nova_str = ""
+                    sriov_str = ""
+                    if sriov_interface is not None:
+                        for iface in sriov_interface:
+                            nova_str = '{}{{"devname":"{}", "physical_network": "physnet1"}},'.format(nova_str, iface)
+                            sriov_str = '{}physnet1:{},'.format(sriov_str, iface)
+                        sriov_str = sriov_str.rstrip(",")
+                        nova_str = "[" + nova_str.rstrip(",") + "]"
 
             vcpu_pin = host_cpu_map.get(node_ip)
             memory = reserve_memory.get(node_ip)
@@ -423,7 +423,7 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
                     'DEFAULT': default, 'VXLAN': vxlan,
                     'KOLLA_TAG': kolla_tag,
                     'KOLLA_ANSIBLE_TAG': kolla_ansible_tag,
-                    'SRIOV_STRING': sriov_str,'NOVA_STRING': nova_str,
+                    'SRIOV_STRING': sriov_str, 'NOVA_STRING': nova_str,
                     'CONTROLLER_IP': list_controller[0]})
             if ret != 0:
                 logger.error(" FAILED IN COMPUTE")
@@ -433,13 +433,13 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
                     "*****************EXECUTED SUCCESSFULLY*****************")
     else:
         logger.info('ALL IN ONE DEPLOYEMENT')
-        if(len(host_storage_node_map)==1):
-          second_storage=host_storage_node_map.values()[0]
-          logger.info(host_storage_node_map)
-          logger.info(second_storage)
+        if(len(host_storage_node_map) == 1):
+            second_storage = host_storage_node_map.values()[0]
+            logger.info(host_storage_node_map)
+            logger.info(second_storage)
         else:
-          logger.info("Failed in creating storage map")
-          exit(1)
+            logger.info("Failed in creating storage map")
+            exit(1)
 
         single_node_pb = pkg_resources.resource_filename(
             consts.KOLLA_PB_PKG, consts.SINGLE_NODE_KOLLA_YAML)

From 4802a68e2c5443b37a2885ff38764260eb7422f7 Mon Sep 17 00:00:00 2001
From: raman-mann <ramandeep.mann@aricent.com>
Date: Thu, 27 Sep 2018 08:23:34 -0600
Subject: [PATCH 3/6] changes for CI/CD

---
 ci/playbooks/templates/deployment.yaml.tmplt |  32 ++++++
 ci/snaps/snaps_os_tmplt.yaml                 | 106 +++++++++++++++++++
 2 files changed, 138 insertions(+)

diff --git a/ci/playbooks/templates/deployment.yaml.tmplt b/ci/playbooks/templates/deployment.yaml.tmplt
index ef3ab92..c7f4de1 100644
--- a/ci/playbooks/templates/deployment.yaml.tmplt
+++ b/ci/playbooks/templates/deployment.yaml.tmplt
@@ -93,6 +93,38 @@ openstack:
         password: {{ node_host_pass }}
         service_host: {{ admin_ip_1 }}
         user: root
+#controller HA config: Adding second controller host for HA
+    -
+      host:
+        hostname: CONTROLLER2
+        interfaces:
+          -
+            ip: {{ admin_ip_4 }}
+            mac: {{ admin_mac_4 }}
+            name: {{ admin_iface }}
+            type: management
+          -
+            ip: {{ private_ip_4 }}
+            mac: {{ private_mac_4 }}
+            name: {{ priv_iface }}
+            type: tenant
+          -
+            gateway: {{ public_gateway }}
+            ip: {{ public_ip_4 }}
+            mac: {{ public_mac_4 }}
+            name: {{ pub_iface }}
+            type: data
+        isolcpus: {{ isolcpus }}
+        reserved_host_memory_mb: {{ host_memory_mb }}
+        node_type:
+          - controller
+          - storage
+        second_storage:
+          - "/dev/vdb"
+        password: {{ node_host_pass }}
+        service_host: {{ admin_ip_1 }}
+        user: root
+#controller HA config ends
   networks:
     external:
       gateway: {{ public_gateway }}
diff --git a/ci/snaps/snaps_os_tmplt.yaml b/ci/snaps/snaps_os_tmplt.yaml
index 247fbe8..30b3cf6 100644
--- a/ci/snaps/snaps_os_tmplt.yaml
+++ b/ci/snaps/snaps_os_tmplt.yaml
@@ -213,6 +213,14 @@ openstack:
           project_name: os-deploy-proj-{{ build_id }}
         name: os-deploy-vol3-{{ build_id }}
         size: 50
+#controller HA config: Adding volume for second controller instance
+    - volume:
+        os_user:
+          name: os-deploy-user-{{ build_id }}
+          project_name: os-deploy-proj-{{ build_id }}
+        name: os-deploy-vol4-{{ build_id }}
+        size: 50
+#controller HA config ends
   instances:
     # TODO - Improve NIC config. see https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html#network-config-v2
     - instance:
@@ -486,6 +494,72 @@ openstack:
               ip_addrs:
                 - subnet_name: os-public-subnet-{{ build_id }}
                   ip: {{ pub_ip_prfx }}.13
+#controller HA config: Adding one more controller instance for controller HA
+    - instance:
+        os_user:
+          name: os-deploy-user-{{ build_id }}
+          project_name: os-deploy-proj-{{ build_id }}
+        name: os-node-4-{{ build_id }}
+        flavor: os-compute-flavor-{{ build_id }}
+        imageName: ubuntu-16-04
+        security_group_names: [os-deploy-build-sg-{{ build_id }}]
+        cloud_init_timeout: 1000
+        volume_names:
+          - os-deploy-vol4-{{ build_id }}
+        userdata: |
+          #cloud-config
+          chpasswd:
+            list: |
+              root:{{ node_host_password }}
+            expire: False
+          ssh_pwauth: True
+          packages:
+            - python
+          runcmd:
+            - [sh, -c, "mv /etc/network/interfaces /etc/network/interfaces.orig"]
+            - [sh, -c, "echo 'iface lo inet loopback' >> /etc/network/interfaces"]
+            - [sh, -c, "echo 'auto {{ admin_iface }}' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  iface {{ admin_iface }} inet static' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  address {{ admin_ip_prfx }}.14' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  netmask 255.255.255.0' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  mtu 1450' >> /etc/network/interfaces"]
+            - [sh, -c, "echo 'auto {{ priv_iface }}' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  iface {{ priv_iface }} inet static' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  address {{ priv_ip_prfx }}.14' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  netmask 255.255.255.0' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  mtu 1450' >> /etc/network/interfaces"]
+            - [sh, -c, "echo 'auto {{ pub_iface }}' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  iface {{ pub_iface }} inet static' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  address {{ pub_ip_prfx }}.14' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  netmask 255.255.255.0' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  gateway {{ pub_ip_prfx }}.1' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  dns-nameservers 8.8.8.8' >> /etc/network/interfaces"]
+            - [sh, -c, "echo '  mtu 1450' >> /etc/network/interfaces"]
+            - ip addr flush {{ admin_iface }}
+            - systemctl restart networking
+            - apt install -y python
+            - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
+            - systemctl restart ssh
+        ports:
+          - port:
+              name: os-deploy-admin-port-4-{{ build_id }}
+              network_name: os-admin-net-{{ build_id }}
+              ip_addrs:
+                - subnet_name: os-admin-subnet-{{ build_id }}
+                  ip: {{ admin_ip_prfx }}.14
+          - port:
+              name: os-deploy-priv-port-4-{{ build_id }}
+              network_name: os-priv-net-{{ build_id }}
+              ip_addrs:
+                - subnet_name: os-priv-subnet-{{ build_id }}
+                  ip: {{ priv_ip_prfx }}.14
+          - port:
+              name: os-deploy-pub-port-4-{{ build_id }}
+              network_name: os-public-net-{{ build_id }}
+              ip_addrs:
+                - subnet_name: os-public-subnet-{{ build_id }}
+                  ip: {{ pub_ip_prfx }}.14
+#controller HA config ends
 ansible:
   # Install and configure snaps-boot to build host
   - playbook_location: {{ local_snaps_openstack_dir }}/ci/playbooks/deploy_os.yaml
@@ -588,6 +662,38 @@ ansible:
         vm_name: os-node-3-{{ build_id }}
         port_name: os-deploy-pub-port-3-{{ build_id }}
         port_value: mac_address
+#controller HA config: Sencond controller variables
+      admin_ip_4:
+        type: port
+        vm_name: os-node-4-{{ build_id }}
+        port_name: os-deploy-admin-port-4-{{ build_id }}
+        port_value: ip_address
+      admin_mac_4:
+        type: port
+        vm_name: os-node-4-{{ build_id }}
+        port_name: os-deploy-admin-port-4-{{ build_id }}
+        port_value: mac_address
+      private_ip_4:
+        type: port
+        vm_name: os-node-4-{{ build_id }}
+        port_name: os-deploy-priv-port-4-{{ build_id }}
+        port_value: ip_address
+      private_mac_4:
+        type: port
+        vm_name: os-node-4-{{ build_id }}
+        port_name: os-deploy-priv-port-4-{{ build_id }}
+        port_value: mac_address
+      public_ip_4:
+        type: port
+        vm_name: os-node-4-{{ build_id }}
+        port_name: os-deploy-pub-port-4-{{ build_id }}
+        port_value: ip_address
+      public_mac_4:
+        type: port
+        vm_name: os-node-4-{{ build_id }}
+        port_name: os-deploy-pub-port-4-{{ build_id }}
+        port_value: mac_address
+#controller HA config end
       public_gateway:
         type: network
         network_name: os-public-net-{{ build_id }}

From cfb29c129d338c5ef4468bfce344d61fe9e26ede Mon Sep 17 00:00:00 2001
From: Randy Levensalor <r.levensalor@cablelabs.com>
Date: Mon, 1 Oct 2018 21:41:58 -0600
Subject: [PATCH 4/6] fixing ci issues

---
 ci/playbooks/deploy_os.yaml  | 13 +++++++++++++
 ci/snaps/snaps_os_tmplt.yaml |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ci/playbooks/deploy_os.yaml b/ci/playbooks/deploy_os.yaml
index a52eedf..51a7b49 100644
--- a/ci/playbooks/deploy_os.yaml
+++ b/ci/playbooks/deploy_os.yaml
@@ -77,6 +77,13 @@
       register: result
       until: result.rc == 0
 
+    - name: Copy root's key to node 4 @{{ admin_ip_4 }}
+      command: "sshpass -p {{ node_host_pass }} ssh-copy-id -i /root/.ssh/id_rsa.pub -o StrictHostKeyChecking=no root@{{ admin_ip_4 }}"
+      retries: 30
+      delay: 3
+      register: result
+      until: result.rc == 0
+
     - name: Modify Build server configfs
       command: "modprobe configfs"
 
@@ -101,6 +108,12 @@
     - name: Restart Node 3 sys-kernel-config.mount
       command: "ssh root@{{ admin_ip_3 }} 'systemctl restart sys-kernel-config.mount'"
 
+    - name: Modify Node 4 configfs
+      command: "ssh root@{{ admin_ip_4 }} 'modprobe configfs'"
+
+    - name: Restart Node 4 sys-kernel-config.mount
+      command: "ssh root@{{ admin_ip_4 }} 'systemctl restart sys-kernel-config.mount'"
+
     - name: Apply template and copy deployment.yaml.tmplt to {{ src_copy_dir }}/deployment.yaml
       action: template src=templates/deployment.yaml.tmplt dest={{ src_copy_dir }}/deployment.yaml
 
diff --git a/ci/snaps/snaps_os_tmplt.yaml b/ci/snaps/snaps_os_tmplt.yaml
index 30b3cf6..f440fc8 100644
--- a/ci/snaps/snaps_os_tmplt.yaml
+++ b/ci/snaps/snaps_os_tmplt.yaml
@@ -500,7 +500,7 @@ openstack:
           name: os-deploy-user-{{ build_id }}
           project_name: os-deploy-proj-{{ build_id }}
         name: os-node-4-{{ build_id }}
-        flavor: os-compute-flavor-{{ build_id }}
+        flavor: os-control-flavor-{{ build_id }}
         imageName: ubuntu-16-04
         security_group_names: [os-deploy-build-sg-{{ build_id }}]
         cloud_init_timeout: 1000

From eeec5b0b989aea3a2ead490591ca1c4caad7d62c Mon Sep 17 00:00:00 2001
From: Ramandeep Singh <32567631+raman-mann@users.noreply.github.com>
Date: Thu, 11 Oct 2018 17:16:42 +0530
Subject: [PATCH 5/6] Update ansible_configuration.py

---
 .../ansible_p/ansible_utils/ansible_configuration.py            | 2 --
 1 file changed, 2 deletions(-)

diff --git a/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py b/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py
index a165e4e..cba1c72 100755
--- a/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py
+++ b/snaps_openstack/ansible_p/ansible_utils/ansible_configuration.py
@@ -261,8 +261,6 @@ def launch_provisioning_kolla(iplist, git_branch, kolla_tag, kolla_ansible_tag,
             logger.info('FAILED IN SETTING DOCKER REGISTRY')
             exit(1)
     for controller in list_controller:
-        print "copy key from raman"
-        print controller
         copy_key_pb = pkg_resources.resource_filename(
             consts.KOLLA_PB_PKG, consts.KOLLA_COPY_KEY)
         apbl.launch_ansible_playbook(

From c45d396794d610ac88c712d3dd88702fabf460ba Mon Sep 17 00:00:00 2001
From: Ramandeep Singh <32567631+raman-mann@users.noreply.github.com>
Date: Thu, 22 Nov 2018 14:53:08 +0530
Subject: [PATCH 6/6] Update snaps_os_tmplt.yaml

Increasing project quota for HA
---
 ci/snaps/snaps_os_tmplt.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ci/snaps/snaps_os_tmplt.yaml b/ci/snaps/snaps_os_tmplt.yaml
index f440fc8..ea96811 100644
--- a/ci/snaps/snaps_os_tmplt.yaml
+++ b/ci/snaps/snaps_os_tmplt.yaml
@@ -34,8 +34,8 @@ openstack:
         description: Project for Orchestrators
         users: [os-deploy-user-{{ build_id }}, {{ admin_user }}]
         quotas:
-          ram: 102400
-          cores: 40
+          ram: 128000
+          cores: 48
   users:
     - user:
         os_creds_name: admin-creds
