Add support of snapshot gigabytes quotas
Manila is going to support separate gigabyte quota for snapshots. Need add its support to client. Change-Id: I6566c0f696fbe033cb036be5cda720f706fdc222
This commit is contained in:
parent
58cc003661
commit
363a4d6917
@ -85,6 +85,7 @@ class FakeHTTPClient(httpclient.HTTPClient):
|
||||
'shares': 1,
|
||||
'snapshots': 1,
|
||||
'gigabytes': 1,
|
||||
'snapshot_gigabytes': 1,
|
||||
'share_networks': 1,
|
||||
}
|
||||
}
|
||||
@ -98,6 +99,7 @@ class FakeHTTPClient(httpclient.HTTPClient):
|
||||
'shares': 1,
|
||||
'snapshots': 1,
|
||||
'gigabytes': 1,
|
||||
'snapshot_gigabytes': 1,
|
||||
'share_networks': 1,
|
||||
}
|
||||
}
|
||||
@ -114,6 +116,7 @@ class FakeHTTPClient(httpclient.HTTPClient):
|
||||
'shares': 2,
|
||||
'snapshots': 2,
|
||||
'gigabytes': 1,
|
||||
'snapshot_gigabytes': 1,
|
||||
'share_networks': 1,
|
||||
}
|
||||
}
|
||||
@ -131,6 +134,7 @@ class FakeHTTPClient(httpclient.HTTPClient):
|
||||
'shares': 1,
|
||||
'snapshots': 1,
|
||||
'gigabytes': 1,
|
||||
'snapshot_gigabytes': 1,
|
||||
'share_networks': 1,
|
||||
}
|
||||
}
|
||||
@ -147,6 +151,7 @@ class FakeHTTPClient(httpclient.HTTPClient):
|
||||
'shares': 2,
|
||||
'snapshots': 2,
|
||||
'gigabytes': 1,
|
||||
'snapshot_gigabytes': 1,
|
||||
'share_networks': 1,
|
||||
}
|
||||
}
|
||||
|
@ -41,16 +41,22 @@ class QuotaSetsTest(utils.TestCase):
|
||||
|
||||
def test_update_quota(self):
|
||||
q = cs.quotas.get('test')
|
||||
q.update(shares=2)
|
||||
q.update(shares=1)
|
||||
q.update(snapshots=2)
|
||||
q.update(gigabytes=3)
|
||||
q.update(snapshot_gigabytes=4)
|
||||
q.update(share_networks=5)
|
||||
cs.assert_called('PUT', '/os-quota-sets/test')
|
||||
|
||||
def test_update_user_quota(self):
|
||||
tenant_id = 'test'
|
||||
user_id = 'fake_user'
|
||||
q = cs.quotas.get(tenant_id)
|
||||
q.update(shares=2, user_id=user_id)
|
||||
q.update(shares=1, user_id=user_id)
|
||||
q.update(snapshots=2, user_id=user_id)
|
||||
q.update(gigabytes=3, user_id=user_id)
|
||||
q.update(snapshot_gigabytes=4, user_id=user_id)
|
||||
q.update(share_networks=5, user_id=user_id)
|
||||
url = '/os-quota-sets/%s?user_id=%s' % (tenant_id, user_id)
|
||||
cs.assert_called('PUT', url)
|
||||
|
||||
|
@ -40,7 +40,8 @@ class QuotaSetManager(base.ManagerWithFind):
|
||||
url = "/os-quota-sets/%s" % tenant_id
|
||||
return self._get(url, "quota_set")
|
||||
|
||||
def update(self, tenant_id, shares=None, snapshots=None, gigabytes=None,
|
||||
def update(self, tenant_id, shares=None, snapshots=None,
|
||||
gigabytes=None, snapshot_gigabytes=None,
|
||||
share_networks=None, force=None, user_id=None):
|
||||
|
||||
body = {
|
||||
@ -49,6 +50,7 @@ class QuotaSetManager(base.ManagerWithFind):
|
||||
'shares': shares,
|
||||
'snapshots': snapshots,
|
||||
'gigabytes': gigabytes,
|
||||
'snapshot_gigabytes': snapshot_gigabytes,
|
||||
'share_networks': share_networks,
|
||||
'force': force,
|
||||
},
|
||||
|
@ -143,7 +143,13 @@ def do_credentials(cs, args):
|
||||
cliutils.print_dict(catalog['user'], "User Credentials")
|
||||
cliutils.print_dict(catalog['token'], "Token")
|
||||
|
||||
_quota_resources = ['shares', 'snapshots', 'gigabytes', 'share_networks']
|
||||
_quota_resources = [
|
||||
'shares',
|
||||
'snapshots',
|
||||
'gigabytes',
|
||||
'snapshot_gigabytes',
|
||||
'share_networks',
|
||||
]
|
||||
|
||||
|
||||
def _quota_show(quotas):
|
||||
@ -232,6 +238,14 @@ def do_quota_defaults(cs, args):
|
||||
type=int,
|
||||
default=None,
|
||||
help='New value for the "gigabytes" quota.')
|
||||
@cliutils.arg(
|
||||
'--snapshot-gigabytes',
|
||||
'--snapshot_gigabytes', # alias
|
||||
metavar='<snapshot_gigabytes>',
|
||||
type=int,
|
||||
default=None,
|
||||
action='single_alias',
|
||||
help='New value for the "snapshot_gigabytes" quota.')
|
||||
@cliutils.arg(
|
||||
'--share-networks',
|
||||
metavar='<share-networks>',
|
||||
@ -305,6 +319,14 @@ def do_quota_class_show(cs, args):
|
||||
type=int,
|
||||
default=None,
|
||||
help='New value for the "gigabytes" quota.')
|
||||
@cliutils.arg(
|
||||
'--snapshot-gigabytes',
|
||||
'--snapshot_gigabytes', # alias
|
||||
metavar='<snapshot_gigabytes>',
|
||||
type=int,
|
||||
default=None,
|
||||
action='single_alias',
|
||||
help='New value for the "snapshot_gigabytes" quota.')
|
||||
@cliutils.arg(
|
||||
'--share-networks',
|
||||
metavar='<share-networks>',
|
||||
|
Loading…
Reference in New Issue
Block a user