diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-03-16 03:06:10 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-03-16 03:06:10 +0000 |
| commit | ddf1d6ae7e4445cc57f97f52f13c38ca0cc2cd74 (patch) | |
| tree | 36e8a6054e3da774d891fabbb40fd671c733c9a5 | |
| parent | 026943be287edaae4a34e430606d4923eb9c9824 (diff) | |
| parent | dd6c1907c6634ccb41c3d94ed3296498e32333b0 (diff) | |
| download | nova-ddf1d6ae7e4445cc57f97f52f13c38ca0cc2cd74.tar.gz nova-ddf1d6ae7e4445cc57f97f52f13c38ca0cc2cd74.tar.xz nova-ddf1d6ae7e4445cc57f97f52f13c38ca0cc2cd74.zip | |
Merge "db api: Remove check for security groups reference"
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 14 | ||||
| -rw-r--r-- | nova/tests/api/ec2/test_cloud.py | 17 | ||||
| -rw-r--r-- | nova/tests/test_api.py | 9 |
3 files changed, 0 insertions, 40 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index bf5847dc3..71a17584e 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -2735,20 +2735,6 @@ def security_group_exists(context, project_id, group_name): def security_group_in_use(context, group_id): session = get_session() with session.begin(): - # Are there any other groups that haven't been deleted - # that include this group in their rules? - rules = session.query(models.SecurityGroupIngressRule).\ - filter_by(group_id=group_id).\ - filter_by(deleted=False).\ - all() - for r in rules: - num_groups = session.query(models.SecurityGroup).\ - filter_by(deleted=False).\ - filter_by(id=r.parent_group_id).\ - count() - if num_groups: - return True - # Are there any instances that haven't been deleted # that include this group? inst_assoc = session.query(models.SecurityGroupInstanceAssociation).\ diff --git a/nova/tests/api/ec2/test_cloud.py b/nova/tests/api/ec2/test_cloud.py index 7f56aa479..fc6c656fe 100644 --- a/nova/tests/api/ec2/test_cloud.py +++ b/nova/tests/api/ec2/test_cloud.py @@ -496,23 +496,6 @@ class CloudTestCase(test.TestCase): self.assertRaises(exception.EC2APIError, revoke, self.context, **kwargs) - def test_delete_security_group_in_use_by_group(self): - group1 = self.cloud.create_security_group(self.context, 'testgrp1', - "test group 1") - group2 = self.cloud.create_security_group(self.context, 'testgrp2', - "test group 2") - kwargs = {'groups': {'1': {'user_id': u'%s' % self.context.user_id, - 'group_name': u'testgrp2'}}, - } - self.cloud.authorize_security_group_ingress(self.context, - group_name='testgrp1', **kwargs) - - self.assertRaises(exception.InvalidGroup, - self.cloud.delete_security_group, - self.context, 'testgrp2') - self.cloud.delete_security_group(self.context, 'testgrp1') - self.cloud.delete_security_group(self.context, 'testgrp2') - def test_delete_security_group_in_use_by_instance(self): """Ensure that a group can not be deleted if in use by an instance.""" image_uuid = 'cedef40a-ed67-4d10-800e-17455edce175' diff --git a/nova/tests/test_api.py b/nova/tests/test_api.py index 473e1d5f9..5735a7dc2 100644 --- a/nova/tests/test_api.py +++ b/nova/tests/test_api.py @@ -572,15 +572,6 @@ class ApiEc2TestCase(test.TestCase): self.expect_http() self.mox.ReplayAll() - # Can not delete the group while it is still used by - # another group. - self.assertRaises(boto_exc.EC2ResponseError, - self.ec2.delete_security_group, - other_security_group_name) - - self.expect_http() - self.mox.ReplayAll() - rv = self.ec2.get_all_security_groups() for group in rv: |
