diff options
| author | Todd Willey <todd@ansolabs.com> | 2011-01-25 12:52:00 -0800 |
|---|---|---|
| committer | Todd Willey <todd@ansolabs.com> | 2011-01-25 12:52:00 -0800 |
| commit | 4e3524c57f6fa0f917bdb30ec15c8d4633a307e5 (patch) | |
| tree | 749656d687c9c9c5c11646e1971887aeecdf1507 | |
| parent | a964fc3a8efad33b0dbb94e8a128c512a248f7f1 (diff) | |
Updates for provider_fw_rules in admin api.
| -rw-r--r-- | nova/api/ec2/admin.py | 7 | ||||
| -rw-r--r-- | nova/compute/api.py | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/nova/api/ec2/admin.py b/nova/api/ec2/admin.py index 4a34476d3..0dabf2092 100644 --- a/nova/api/ec2/admin.py +++ b/nova/api/ec2/admin.py @@ -223,7 +223,7 @@ class AdminController(object): """Returns status info for single node.""" return host_dict(db.host_get(name)) - def _provider_fw_rule_exists(context, rule): + def _provider_fw_rule_exists(self, context, rule): for old_rule in db.provider_fw_rule_get_all(context): for key in ('cidr', 'from_port', 'to_port', 'protocol'): dupe = True @@ -237,7 +237,10 @@ class AdminController(object): """Add provider-level firewall rules to block incoming traffic.""" LOG.audit(_("Blocking traffic to all projects incoming from %s"), cidr, context=context) - rule = {'cidr': IPy.IP(urllib.unquote(cidr).decode())} + cidr = urllib.unquote(cidr).decode() + # raise if invalid + IPy.IP(cidr) + rule = {'cidr': cidr} tcp_rule = rule.copy() tcp_rule.update({"protocol": "TCP", "from_port": 1, "to_port": 65535}) udp_rule = rule.copy() diff --git a/nova/compute/api.py b/nova/compute/api.py index cb1a57a44..a8eed7aa5 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -277,7 +277,8 @@ class API(base.Base): def trigger_provider_fw_rules_refresh(self, context): """Called when a rule is added to or removed from a security_group""" - hosts = [x['host'] for x in db.service_get_all_compute_sorted(context)] + hosts = [x['host'] for (x,idx) + in db.service_get_all_compute_sorted(context)] for host in hosts: rpc.cast(context, self.db.queue_get_for(context, FLAGS.compute_topic, host), |
