summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorMichael Still <mikal@stillhq.com>2013-03-05 05:53:43 +1100
committerMichael Still <mikal@stillhq.com>2013-03-15 03:42:48 +1100
commit99429214d4ddb5bdc7de185693b8a53ad50df3c6 (patch)
treef56596c39ac3353d4c41bd8838a38658de82a6b1 /nova/tests
parent9df61c0b06dd81f34d97fbc02030f92928e21a78 (diff)
Add quotas for fixed ips.
DocImpact: there is now a default quota of 10 fixed ips per tenant. This will need to be adjusted by deployers if that number does not meet their needs. Resolves bug 1125468. Change-Id: Iffa19583340f80cb2a13ba5fce31f7ff724a52d6
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_quota_classes.py23
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_quotas.py27
-rw-r--r--nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl1
-rw-r--r--nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl1
-rw-r--r--nova/tests/network/test_manager.py17
-rw-r--r--nova/tests/test_quota.py24
16 files changed, 88 insertions, 15 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_quota_classes.py b/nova/tests/api/openstack/compute/contrib/test_quota_classes.py
index 7b0b62180..8286661a0 100644
--- a/nova/tests/api/openstack/compute/contrib/test_quota_classes.py
+++ b/nova/tests/api/openstack/compute/contrib/test_quota_classes.py
@@ -24,11 +24,13 @@ from nova.tests.api.openstack import fakes
def quota_set(class_name):
return {'quota_class_set': {'id': class_name, 'metadata_items': 128,
- 'ram': 51200, 'floating_ips': 10, 'instances': 10,
- 'injected_files': 5, 'cores': 20,
- 'injected_file_content_bytes': 10240, 'security_groups': 10,
- 'security_group_rules': 20, 'key_pairs': 100,
- 'injected_file_path_bytes': 255}}
+ 'ram': 51200, 'floating_ips': 10,
+ 'fixed_ips': 10, 'instances': 10,
+ 'injected_files': 5, 'cores': 20,
+ 'injected_file_content_bytes': 10240,
+ 'security_groups': 10,
+ 'security_group_rules': 20, 'key_pairs': 100,
+ 'injected_file_path_bytes': 255}}
class QuotaClassSetsTest(test.TestCase):
@@ -43,6 +45,7 @@ class QuotaClassSetsTest(test.TestCase):
'cores': 20,
'ram': 51200,
'floating_ips': 10,
+ 'fixed_ips': 10,
'metadata_items': 128,
'injected_files': 5,
'injected_file_path_bytes': 255,
@@ -61,6 +64,7 @@ class QuotaClassSetsTest(test.TestCase):
self.assertEqual(qs['cores'], 20)
self.assertEqual(qs['ram'], 51200)
self.assertEqual(qs['floating_ips'], 10)
+ self.assertEqual(qs['fixed_ips'], 10)
self.assertEqual(qs['metadata_items'], 128)
self.assertEqual(qs['injected_files'], 5)
self.assertEqual(qs['injected_file_path_bytes'], 255)
@@ -86,7 +90,8 @@ class QuotaClassSetsTest(test.TestCase):
def test_quotas_update_as_admin(self):
body = {'quota_class_set': {'instances': 50, 'cores': 50,
'ram': 51200, 'floating_ips': 10,
- 'metadata_items': 128, 'injected_files': 5,
+ 'fixed_ips': 10, 'metadata_items': 128,
+ 'injected_files': 5,
'injected_file_content_bytes': 10240,
'injected_file_path_bytes': 255,
'security_groups': 10,
@@ -103,7 +108,8 @@ class QuotaClassSetsTest(test.TestCase):
def test_quotas_update_as_user(self):
body = {'quota_class_set': {'instances': 50, 'cores': 50,
'ram': 51200, 'floating_ips': 10,
- 'metadata_items': 128, 'injected_files': 5,
+ 'fixed_ips': 10, 'metadata_items': 128,
+ 'injected_files': 5,
'injected_file_content_bytes': 10240,
'security_groups': 10,
'security_group_rules': 20,
@@ -130,6 +136,7 @@ class QuotaTemplateXMLSerializerTest(test.TestCase):
injected_file_content_bytes=20,
ram=50,
floating_ips=60,
+ fixed_ips=10,
instances=70,
injected_files=80,
security_groups=10,
@@ -154,6 +161,7 @@ class QuotaTemplateXMLSerializerTest(test.TestCase):
injected_file_content_bytes='20',
ram='50',
floating_ips='60',
+ fixed_ips='10',
instances='70',
injected_files='80',
security_groups='10',
@@ -167,6 +175,7 @@ class QuotaTemplateXMLSerializerTest(test.TestCase):
'</injected_file_content_bytes>'
'<ram>50</ram>'
'<floating_ips>60</floating_ips>'
+ '<fixed_ips>10</fixed_ips>'
'<instances>70</instances>'
'<injected_files>80</injected_files>'
'<cores>90</cores>'
diff --git a/nova/tests/api/openstack/compute/contrib/test_quotas.py b/nova/tests/api/openstack/compute/contrib/test_quotas.py
index 0616c4628..d66584f57 100644
--- a/nova/tests/api/openstack/compute/contrib/test_quotas.py
+++ b/nova/tests/api/openstack/compute/contrib/test_quotas.py
@@ -26,7 +26,7 @@ from nova.tests.api.openstack import fakes
def quota_set(id):
return {'quota_set': {'id': id, 'metadata_items': 128,
- 'ram': 51200, 'floating_ips': 10,
+ 'ram': 51200, 'floating_ips': 10, 'fixed_ips': 10,
'instances': 10, 'injected_files': 5, 'cores': 20,
'injected_file_content_bytes': 10240,
'security_groups': 10, 'security_group_rules': 20,
@@ -45,6 +45,7 @@ class QuotaSetsTest(test.TestCase):
'cores': 20,
'ram': 51200,
'floating_ips': 10,
+ 'fixed_ips': 10,
'metadata_items': 128,
'injected_files': 5,
'injected_file_path_bytes': 255,
@@ -61,6 +62,7 @@ class QuotaSetsTest(test.TestCase):
self.assertEqual(qs['cores'], 20)
self.assertEqual(qs['ram'], 51200)
self.assertEqual(qs['floating_ips'], 10)
+ self.assertEqual(qs['fixed_ips'], 10)
self.assertEqual(qs['metadata_items'], 128)
self.assertEqual(qs['injected_files'], 5)
self.assertEqual(qs['injected_file_path_bytes'], 255)
@@ -81,6 +83,7 @@ class QuotaSetsTest(test.TestCase):
'cores': 20,
'ram': 51200,
'floating_ips': 10,
+ 'fixed_ips': 10,
'metadata_items': 128,
'injected_files': 5,
'injected_file_path_bytes': 255,
@@ -106,12 +109,13 @@ class QuotaSetsTest(test.TestCase):
def test_quotas_update_as_admin(self):
body = {'quota_set': {'instances': 50, 'cores': 50,
'ram': 51200, 'floating_ips': 10,
- 'metadata_items': 128, 'injected_files': 5,
+ 'fixed_ips': 10, 'metadata_items': 128,
+ 'injected_files': 5,
'injected_file_content_bytes': 10240,
'injected_file_path_bytes': 255,
'security_groups': 10,
'security_group_rules': 20,
- 'key_pairs': 100}}
+ 'key_pairs': 100, 'fixed_ips': 10}}
req = fakes.HTTPRequest.blank('/v2/fake4/os-quota-sets/update_me',
use_admin_context=True)
@@ -122,7 +126,8 @@ class QuotaSetsTest(test.TestCase):
def test_quotas_update_as_user(self):
body = {'quota_set': {'instances': 50, 'cores': 50,
'ram': 51200, 'floating_ips': 10,
- 'metadata_items': 128, 'injected_files': 5,
+ 'fixed_ips': 10, 'metadata_items': 128,
+ 'injected_files': 5,
'injected_file_content_bytes': 10240,
'security_groups': 10,
'security_group_rules': 20,
@@ -134,7 +139,7 @@ class QuotaSetsTest(test.TestCase):
def test_quotas_update_invalid_limit(self):
body = {'quota_set': {'instances': -2, 'cores': -2,
- 'ram': -2, 'floating_ips': -2,
+ 'ram': -2, 'floating_ips': -2, 'fixed_ips': -2,
'metadata_items': -2, 'injected_files': -2,
'injected_file_content_bytes': -2}}
@@ -147,7 +152,8 @@ class QuotaSetsTest(test.TestCase):
expected_resp = {'quota_set': {
'instances': 50, 'cores': 50,
'ram': 51200, 'floating_ips': 10,
- 'metadata_items': 128, 'injected_files': 5,
+ 'fixed_ips': 10, 'metadata_items': 128,
+ 'injected_files': 5,
'injected_file_content_bytes': 10240,
'injected_file_path_bytes': 255,
'security_groups': 10,
@@ -157,7 +163,8 @@ class QuotaSetsTest(test.TestCase):
# when PUT JSON format with empty string for quota
body = {'quota_set': {'instances': 50, 'cores': 50,
'ram': '', 'floating_ips': 10,
- 'metadata_items': 128, 'injected_files': 5,
+ 'fixed_ips': 10, 'metadata_items': 128,
+ 'injected_files': 5,
'injected_file_content_bytes': 10240,
'injected_file_path_bytes': 255,
'security_groups': 10,
@@ -171,7 +178,8 @@ class QuotaSetsTest(test.TestCase):
# when PUT XML format with empty string for quota
body = {'quota_set': {'instances': 50, 'cores': 50,
'ram': {}, 'floating_ips': 10,
- 'metadata_items': 128, 'injected_files': 5,
+ 'fixed_ips': 10, 'metadata_items': 128,
+ 'injected_files': 5,
'injected_file_content_bytes': 10240,
'injected_file_path_bytes': 255,
'security_groups': 10,
@@ -197,6 +205,7 @@ class QuotaXMLSerializerTest(test.TestCase):
injected_file_content_bytes=20,
ram=50,
floating_ips=60,
+ fixed_ips=10,
instances=70,
injected_files=80,
security_groups=10,
@@ -220,6 +229,7 @@ class QuotaXMLSerializerTest(test.TestCase):
injected_file_content_bytes='20',
ram='50',
floating_ips='60',
+ fixed_ips='10',
instances='70',
injected_files='80',
security_groups='10',
@@ -233,6 +243,7 @@ class QuotaXMLSerializerTest(test.TestCase):
'</injected_file_content_bytes>'
'<ram>50</ram>'
'<floating_ips>60</floating_ips>'
+ '<fixed_ips>10</fixed_ips>'
'<instances>70</instances>'
'<injected_files>80</injected_files>'
'<security_groups>10</security_groups>'
diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl
index 4b430ad7c..c393ab0c7 100644
--- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl
@@ -2,6 +2,7 @@
"quota_class_set": {
"cores": 20,
"floating_ips": 10,
+ "fixed_ips": 10,
"id": "%(set_id)s",
"injected_file_content_bytes": 10240,
"injected_file_path_bytes": 255,
diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl
index 3dffd47f0..8ab8436d7 100644
--- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl
@@ -2,6 +2,7 @@
<quota_class_set id="%(set_id)s">
<cores>20</cores>
<floating_ips>10</floating_ips>
+ <fixed_ips>10</fixed_ips>
<injected_file_content_bytes>10240</injected_file_content_bytes>
<injected_file_path_bytes>255</injected_file_path_bytes>
<injected_files>5</injected_files>
diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl
index f074c829f..3974f65db 100644
--- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl
@@ -4,6 +4,7 @@
"cores": 50,
"ram": 51200,
"floating_ips": 10,
+ "fixed_ips": 10,
"metadata_items": 128,
"injected_files": 5,
"injected_file_content_bytes": 10240,
diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl
index d14785482..f27082ab3 100644
--- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl
@@ -2,6 +2,7 @@
<quota_class_set>
<cores>50</cores>
<floating_ips>10</floating_ips>
+ <fixed_ips>10</fixed_ips>
<injected_file_content_bytes>10240</injected_file_content_bytes>
<injected_file_path_bytes>255</injected_file_path_bytes>
<injected_files>5</injected_files>
diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl
index 99a11f4ff..8d195b924 100644
--- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl
@@ -2,6 +2,7 @@
"quota_class_set": {
"cores": 50,
"floating_ips": 10,
+ "fixed_ips": 10,
"injected_file_content_bytes": 10240,
"injected_file_path_bytes": 255,
"injected_files": 5,
diff --git a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl
index 44c658a41..5c12a81e7 100644
--- a/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl
@@ -2,6 +2,7 @@
<quota_class_set>
<cores>50</cores>
<floating_ips>10</floating_ips>
+ <fixed_ips>10</fixed_ips>
<injected_file_content_bytes>10240</injected_file_content_bytes>
<injected_file_path_bytes>255</injected_file_path_bytes>
<injected_files>5</injected_files>
diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl
index ee1f6a397..364a59f7a 100644
--- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl
@@ -2,6 +2,7 @@
"quota_set": {
"cores": 20,
"floating_ips": 10,
+ "fixed_ips": 10,
"id": "fake_tenant",
"injected_file_content_bytes": 10240,
"injected_file_path_bytes": 255,
diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl
index 6a39c8506..36e6da544 100644
--- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl
@@ -2,6 +2,7 @@
<quota_set id="fake_tenant">
<cores>20</cores>
<floating_ips>10</floating_ips>
+ <fixed_ips>10</fixed_ips>
<injected_file_content_bytes>10240</injected_file_content_bytes>
<injected_file_path_bytes>255</injected_file_path_bytes>
<injected_files>5</injected_files>
diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl
index ee1f6a397..364a59f7a 100644
--- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl
@@ -2,6 +2,7 @@
"quota_set": {
"cores": 20,
"floating_ips": 10,
+ "fixed_ips": 10,
"id": "fake_tenant",
"injected_file_content_bytes": 10240,
"injected_file_path_bytes": 255,
diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl
index 6a39c8506..36e6da544 100644
--- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl
@@ -2,6 +2,7 @@
<quota_set id="fake_tenant">
<cores>20</cores>
<floating_ips>10</floating_ips>
+ <fixed_ips>10</fixed_ips>
<injected_file_content_bytes>10240</injected_file_content_bytes>
<injected_file_path_bytes>255</injected_file_path_bytes>
<injected_files>5</injected_files>
diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl
index c16dc6bb5..43525cfd5 100644
--- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl
@@ -2,6 +2,7 @@
"quota_set": {
"cores": 20,
"floating_ips": 10,
+ "fixed_ips": 10,
"injected_file_content_bytes": 10240,
"injected_file_path_bytes": 255,
"injected_files": 5,
diff --git a/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl b/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl
index 126c3fced..3c411e8e5 100644
--- a/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl
+++ b/nova/tests/integrated/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl
@@ -2,6 +2,7 @@
<quota_set>
<cores>20</cores>
<floating_ips>10</floating_ips>
+ <fixed_ips>10</fixed_ips>
<injected_file_content_bytes>10240</injected_file_content_bytes>
<injected_file_path_bytes>255</injected_file_path_bytes>
<injected_files>5</injected_files>
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py
index 6121ae8ac..2fe53968b 100644
--- a/nova/tests/network/test_manager.py
+++ b/nova/tests/network/test_manager.py
@@ -34,6 +34,7 @@ from nova.openstack.common import importutils
from nova.openstack.common import log as logging
from nova.openstack.common import rpc
from nova.openstack.common.rpc import common as rpc_common
+from nova import quota
from nova import test
from nova.tests import fake_ldap
from nova.tests import fake_network
@@ -286,6 +287,7 @@ class FlatNetworkTestCase(test.TestCase):
self.mox.StubOutWithMock(db,
'virtual_interface_get_by_instance_and_network')
self.mox.StubOutWithMock(db, 'fixed_ip_update')
+ self.mox.StubOutWithMock(quota.QUOTAS, 'reserve')
self.mox.StubOutWithMock(db, 'instance_get_by_uuid')
self.mox.StubOutWithMock(self.network, 'get_instance_nw_info')
@@ -306,6 +308,10 @@ class FlatNetworkTestCase(test.TestCase):
db.fixed_ip_update(mox.IgnoreArg(),
mox.IgnoreArg(),
mox.IgnoreArg())
+
+ quota.QUOTAS.reserve(mox.IgnoreArg(),
+ fixed_ips=mox.IgnoreArg()).AndReturn(None)
+
db.instance_get_by_uuid(self.context,
mox.IgnoreArg()).AndReturn({'display_name': HOST})
@@ -327,6 +333,7 @@ class FlatNetworkTestCase(test.TestCase):
self.mox.StubOutWithMock(db,
'virtual_interface_get_by_instance_and_network')
self.mox.StubOutWithMock(db, 'fixed_ip_update')
+ self.mox.StubOutWithMock(quota.QUOTAS, 'reserve')
self.mox.StubOutWithMock(db, 'instance_get_by_uuid')
self.mox.StubOutWithMock(self.network, 'get_instance_nw_info')
@@ -347,6 +354,10 @@ class FlatNetworkTestCase(test.TestCase):
db.fixed_ip_update(mox.IgnoreArg(),
mox.IgnoreArg(),
mox.IgnoreArg())
+
+ quota.QUOTAS.reserve(mox.IgnoreArg(),
+ fixed_ips=mox.IgnoreArg()).AndReturn(None)
+
db.instance_get_by_uuid(self.context,
mox.IgnoreArg()).AndReturn({'display_name': HOST})
@@ -414,6 +425,7 @@ class FlatNetworkTestCase(test.TestCase):
self.mox.StubOutWithMock(db, 'fixed_ip_update')
self.mox.StubOutWithMock(db, 'instance_get_by_uuid')
self.mox.StubOutWithMock(self.network, 'get_instance_nw_info')
+ self.mox.StubOutWithMock(quota.QUOTAS, 'reserve')
db.fixed_ip_associate_pool(mox.IgnoreArg(),
mox.IgnoreArg(),
@@ -432,6 +444,10 @@ class FlatNetworkTestCase(test.TestCase):
db.fixed_ip_update(mox.IgnoreArg(),
mox.IgnoreArg(),
mox.IgnoreArg())
+
+ quota.QUOTAS.reserve(mox.IgnoreArg(),
+ fixed_ips=mox.IgnoreArg()).AndReturn(None)
+
db.instance_get_by_uuid(self.context,
mox.IgnoreArg()).AndReturn({'display_name': HOST})
@@ -531,6 +547,7 @@ class VlanNetworkTestCase(test.TestCase):
db.instance_get_by_uuid(mox.IgnoreArg(),
mox.IgnoreArg()).AndReturn({'security_groups':
[{'id': 0}]})
+
db.fixed_ip_associate_pool(mox.IgnoreArg(),
mox.IgnoreArg(),
mox.IgnoreArg()).AndReturn('192.168.0.1')
diff --git a/nova/tests/test_quota.py b/nova/tests/test_quota.py
index 1ea4eea21..1f422748b 100644
--- a/nova/tests/test_quota.py
+++ b/nova/tests/test_quota.py
@@ -719,6 +719,7 @@ class DbQuotaDriverTestCase(test.TestCase):
quota_cores=20,
quota_ram=50 * 1024,
quota_floating_ips=10,
+ quota_fixed_ips=10,
quota_metadata_items=128,
quota_injected_files=5,
quota_injected_file_content_bytes=10 * 1024,
@@ -745,6 +746,7 @@ class DbQuotaDriverTestCase(test.TestCase):
cores=20,
ram=50 * 1024,
floating_ips=10,
+ fixed_ips=10,
metadata_items=128,
injected_files=5,
injected_file_content_bytes=10 * 1024,
@@ -778,6 +780,7 @@ class DbQuotaDriverTestCase(test.TestCase):
cores=20,
ram=25 * 1024,
floating_ips=10,
+ fixed_ips=10,
metadata_items=64,
injected_files=5,
injected_file_content_bytes=5 * 1024,
@@ -830,6 +833,7 @@ class DbQuotaDriverTestCase(test.TestCase):
self._stub_quota_class_get_all_by_name()
def test_get_project_quotas(self):
+ self.maxDiff = None
self._stub_get_by_project()
result = self.driver.get_project_quotas(
FakeContext('test_project', 'test_class'),
@@ -861,6 +865,11 @@ class DbQuotaDriverTestCase(test.TestCase):
in_use=2,
reserved=0,
),
+ fixed_ips=dict(
+ limit=10,
+ in_use=0,
+ reserved=0,
+ ),
metadata_items=dict(
limit=64,
in_use=0,
@@ -899,6 +908,7 @@ class DbQuotaDriverTestCase(test.TestCase):
))
def test_get_project_quotas_alt_context_no_class(self):
+ self.maxDiff = None
self._stub_get_by_project()
result = self.driver.get_project_quotas(
FakeContext('other_project', 'other_class'),
@@ -929,6 +939,11 @@ class DbQuotaDriverTestCase(test.TestCase):
in_use=2,
reserved=0,
),
+ fixed_ips=dict(
+ limit=10,
+ in_use=0,
+ reserved=0,
+ ),
metadata_items=dict(
limit=128,
in_use=0,
@@ -967,6 +982,7 @@ class DbQuotaDriverTestCase(test.TestCase):
))
def test_get_project_quotas_alt_context_with_class(self):
+ self.maxDiff = None
self._stub_get_by_project()
result = self.driver.get_project_quotas(
FakeContext('other_project', 'other_class'),
@@ -998,6 +1014,11 @@ class DbQuotaDriverTestCase(test.TestCase):
in_use=2,
reserved=0,
),
+ fixed_ips=dict(
+ limit=10,
+ in_use=0,
+ reserved=0,
+ ),
metadata_items=dict(
limit=64,
in_use=0,
@@ -1087,6 +1108,9 @@ class DbQuotaDriverTestCase(test.TestCase):
floating_ips=dict(
limit=10,
),
+ fixed_ips=dict(
+ limit=10,
+ ),
metadata_items=dict(
limit=64,
),