diff options
| author | Alex Meade <alex.meade@rackspace.com> | 2011-12-06 15:32:33 -0500 |
|---|---|---|
| committer | Alex Meade <alex.meade@rackspace.com> | 2011-12-06 15:33:33 -0500 |
| commit | 3d9f0ed000ebe119cb7e15f957ee85b668086fea (patch) | |
| tree | 23834447c48f777ba0cf384e4fad9892b2ed41fa /nova/compute | |
| parent | 882b1e475de1ef71d7d3f0b50a58f91569905a75 (diff) | |
Update associate_floating_ip to use instance objs
Related to blueprint internal-uuids.
Also cleans up some unused variables
Change-Id: I8adeceac8f4ab2894c48c1e1c7e1c7eab52e42d0
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 787817e31..d3b329685 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -701,7 +701,6 @@ class API(base.Base): context.project_id, security_group_name) - instance_id = instance['id'] instance_uuid = instance['uuid'] #check if the security group is associated with the server @@ -730,7 +729,6 @@ class API(base.Base): context.project_id, security_group_name) - instance_id = instance['id'] instance_uuid = instance['uuid'] #check if the security group is associated with the server @@ -1015,7 +1013,6 @@ class API(base.Base): return instances def _get_instances_by_filters(self, context, filters): - ids = None if 'ip6' in filters or 'ip' in filters: res = self.network_api.get_instance_uuids_by_ip_filter(context, filters) @@ -1332,7 +1329,6 @@ class API(base.Base): @scheduler_api.reroute_compute("pause") def pause(self, context, instance): """Pause the given instance.""" - instance_id = instance["id"] instance_uuid = instance["uuid"] self.update(context, instance, @@ -1343,7 +1339,6 @@ class API(base.Base): @scheduler_api.reroute_compute("unpause") def unpause(self, context, instance): """Unpause the given instance.""" - instance_id = instance["id"] instance_uuid = instance["uuid"] self.update(context, instance, @@ -1381,7 +1376,6 @@ class API(base.Base): @scheduler_api.reroute_compute("suspend") def suspend(self, context, instance): """Suspend the given instance.""" - instance_id = instance["id"] instance_uuid = instance["uuid"] self.update(context, instance, @@ -1392,7 +1386,6 @@ class API(base.Base): @scheduler_api.reroute_compute("resume") def resume(self, context, instance): """Resume the given instance.""" - instance_id = instance["id"] instance_uuid = instance["uuid"] self.update(context, instance, @@ -1536,12 +1529,12 @@ class API(base.Base): "volume_id": volume_id}}) return instance - def associate_floating_ip(self, context, instance_id, address): + def associate_floating_ip(self, context, instance, address): """Makes calls to network_api to associate_floating_ip. :param address: is a string floating ip address """ - instance = self.get(context, instance_id) + instance_uuid = instance['uuid'] # TODO(tr3buchet): currently network_info doesn't contain floating IPs # in its info, if this changes, the next few lines will need to @@ -1558,7 +1551,7 @@ class API(base.Base): # support specifying a particular fixed_ip if multiple exist. if not fixed_ip_addrs: msg = _("instance |%s| has no fixed_ips. " - "unable to associate floating ip") % instance_id + "unable to associate floating ip") % instance_uuid raise exception.ApiError(msg) if len(fixed_ip_addrs) > 1: LOG.warning(_("multiple fixed_ips exist, using the first: %s"), |
