Don't set availability_zone for 2.32 version of api

Closes-Bug: #2065769
Change-Id: Id0c7dc63e6dca5d32cf1cf8983588d44601b4338
(cherry picked from commit ae363bdf089831685ca963a829514ebfb69c640e)
This commit is contained in:
morozovalekseywot 2024-05-15 19:50:33 +03:00 committed by Goutham Pacha Ravi
parent f8ea4a7ded
commit 2db76103b6
3 changed files with 18 additions and 9 deletions

@ -308,13 +308,16 @@ class CreateShareNetwork(command.ShowOne):
elif parsed_args.availability_zone:
availability_zone = parsed_args.availability_zone
share_network = share_client.share_networks.create(
name=parsed_args.name,
description=parsed_args.description,
neutron_net_id=parsed_args.neutron_net_id,
neutron_subnet_id=parsed_args.neutron_subnet_id,
availability_zone=availability_zone,
)
kwargs = {
"name": parsed_args.name,
"description": parsed_args.description,
"neutron_net_id": parsed_args.neutron_net_id,
"neutron_subnet_id": parsed_args.neutron_subnet_id,
}
if availability_zone:
kwargs['availability_zone'] = availability_zone
share_network = share_client.share_networks.create(**kwargs)
share_network_data = share_network._info
share_network_data.pop('links', None)
if parsed_args.formatter == 'table':

@ -79,8 +79,7 @@ class TestShareNetworkCreate(TestShareNetwork):
name=None,
description=None,
neutron_net_id=None,
neutron_subnet_id=None,
availability_zone=None)
neutron_subnet_id=None)
self.assertCountEqual(self.columns, columns)
self.assertCountEqual(expected_data.values(), data)

@ -0,0 +1,7 @@
---
fixes:
- |
Share network create command failed with 2.32 version of api, due to set
availability zone argument for old version of create function, which doesn't have
this argument. The bug was fixed by adding a check that the user set the
availability zone in query.