summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuston McReynolds <amcreynolds@ebaysf.com>2013-08-29 12:58:45 -0700
committerAuston McReynolds <amcreynolds@ebaysf.com>2013-09-03 10:56:11 -0700
commit157e1807b42f6ccd5e282bc938638ffbc0da6611 (patch)
tree9c846b1bbb8dc5f2f6e4e2d57c1b4ca5408d5557
parent797fe9c2d3909a248b342d24f1c1a2dbfab3620a (diff)
downloadtrove-157e1807b42f6ccd5e282bc938638ffbc0da6611.tar.gz
Support Security Group Name Prefix Customization
As of now, if CONF.trove_security_groups_support == True, then a Security Group is created for every new Instance, following the naming scheme of: "SecGroup_<Instance's UUID>". Nicira NVP for Quantum enforces a Security Group naming limitation of 40 chars maximum. Given the UUID's length, this only leaves 2 characters for the prefix, e.g. 'SG' vs. 'SecGroup'. Even in lieu of restrictions, it's not inconceivable that a vendor/user might want to customize the naming scheme of their Security Groups to align with other cloud providers, etc. Change-Id: I1043e15c71607cabe2fd6f72f64705e80cd2cde1 Closes-Bug: #1218589
-rw-r--r--trove/common/cfg.py1
-rw-r--r--trove/extensions/security_group/models.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/trove/common/cfg.py b/trove/common/cfg.py
index 4ca0acac..58992135 100644
--- a/trove/common/cfg.py
+++ b/trove/common/cfg.py
@@ -122,6 +122,7 @@ common_opts = [
help="Require user hostnames to be IPv4 addresses."),
cfg.BoolOpt('trove_security_groups_support', default=True),
cfg.BoolOpt('trove_security_groups_rules_support', default=True),
+ cfg.StrOpt('trove_security_group_name_prefix', default='SecGroup'),
cfg.StrOpt('trove_security_group_rule_protocol', default='tcp'),
cfg.IntOpt('trove_security_group_rule_port', default=3306),
cfg.StrOpt('trove_security_group_rule_cidr', default='0.0.0.0/0'),
diff --git a/trove/extensions/security_group/models.py b/trove/extensions/security_group/models.py
index 3f950ae6..9969b881 100644
--- a/trove/extensions/security_group/models.py
+++ b/trove/extensions/security_group/models.py
@@ -76,7 +76,8 @@ class SecurityGroup(DatabaseModelBase):
@classmethod
def create_for_instance(cls, instance_id, context):
# Create a new security group
- name = _("SecGroup_%s") % instance_id
+ name = _("%s_%s") %\
+ (CONF.trove_security_group_name_prefix, instance_id)
description = _("Security Group for %s") % instance_id
sec_group = cls.create_sec_group(name, description, context)