diff options
| author | Akihiro MOTOKI <motoki@da.jp.nec.com> | 2012-09-13 21:22:33 +0900 |
|---|---|---|
| committer | Akihiro MOTOKI <motoki@da.jp.nec.com> | 2012-10-09 15:28:26 +0900 |
| commit | 7948b7a572e33e3fd541e27f2617d832eb43b504 (patch) | |
| tree | dca8b796c48f6518a525a53082fe2997620c2d75 /nova/api | |
| parent | fb101685cc14ed9b0396ce966e571d3fb457c32f (diff) | |
Proxy floating IP calls to quantum
Fixes bug 1023169. Also fixes bug 1031119.
In Folsom, floating IP support is moved to Quantum. By this commit floating IP
calls to nova are proxied to Quantum and nova command can be used to manage
floating IPs.
pip-requires is also updated and now requires python-quantumclient >=2.1 which
supports floating IP feature in Quantum.
Change-Id: I2c32948a8fe291601216dc62d546da64a8fb8428
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/floating_ips.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/nova/api/openstack/compute/contrib/floating_ips.py b/nova/api/openstack/compute/contrib/floating_ips.py index 1c17591a4..b835ca61d 100644 --- a/nova/api/openstack/compute/contrib/floating_ips.py +++ b/nova/api/openstack/compute/contrib/floating_ips.py @@ -118,18 +118,23 @@ class FloatingIPController(object): return self.compute_api.get(context, instance_id) def _set_metadata(self, context, floating_ip): - fixed_ip_id = floating_ip['fixed_ip_id'] - floating_ip['fixed_ip'] = self._get_fixed_ip(context, - fixed_ip_id) - instance_uuid = None - if floating_ip['fixed_ip']: - instance_uuid = floating_ip['fixed_ip']['instance_uuid'] - - if instance_uuid: - floating_ip['instance'] = self._get_instance(context, - instance_uuid) - else: - floating_ip['instance'] = None + # When Quantum v2 API is used, 'fixed_ip' and 'instance' are + # already set. In this case we don't need to update the fields. + + if 'fixed_ip' not in floating_ip: + fixed_ip_id = floating_ip['fixed_ip_id'] + floating_ip['fixed_ip'] = self._get_fixed_ip(context, + fixed_ip_id) + if 'instance' not in floating_ip: + instance_uuid = None + if floating_ip['fixed_ip']: + instance_uuid = floating_ip['fixed_ip']['instance_uuid'] + + if instance_uuid: + floating_ip['instance'] = self._get_instance(context, + instance_uuid) + else: + floating_ip['instance'] = None @wsgi.serializers(xml=FloatingIPTemplate) def show(self, req, id): |
