diff options
| author | Todd Willey <todd@ansolabs.com> | 2011-06-11 18:03:45 -0400 |
|---|---|---|
| committer | Todd Willey <todd@ansolabs.com> | 2011-06-11 18:03:45 -0400 |
| commit | ed3914eafa7d076fdcc03ee958f77528bcf20603 (patch) | |
| tree | b123e5578df1c3c28d6f5e0788dd7572ec890f13 /nova/api | |
| parent | d1b6ebb4009e13ac2cf2309275a66a634e4f9171 (diff) | |
Add a method to delete provider firewall rules.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/admin.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/nova/api/ec2/admin.py b/nova/api/ec2/admin.py index 37ae2e648..da982d8dc 100644 --- a/nova/api/ec2/admin.py +++ b/nova/api/ec2/admin.py @@ -377,3 +377,15 @@ class AdminController(object): blocks = [{'cidr': b} for b in blocks] return {'externalIpBlockInfo': list(sorted(blocks, key=lambda k: k['cidr']))} + + def remove_external_address_block(self, context, cidr): + LOG.audit(_('Removing ip block from %s'), cidr, context=context) + cidr = urllib.unquote(cidr).decode() + # raise if invalid + IPy.IP(cidr) + rules = db.provider_fw_rule_get_all_by_cidr(context, cidr) + for rule in rules: + db.provider_fw_rule_destroy(context, rule['id']) + if rules: + self.compute_api.trigger_provider_fw_rules_refresh(context) + return {'status': 'OK', 'message': 'Deleted %s rules' % len(rules)} |
