diff options
| author | Sandy Walsh <sandy.walsh@rackspace.com> | 2011-06-13 09:43:41 -0700 |
|---|---|---|
| committer | Sandy Walsh <sandy.walsh@rackspace.com> | 2011-06-13 09:43:41 -0700 |
| commit | 276ecb29455acbbf82bbf99ce2b522eba44a0acc (patch) | |
| tree | f56721c01ae31fc53ff406da4feefb5be8cac02a /nova/api | |
| parent | db3280e5177df92484bf0a52b5f6ed89dfea63dd (diff) | |
| parent | 91e34d37d2907295e892e96ca2c3039c7fbe14bf (diff) | |
| download | nova-276ecb29455acbbf82bbf99ce2b522eba44a0acc.tar.gz nova-276ecb29455acbbf82bbf99ce2b522eba44a0acc.tar.xz nova-276ecb29455acbbf82bbf99ce2b522eba44a0acc.zip | |
trunk merge
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 11 | ||||
| -rw-r--r-- | nova/api/openstack/wsgi.py | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 316298c39..e1c65ae40 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -39,6 +39,7 @@ from nova import flags from nova import ipv6 from nova import log as logging from nova import network +from nova import rpc from nova import utils from nova import volume from nova.api.ec2 import ec2utils @@ -872,8 +873,14 @@ class CloudController(object): def allocate_address(self, context, **kwargs): LOG.audit(_("Allocate address"), context=context) - public_ip = self.network_api.allocate_floating_ip(context) - return {'publicIp': public_ip} + try: + public_ip = self.network_api.allocate_floating_ip(context) + return {'publicIp': public_ip} + except rpc.RemoteError as ex: + if ex.exc_type == 'NoMoreAddresses': + raise exception.NoMoreFloatingIps() + else: + raise def release_address(self, context, public_ip, **kwargs): LOG.audit(_("Release address %s"), public_ip, context=context) diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index 116a58507..33da915ee 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -225,7 +225,7 @@ class XMLDictSerializer(DictSerializer): if not xmlns and self.xmlns: node.setAttribute('xmlns', self.xmlns) - return node.toprettyxml(indent=' ') + return node.toprettyxml(indent=' ', encoding='utf-8') def _to_xml_node(self, doc, metadata, nodename, data): """Recursive method to convert data members to XML nodes.""" |
