diff options
| author | Russell Bryant <rbryant@redhat.com> | 2012-02-23 14:00:42 -0500 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2012-02-23 14:00:42 -0500 |
| commit | f006c920e0dc3d3465b0af27b0154aeee3fad373 (patch) | |
| tree | 62438d35e78c79712c3c48f99ae26e686fe98fde /nova/api | |
| parent | dd851ff62b04da2c2d922dea6b9c175dc44ae234 (diff) | |
Don't delete security group in use from OS API.
Fix bug 938853.
This patch adds a check to the OpenStack API so that a security group
still in use can not be deleted. This same check just recently went in
for the EC2 API.
Change-Id: I75dc47c5f5d227b94c45ba8a0f00c37bd63f09fc
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/security_groups.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/contrib/security_groups.py b/nova/api/openstack/compute/contrib/security_groups.py index 30d3bd6b6..89ef7dc78 100644 --- a/nova/api/openstack/compute/contrib/security_groups.py +++ b/nova/api/openstack/compute/contrib/security_groups.py @@ -239,6 +239,9 @@ class SecurityGroupController(SecurityGroupControllerBase): context = req.environ['nova.context'] authorize(context) security_group = self._get_security_group(context, id) + if db.security_group_in_use(context, security_group.id): + msg = _("Security group is still in use") + raise exc.HTTPBadRequest(explanation=msg) LOG.audit(_("Delete security group %s"), id, context=context) db.security_group_destroy(context, security_group.id) self.sgh.trigger_security_group_destroy_refresh( |
