~hudson-openstack/nova/trunk

« back to all changes in this revision

Viewing changes to nova/compute/api.py

  • Committer: Tarmac
  • Author(s): Jason Koelker
  • Date: 2011-09-19 20:16:49 UTC
  • mfrom: (1558.1.54 network_refactor)
  • Revision ID: tarmac-20110919201649-9em4fa4tdwe91oic
* Remove the foreign key and backrefs tying vif<->instance
* Update instance filtering to pass ip related filters to the network manager
* move/update tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
905
905
        if 'reservation_id' in filters:
906
906
            recurse_zones = True
907
907
 
908
 
        instances = self.db.instance_get_all_by_filters(context, filters)
 
908
        instances = self._get_instances_by_filters(context, filters)
909
909
 
910
910
        if not recurse_zones:
911
911
            return instances
930
930
 
931
931
        return instances
932
932
 
 
933
    def _get_instances_by_filters(self, context, filters):
 
934
        ids = None
 
935
        if 'ip6' in filters or 'ip' in filters:
 
936
            res = self.network_api.get_instance_uuids_by_ip_filter(context,
 
937
                                                                   filters)
 
938
            # NOTE(jkoelker) It is possible that we will get the same
 
939
            #                instance uuid twice (one for ipv4 and ipv6)
 
940
            ids = set([r['instance_uuid'] for r in res])
 
941
 
 
942
        return self.db.instance_get_all_by_filters(context, filters, ids)
 
943
 
933
944
    def _cast_compute_message(self, method, context, instance_id, host=None,
934
945
                              params=None):
935
946
        """Generic handler for RPC casts to compute.