diff options
| author | Soren Hansen <soren.hansen@rackspace.com> | 2010-09-14 13:01:57 +0200 |
|---|---|---|
| committer | Soren Hansen <soren.hansen@rackspace.com> | 2010-09-14 13:01:57 +0200 |
| commit | 3fbbc09cbe2594e816803796e22ef39bcf02b029 (patch) | |
| tree | 9fe4ab0bdfb43a845b96d8a2c5ebe66d48355772 | |
| parent | 9c4b6612e65d548542b1bf37373200e4e6abc98d (diff) | |
| download | nova-3fbbc09cbe2594e816803796e22ef39bcf02b029.tar.gz nova-3fbbc09cbe2594e816803796e22ef39bcf02b029.tar.xz nova-3fbbc09cbe2594e816803796e22ef39bcf02b029.zip | |
Multiple security group support.
| -rw-r--r-- | nova/endpoint/cloud.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 1403a62f6..715470f30 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -279,7 +279,7 @@ class CloudController(object): source_project_id, source_security_group_name) - criteria['group_id'] = source_security_group.id + criteria['group_id'] = source_security_group elif cidr_ip: criteria['cidr'] = cidr_ip else: @@ -682,8 +682,16 @@ class CloudController(object): kwargs['key_name']) key_data = key_pair.public_key - # TODO: Get the real security group of launch in here - security_group = "default" + security_group_arg = kwargs.get('security_group', ["default"]) + if not type(security_group_arg) is list: + security_group_arg = [security_group_arg] + + security_groups = [] + for security_group_name in security_group_arg: + group = db.security_group_get_by_project(context, + context.project.id, + security_group_name) + security_groups.append(group) reservation_id = utils.generate_uid('r') base_options = {} @@ -697,7 +705,7 @@ class CloudController(object): base_options['project_id'] = context.project.id base_options['user_data'] = kwargs.get('user_data', '') base_options['instance_type'] = kwargs.get('instance_type', 'm1.small') - base_options['security_group'] = security_group + base_options['security_groups'] = security_groups for num in range(int(kwargs['max_count'])): inst_id = db.instance_create(context, base_options) |
