diff options
| author | Josh Kearney <josh.kearney@rackspace.com> | 2011-02-11 15:18:32 -0600 |
|---|---|---|
| committer | Josh Kearney <josh.kearney@rackspace.com> | 2011-02-11 15:18:32 -0600 |
| commit | fa4e3af4c8d4161cdb90f0ac54f357e9724cbc22 (patch) | |
| tree | 867e6040e861462a0324490cbb3bb51cd0052e54 /nova/compute | |
| parent | 4a058908db774bfebce4ece814534225e123345c (diff) | |
| parent | c42ace8e605b987e683372efb4913d85ee472a70 (diff) | |
| download | nova-fa4e3af4c8d4161cdb90f0ac54f357e9724cbc22.tar.gz nova-fa4e3af4c8d4161cdb90f0ac54f357e9724cbc22.tar.xz nova-fa4e3af4c8d4161cdb90f0ac54f357e9724cbc22.zip | |
Merged trunk
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 2 | ||||
| -rw-r--r-- | nova/compute/instance_types.py | 1 | ||||
| -rw-r--r-- | nova/compute/manager.py | 22 |
3 files changed, 14 insertions, 11 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 5d6a42a6b..c7b788225 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -318,7 +318,7 @@ class API(base.Base): def get(self, context, instance_id): """Get a single instance with the given ID.""" - rv = self.db.instance_get_by_id(context, instance_id) + rv = self.db.instance_get(context, instance_id) return dict(rv.iteritems()) def get_all(self, context, project_id=None, reservation_id=None, diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py index 01abee584..93b23a6f4 100644 --- a/nova/compute/instance_types.py +++ b/nova/compute/instance_types.py @@ -95,6 +95,7 @@ def get_by_type(instance_type): """retrieve instance type name""" if instance_type is None: return FLAGS.default_instance_type + try: ctxt = context.get_admin_context() inst_type = db.instance_type_get_by_name(ctxt, instance_type) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 0f9bf301f..f4418af26 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -37,7 +37,6 @@ terminating it. import datetime import random import string -import logging import socket import functools @@ -231,22 +230,25 @@ class ComputeManager(manager.Manager): instance_ref = self.db.instance_get(context, instance_id) LOG.audit(_("Terminating instance %s"), instance_id, context=context) - if not FLAGS.stub_network: - address = self.db.instance_get_floating_address(context, - instance_ref['id']) - if address: - LOG.debug(_("Disassociating address %s"), address, + fixed_ip = instance_ref.get('fixed_ip') + if not FLAGS.stub_network and fixed_ip: + floating_ips = fixed_ip.get('floating_ips') or [] + for floating_ip in floating_ips: + address = floating_ip['address'] + LOG.debug("Disassociating address %s", address, context=context) # NOTE(vish): Right now we don't really care if the ip is # disassociated. We may need to worry about # checking this later. + network_topic = self.db.queue_get_for(context, + FLAGS.network_topic, + floating_ip['host']) rpc.cast(context, - self.get_network_topic(context), + network_topic, {"method": "disassociate_floating_ip", "args": {"floating_address": address}}) - address = self.db.instance_get_fixed_address(context, - instance_ref['id']) + address = fixed_ip['address'] if address: LOG.debug(_("Deallocating address %s"), address, context=context) @@ -256,7 +258,7 @@ class ComputeManager(manager.Manager): self.network_manager.deallocate_fixed_ip(context.elevated(), address) - volumes = instance_ref.get('volumes', []) or [] + volumes = instance_ref.get('volumes') or [] for volume in volumes: self.detach_volume(context, instance_id, volume['id']) if instance_ref['state'] == power_state.SHUTOFF: |
