Merge "Don't allow EC2 removal of security group in use."
This commit is contained in:
@@ -286,6 +286,10 @@ class InvalidAggregateAction(Invalid):
|
|||||||
"%(aggregate_id)s. Reason: %(reason)s.")
|
"%(aggregate_id)s. Reason: %(reason)s.")
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidGroup(Invalid):
|
||||||
|
message = _("Group not valid. Reason: %(reason)s")
|
||||||
|
|
||||||
|
|
||||||
class InstanceInvalidState(Invalid):
|
class InstanceInvalidState(Invalid):
|
||||||
message = _("Instance %(instance_uuid)s in %(attr)s %(state)s. Cannot "
|
message = _("Instance %(instance_uuid)s in %(attr)s %(state)s. Cannot "
|
||||||
"%(method)s while the instance is in this state.")
|
"%(method)s while the instance is in this state.")
|
||||||
|
@@ -570,6 +570,15 @@ class ApiEc2TestCase(test.TestCase):
|
|||||||
self.expect_http()
|
self.expect_http()
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
|
# Can not delete the group while it is still used by
|
||||||
|
# another group.
|
||||||
|
self.assertRaises(EC2ResponseError,
|
||||||
|
self.ec2.delete_security_group,
|
||||||
|
other_security_group_name)
|
||||||
|
|
||||||
|
self.expect_http()
|
||||||
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
rv = self.ec2.get_all_security_groups()
|
rv = self.ec2.get_all_security_groups()
|
||||||
|
|
||||||
for group in rv:
|
for group in rv:
|
||||||
@@ -583,3 +592,4 @@ class ApiEc2TestCase(test.TestCase):
|
|||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
|
|
||||||
self.ec2.delete_security_group(security_group_name)
|
self.ec2.delete_security_group(security_group_name)
|
||||||
|
self.ec2.delete_security_group(other_security_group_name)
|
||||||
|
@@ -1821,6 +1821,8 @@ class NWFilterTestCase(test.TestCase):
|
|||||||
|
|
||||||
self.fw.setup_basic_filtering(instance, network_info)
|
self.fw.setup_basic_filtering(instance, network_info)
|
||||||
_ensure_all_called(mac)
|
_ensure_all_called(mac)
|
||||||
|
db.instance_remove_security_group(self.context, inst_uuid,
|
||||||
|
self.security_group.id)
|
||||||
self.teardown_security_group()
|
self.teardown_security_group()
|
||||||
db.instance_destroy(context.get_admin_context(), instance_ref['id'])
|
db.instance_destroy(context.get_admin_context(), instance_ref['id'])
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user