diff options
| author | Todd Willey <todd@ansolabs.com> | 2011-01-31 15:29:24 -0500 |
|---|---|---|
| committer | Todd Willey <todd@ansolabs.com> | 2011-01-31 15:29:24 -0500 |
| commit | 7ee26753b06dcf49867796fcadfa6f430bc46578 (patch) | |
| tree | ae0aba87f7032e7fec100e6c8b860f47891a75f2 /nova/compute | |
| parent | ece7d2fa493e901c2a826e42a86ca93bb0afaed4 (diff) | |
| parent | 1cd4dfe34acaec06c96925c7903a9d8dc25fe34f (diff) | |
Merge trunk and make work with provider fw rules (setup alongside basic_rules).
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 4 | ||||
| -rw-r--r-- | nova/compute/manager.py | 22 |
2 files changed, 14 insertions, 12 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index a8eed7aa5..486542eb7 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -277,7 +277,7 @@ class API(base.Base): def trigger_provider_fw_rules_refresh(self, context): """Called when a rule is added to or removed from a security_group""" - hosts = [x['host'] for (x,idx) + hosts = [x['host'] for (x, idx) in db.service_get_all_compute_sorted(context)] for host in hosts: rpc.cast(context, @@ -328,7 +328,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/manager.py b/nova/compute/manager.py index 90ba560d1..63fecb611 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 @@ -236,22 +235,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) @@ -261,7 +263,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: |
