Merge "Fix "per_share_gigabytes" in "openstack quota set""

This commit is contained in:
Zuul 2024-02-06 07:15:03 +00:00 committed by Gerrit Code Review
commit 8fd50c30e9
3 changed files with 23 additions and 8 deletions

View File

@ -160,7 +160,6 @@ class QuotaSet(command.Command):
"gigabytes": parsed_args.gigabytes,
"snapshot_gigabytes": parsed_args.snapshot_gigabytes,
"share_networks": parsed_args.share_networks,
"per_share_gigabytes": parsed_args.per_share_gigabytes,
}
if parsed_args.share_type is not None:

View File

@ -78,8 +78,7 @@ class TestQuotaSet(TestQuotas):
share_networks=None,
shares=40,
snapshot_gigabytes=None,
snapshots=None,
per_share_gigabytes=None)
snapshots=None)
self.assertIsNone(result)
mock_find_resource.assert_not_called()
self.quotas_mock.assert_not_called()
@ -107,7 +106,6 @@ class TestQuotaSet(TestQuotas):
shares=40,
snapshot_gigabytes=None,
snapshots=None,
per_share_gigabytes=None,
tenant_id=self.project.id,
user_id=None)
self.assertIsNone(result)
@ -135,7 +133,6 @@ class TestQuotaSet(TestQuotas):
shares=None,
snapshot_gigabytes=None,
snapshots=None,
per_share_gigabytes=None,
tenant_id=self.project.id,
user_id=None)
self.assertIsNone(result)
@ -164,7 +161,6 @@ class TestQuotaSet(TestQuotas):
shares=None,
snapshot_gigabytes=None,
snapshots=None,
per_share_gigabytes=None,
tenant_id=self.project.id,
user_id=None)
self.assertIsNone(result)
@ -195,7 +191,6 @@ class TestQuotaSet(TestQuotas):
snapshot_gigabytes=None,
snapshots=None,
tenant_id=self.project.id,
per_share_gigabytes=None,
user_id=None)
self.assertIsNone(result)
@ -290,7 +285,6 @@ class TestQuotaSet(TestQuotas):
shares=None,
snapshot_gigabytes=None,
snapshots=None,
per_share_gigabytes=None,
tenant_id=self.project.id,
user_id=None)
self.assertIsNone(result)
@ -311,6 +305,22 @@ class TestQuotaSet(TestQuotas):
self.assertRaises(
exceptions.CommandError, self.cmd.take_action, parsed_args)
def test_quota_set_per_share_gigabytes_exception(self):
self.app.client_manager.share.api_version = api_versions.APIVersion(
'2.61')
arglist = [
self.project.id,
'--per-share-gigabytes', '10',
]
verifylist = [
('project', self.project.id),
('per_share_gigabytes', 10)
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.assertRaises(
exceptions.CommandError, self.cmd.take_action, parsed_args)
def test_quota_set_per_share_gigabytes(self):
arglist = [
self.project.id,

View File

@ -0,0 +1,6 @@
---
fixes:
- |
The `openstack share quota set` command has been fixed to not set
`per_share_gigabytes` unless the user has specified the parameter, and
unless the user requests, and the server supports API version 2.62.