summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-07-08 13:06:37 -0500
committerKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-07-08 13:06:37 -0500
commit921fee22ff42852b1ee0d7f3d051b44d60afd975 (patch)
tree753a5a39b54d34fd298b7bf489b2525a6201012f /nova/api
parente7bc748edef30b106628946eeda36818aac4fe9d (diff)
downloadnova-921fee22ff42852b1ee0d7f3d051b44d60afd975.tar.gz
nova-921fee22ff42852b1ee0d7f3d051b44d60afd975.tar.xz
nova-921fee22ff42852b1ee0d7f3d051b44d60afd975.zip
Add support for remove_fixed_ip()
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/contrib/multinic.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/nova/api/openstack/contrib/multinic.py b/nova/api/openstack/contrib/multinic.py
index 164af79b0..e202bd51c 100644
--- a/nova/api/openstack/contrib/multinic.py
+++ b/nova/api/openstack/contrib/multinic.py
@@ -26,6 +26,8 @@ from nova.api.openstack import faults
LOG = logging.getLogger("nova.api.multinic")
+# Note: The class name is as it has to be for this to be loaded as an
+# extension--only first character capitalized.
class Multinic(extensions.ExtensionDescriptor):
def __init__(self, *args, **kwargs):
super(Multinic, self).__init__(*args, **kwargs)
@@ -79,5 +81,19 @@ class Multinic(extensions.ExtensionDescriptor):
return exc.HTTPAccepted()
def _remove_fixed_ip(self, input_dict, req, id):
- # Not yet implemented
- raise faults.Fault(exc.HTTPNotImplemented())
+ """Removes an IP from an instance."""
+ try:
+ # Validate the input entity
+ if 'address' not in input_dict['removeFixedIp']:
+ LOG.exception(_("Missing 'address' argument for "
+ "removeFixedIp"))
+ return faults.Fault(exc.HTTPUnprocessableEntity())
+
+ # Remove the fixed IP
+ address = input_dict['removeFixedIp']['address']
+ self.compute_api.remove_fixed_ip(req.environ['nova.context'], id,
+ address)
+ except Exception, e:
+ LOG.exception(_("Error in removeFixedIp %s"), e)
+ return faults.Fault(exc.HTTPBadRequest())
+ return exc.HTTPAccepted()