summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorIlya Alekseyev <ialekseev@griddynamics.com>2011-06-16 20:31:09 +0400
committerIlya Alekseyev <ialekseev@griddynamics.com>2011-06-16 20:31:09 +0400
commita1e310aaa9f0ef829e2857c524be140541f3a13d (patch)
tree63b9e51ff23758831a31f0d09b3f34ead9f5ecda /nova
parent513bc408b7328ff37f7374494a695820eaf614fd (diff)
floating_ips extension is loading to api now
Diffstat (limited to 'nova')
-rw-r--r--nova/api/openstack/contrib/floating_ips.py45
-rw-r--r--nova/network/api.py5
2 files changed, 48 insertions, 2 deletions
diff --git a/nova/api/openstack/contrib/floating_ips.py b/nova/api/openstack/contrib/floating_ips.py
index b67b8b4ec..6c08f52e5 100644
--- a/nova/api/openstack/contrib/floating_ips.py
+++ b/nova/api/openstack/contrib/floating_ips.py
@@ -19,11 +19,16 @@ from webob import exc
from nova import exception
from nova import network
from nova.api.openstack import faults
+from nova.api.openstack import extensions
def _translate_floating_ip_detail_view(context, floating_ip):
#TODO(enugaev) implement view
return None
+def _translate_floating_ips_view(context, floating_ips):
+ #TODO(adiantum) implement view
+ return []
+
class FloatingIPController(object):
"""The Volumes API controller for the OpenStack API."""
@@ -50,5 +55,41 @@ class FloatingIPController(object):
except exception.NotFound:
return faults.Fault(exc.HTTPNotFound())
- return {'volume': _translate_floating_ip_detail_view(context,
- floating_ip)} \ No newline at end of file
+ return {'floating_ips': _translate_floating_ip_detail_view(context,
+ floating_ip)}
+
+ def index(self, req):
+ context = req.environ['nova.context']
+
+ floating_ips = self.network_api.list(context)
+
+ return {'floating_ips' : _translate_floating_ips_view(context,
+ floating_ips)}
+
+
+class Floating_ips(extensions.ExtensionDescriptor):
+ def get_name(self):
+ return "Floating_ips"
+
+ def get_alias(self):
+ return "FLOATING_IPS"
+
+ def get_description(self):
+ return "Floating IPs support"
+
+ def get_namespace(self):
+ return "http://docs.openstack.org/ext/floating_ips/api/v1.1"
+
+ def get_updated(self):
+ return "2011-06-16T00:00:00+00:00"
+
+ def get_resources(self):
+ resources = []
+
+ res = extensions.ResourceExtension('floating_ips',
+ FloatingIPController(),
+ collection_actions={})
+ resources.append(res)
+
+ return resources
+
diff --git a/nova/network/api.py b/nova/network/api.py
index e5c4d6718..001c5a6f6 100644
--- a/nova/network/api.py
+++ b/nova/network/api.py
@@ -38,6 +38,11 @@ class API(base.Base):
rv = self.db.floating_ip_get(context)
return dict(rv.iteritems())
+ def list(self, context):
+ ips = self.db.floating_ip_get_all_by_project(context,
+ context.project_id)
+ return ips
+
def allocate_floating_ip(self, context):
if quota.allowed_floating_ips(context, 1) < 1:
LOG.warn(_('Quota exceeeded for %s, tried to allocate '