summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-02-23 16:00:40 +0000
committerGerrit Code Review <review@openstack.org>2013-02-23 16:00:40 +0000
commitfaa7a8fd83a273c88b5e5f2a077e0806dd94f6b7 (patch)
tree9d7f9960f221a921deac3e3d4a255ba7c603a29a
parent4a88dee0f64d5bee3970511c6937011151051531 (diff)
parentb01923cb8d117476dc643e6c93e3ab1805b06f2d (diff)
downloadnova-faa7a8fd83a273c88b5e5f2a077e0806dd94f6b7.tar.gz
nova-faa7a8fd83a273c88b5e5f2a077e0806dd94f6b7.tar.xz
nova-faa7a8fd83a273c88b5e5f2a077e0806dd94f6b7.zip
Merge "Prevent default security group deletion."
-rw-r--r--nova/compute/api.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 62bcc482a..bba6ee1eb 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -100,6 +100,7 @@ CONF.import_opt('enable', 'nova.cells.opts', group='cells')
MAX_USERDATA_SIZE = 65535
QUOTAS = quota.QUOTAS
+RO_SECURITY_GROUPS = ['default']
def check_instance_state(vm_state=None, task_state=(None,)):
@@ -2880,6 +2881,11 @@ class SecurityGroupAPI(base.Base, security_group_base.SecurityGroupBase):
return groups
def destroy(self, context, security_group):
+ if security_group['name'] in RO_SECURITY_GROUPS:
+ msg = _("Unable to delete system group '%s'") % \
+ security_group['name']
+ self.raise_invalid_group(msg)
+
if self.db.security_group_in_use(context, security_group['id']):
msg = _("Security group is still in use")
self.raise_invalid_group(msg)