nuagenetworks / nuage-metroae

Nuage Networks Metro Automation Engine
http://devops.nuagenetworks.net
Apache License 2.0
44 stars 17 forks source link

v3.3.2 breaks OpenStack targeted deployments without availability zone #1273

Closed steve-butler closed 4 years ago

steve-butler commented 5 years ago

openstack_availability_zone should be an optional parameter. As a required parameter, functionality breaks for OpenStack environments not using availability zones.

The following files need to be updated:

Replace line: openstack_availability_zone: {{ item.openstack_availability_zone }} with:

{% if item.openstack_availability_zone is defined %}
openstack_availability_zone: {{ item.openstack_availability_zone }}
{% endif %}

Notability, dev branch already handles this correctly.

Error seen in v3.3.2:

TASK [common : Create host_vars files for vsd] ****************************************************************************************************************
failed: [localhost] (item={'openstack_subnet': u'mgmt_dc1', 'openstack_flavor': u'n1.vsd', 'mgmt_ip': u'10.35.6.11', 'target_server_type': u'openstack', 'openstack_image': u'VSD_601', 'hostname': u'sdwvsd01.lab.com', 'openstack_network': u'mgmt_dc1', 'mgmt_gateway': u'10.35.6.1', 'target_server': u'0.0.0.0', 'openstack_port_name': u'sdwan_prod_vsd_1', 'openstack_port_security_groups': [u'default'], 'mgmt_ip_prefix': 27}) =>
  item:
    hostname: sdwvsd01.lab.com
    mgmt_gateway: 10.35.6.1
    mgmt_ip: 10.35.6.11
    mgmt_ip_prefix: 27
    openstack_flavor: n1.vsd
    openstack_image: VSD_601
    openstack_network: mgmt_dc1
    openstack_port_name: sdwan_prod_vsd_1
    openstack_port_security_groups:
    - default
    openstack_subnet: mgmt_dc1
    target_server: 0.0.0.0
    target_server_type: openstack
  msg: 'AnsibleUndefinedVariable: ''dict object'' has no attribute ''openstack_availability_zone'''
steve-butler commented 5 years ago

The fix delivered in 3.3.3 does not resolve the issue for vsc.

Error:

TASK [vsc-predeploy : Creating VSC stack] **************************************
fatal: [sdwvsc01pgam.sdwan.tc.corp]: FAILED! =>
  msg: |-
    The task includes an option with an undefined variable. The error was: 'openstack_availability_zone' is undefined

    The error appears to have been in '/home/metro/nuage-metro/src/roles/vsc-predeploy/tasks/openstack.yml': line 36, column 5, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:

      - name: Creating VSC stack
        ^ here

In 3.3.4, the failing task looks like this:

  - name: Creating VSC stack
    register: create_stack
    os_stack:
      name: "{{ vm_name }}"
      template: "{{ vsc_heat_template }}"
      auth:
        "{{ openstack_auth }}"
      parameters:
        vm_name: "{{ vm_name }}"
        vsc_image: "{{ openstack_image }}"
        vsc_flavor: "{{ openstack_flavor }}"
        vsc_management_network: "{{ openstack_mgmt_network }}"
        vsc_management_subnet: "{{ openstack_mgmt_subnet | default('NONE') }}"
        vsc_control_network: "{{ openstack_control_network }}"
        vsc_control_subnet: "{{ openstack_control_subnet | default('NONE') }}"
        mgmt_ip: "{{ mgmt_ip | default('NONE') }}"
        control_ip: "{{ control_ip | default('NONE') }}"
        availability_zone: "{{ openstack_availability_zone }}"
    delegate_to: localhost

The availability_zone parameter should be conditional on existence of openstack_availability_zone.

Additionally, src/roles/vsd-predeploy/tasks/openstack.yml and src/roles/vstat-predeploy/tasks/openstack.yml are not using the availability_zone parameter. Therefore the feature implementation is not complete.

steve-butler commented 5 years ago

Correction: VSD and VSTAT implementation is okay. VSC conditional statement should be in template src/roles/vsc-predeploy/templates/openstack.j2 (Use vsd and vstat templates as reference)

ghost commented 4 years ago

Fixed in #1293 (MetroAE v3.3.5) and #1274 (MetroAE v3.3.3).