Merge "Update Quota documentation and properties"

This commit is contained in:
Jenkins
2016-01-12 21:31:22 +00:00
committed by Gerrit Code Review
3 changed files with 21 additions and 15 deletions

View File

@@ -939,7 +939,9 @@ class Proxy(proxy.BaseProxy):
"""Delete a quota (i.e. reset to the default quota)
:param quota: The value can be either the ID of a quota or a
:class:`~openstack.network.v2.quota.Quota` instance.
:class:`~openstack.network.v2.quota.Quota` instance.
The ID of a quota is the same as the project ID
for the quota.
:param bool ignore_missing: When set to ``False``
:class:`~openstack.exceptions.ResourceNotFound` will be
raised when quota does not exist.
@@ -953,8 +955,10 @@ class Proxy(proxy.BaseProxy):
def get_quota(self, quota):
"""Get a quota
:param router: The value can be the ID of a quota or a
:class:`~openstack.network.v2.quota.Quota` instance.
:param quota: The value can be the ID of a quota or a
:class:`~openstack.network.v2.quota.Quota` instance.
The ID of a quota is the same as the project ID
for the quota.
:returns: One :class:`~openstack.network.v2.quota.Quota`
:raises: :class:`~openstack.exceptions.ResourceNotFound`
@@ -976,8 +980,10 @@ class Proxy(proxy.BaseProxy):
def update_quota(self, quota, **attrs):
"""Update a quota
:param router: Either the ID of a quota or a
:class:`~openstack.network.v2.quota.Quota` instance.
:param quota: Either the ID of a quota or a
:class:`~openstack.network.v2.quota.Quota` instance.
The ID of a quota is the same as the project ID
for the quota.
:attrs kwargs: The attributes to update on the quota represented
by ``value``.

View File

@@ -28,17 +28,17 @@ class Quota(resource.Resource):
# Properties
#: The maximum amount of floating IPs you can have. *Type: int*
floating_ip = resource.prop('floatingip', type=int)
floating_ips = resource.prop('floatingip', type=int)
#: The maximum amount of networks you can create. *Type: int*
network = resource.prop('network', type=int)
networks = resource.prop('network', type=int)
#: The maximum amount of ports you can create. *Type: int*
port = resource.prop('port', type=int)
ports = resource.prop('port', type=int)
#: The project these quota values are for.
project_id = resource.prop('tenant_id')
#: The maximum amount of routers you can create. *Type: int*
router = resource.prop('router', type=int)
routers = resource.prop('router', type=int)
#: The maximum amount of subnets you can create. *Type: int*
subnet = resource.prop('subnet', type=int)
subnets = resource.prop('subnet', type=int)
#: The maximum amount of subnet pools you can create. *Type: int*
subnet_pools = resource.prop('subnetpool', type=int)
#: The maximum amount of security group rules you can create. *Type: int*

View File

@@ -45,12 +45,12 @@ class TestQuota(testtools.TestCase):
def test_make_it(self):
sot = quota.Quota(EXAMPLE)
self.assertEqual(EXAMPLE['floatingip'], sot.floating_ip)
self.assertEqual(EXAMPLE['network'], sot.network)
self.assertEqual(EXAMPLE['port'], sot.port)
self.assertEqual(EXAMPLE['floatingip'], sot.floating_ips)
self.assertEqual(EXAMPLE['network'], sot.networks)
self.assertEqual(EXAMPLE['port'], sot.ports)
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
self.assertEqual(EXAMPLE['router'], sot.router)
self.assertEqual(EXAMPLE['subnet'], sot.subnet)
self.assertEqual(EXAMPLE['router'], sot.routers)
self.assertEqual(EXAMPLE['subnet'], sot.subnets)
self.assertEqual(EXAMPLE['subnetpool'], sot.subnet_pools)
self.assertEqual(EXAMPLE['security_group_rule'],
sot.security_group_rules)