diff --git a/networking_aci/plugins/ml2/drivers/mech_aci/config.py b/networking_aci/plugins/ml2/drivers/mech_aci/config.py index 448c714..2069106 100644 --- a/networking_aci/plugins/ml2/drivers/mech_aci/config.py +++ b/networking_aci/plugins/ml2/drivers/mech_aci/config.py @@ -340,6 +340,10 @@ def _parse_hostgroups(self): .format(far_hg, hostgroup_name)) self._hostgroups[far_hg]['child_hostgroups'].append(hostgroup_name) + # copy over AZs so the AZ check works properly for subgroups + if not hostgroup['availability_zones']: + hostgroup['availability_zones'] = self._hostgroups[far_hg]['availability_zones'] + if not hostgroup['baremetal_pc_policy_group']: hostgroup['baremetal_pc_policy_group'] = CONF.ml2_aci.default_baremetal_pc_policy_group diff --git a/networking_aci/plugins/ml2/drivers/mech_aci/driver.py b/networking_aci/plugins/ml2/drivers/mech_aci/driver.py index 08f1d52..c8712c8 100644 --- a/networking_aci/plugins/ml2/drivers/mech_aci/driver.py +++ b/networking_aci/plugins/ml2/drivers/mech_aci/driver.py @@ -388,7 +388,7 @@ def _check_port_az_affinity(self, context, network, port): if az_hints: az_hint = az_hints[0] hg_az = [hostgroup['host_azs'][host]] if host in hostgroup['host_azs'] else hostgroup['availability_zones'] - if len(hg_az) > 1 or az_hint != hg_az[0]: + if len(hg_az) != 1 or az_hint != hg_az[0]: exc = aci_exc.HostgroupNetworkAZAffinityError(port_id=port['id'], hostgroup_name=hostgroup_name, host=host, hostgroup_az=", ".join(hg_az), network_az=az_hint)