Merge "Don't set availability_zone for 2.32 version of api"

This commit is contained in:
Zuul 2024-05-22 01:43:22 +00:00 committed by Gerrit Code Review
commit 85f2173217
3 changed files with 18 additions and 9 deletions

View File

@ -310,13 +310,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
if 'share_network_subnets' not in share_network_data:
share_network_data['share_network_subnets'] = []

View File

@ -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)

View File

@ -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.