Fix "per_share_gigabytes" in "openstack quota set"
The "per_share_gigabytes" quota param was introduced in API version 2.62; when using older API versions, we shouldn't be setting this parameter. Closes-Bug: #2047249 Change-Id: I1eceee52726cef3494648521e4516010ca02f095
This commit is contained in:
parent
da4c929b90
commit
3ec364d1fd
|
@ -160,7 +160,6 @@ class QuotaSet(command.Command):
|
||||||
"gigabytes": parsed_args.gigabytes,
|
"gigabytes": parsed_args.gigabytes,
|
||||||
"snapshot_gigabytes": parsed_args.snapshot_gigabytes,
|
"snapshot_gigabytes": parsed_args.snapshot_gigabytes,
|
||||||
"share_networks": parsed_args.share_networks,
|
"share_networks": parsed_args.share_networks,
|
||||||
"per_share_gigabytes": parsed_args.per_share_gigabytes,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if parsed_args.share_type is not None:
|
if parsed_args.share_type is not None:
|
||||||
|
|
|
@ -78,8 +78,7 @@ class TestQuotaSet(TestQuotas):
|
||||||
share_networks=None,
|
share_networks=None,
|
||||||
shares=40,
|
shares=40,
|
||||||
snapshot_gigabytes=None,
|
snapshot_gigabytes=None,
|
||||||
snapshots=None,
|
snapshots=None)
|
||||||
per_share_gigabytes=None)
|
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
mock_find_resource.assert_not_called()
|
mock_find_resource.assert_not_called()
|
||||||
self.quotas_mock.assert_not_called()
|
self.quotas_mock.assert_not_called()
|
||||||
|
@ -107,7 +106,6 @@ class TestQuotaSet(TestQuotas):
|
||||||
shares=40,
|
shares=40,
|
||||||
snapshot_gigabytes=None,
|
snapshot_gigabytes=None,
|
||||||
snapshots=None,
|
snapshots=None,
|
||||||
per_share_gigabytes=None,
|
|
||||||
tenant_id=self.project.id,
|
tenant_id=self.project.id,
|
||||||
user_id=None)
|
user_id=None)
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
|
@ -135,7 +133,6 @@ class TestQuotaSet(TestQuotas):
|
||||||
shares=None,
|
shares=None,
|
||||||
snapshot_gigabytes=None,
|
snapshot_gigabytes=None,
|
||||||
snapshots=None,
|
snapshots=None,
|
||||||
per_share_gigabytes=None,
|
|
||||||
tenant_id=self.project.id,
|
tenant_id=self.project.id,
|
||||||
user_id=None)
|
user_id=None)
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
|
@ -164,7 +161,6 @@ class TestQuotaSet(TestQuotas):
|
||||||
shares=None,
|
shares=None,
|
||||||
snapshot_gigabytes=None,
|
snapshot_gigabytes=None,
|
||||||
snapshots=None,
|
snapshots=None,
|
||||||
per_share_gigabytes=None,
|
|
||||||
tenant_id=self.project.id,
|
tenant_id=self.project.id,
|
||||||
user_id=None)
|
user_id=None)
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
|
@ -195,7 +191,6 @@ class TestQuotaSet(TestQuotas):
|
||||||
snapshot_gigabytes=None,
|
snapshot_gigabytes=None,
|
||||||
snapshots=None,
|
snapshots=None,
|
||||||
tenant_id=self.project.id,
|
tenant_id=self.project.id,
|
||||||
per_share_gigabytes=None,
|
|
||||||
user_id=None)
|
user_id=None)
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
|
|
||||||
|
@ -290,7 +285,6 @@ class TestQuotaSet(TestQuotas):
|
||||||
shares=None,
|
shares=None,
|
||||||
snapshot_gigabytes=None,
|
snapshot_gigabytes=None,
|
||||||
snapshots=None,
|
snapshots=None,
|
||||||
per_share_gigabytes=None,
|
|
||||||
tenant_id=self.project.id,
|
tenant_id=self.project.id,
|
||||||
user_id=None)
|
user_id=None)
|
||||||
self.assertIsNone(result)
|
self.assertIsNone(result)
|
||||||
|
@ -311,6 +305,22 @@ class TestQuotaSet(TestQuotas):
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
exceptions.CommandError, self.cmd.take_action, parsed_args)
|
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):
|
def test_quota_set_per_share_gigabytes(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
self.project.id,
|
self.project.id,
|
||||||
|
|
|
@ -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.
|
Loading…
Reference in New Issue