summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorEric Day <eday@oddments.org>2011-01-05 09:50:19 -0800
committerEric Day <eday@oddments.org>2011-01-05 09:50:19 -0800
commitdef5583469bd265c9107ed54d461441bc6303151 (patch)
tree36767dd00c4db73c345f76ea611b7873ab0879fe /nova/compute
parente97cb0f19f66ee4d28685575cea57b1eb32c4ed3 (diff)
Split internal API get calls to get and get_all, where the former takes an ID and returns one resource, and the latter can optionally take a filter and return a list of resources.
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 74d030c4d..64d47b1ce 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -245,13 +245,15 @@ class API(base.Base):
else:
self.db.instance_destroy(context, instance_id)
- def get(self, context, instance_id=None, project_id=None,
- reservation_id=None, fixed_ip=None):
- """Get one or more instances, possibly filtered by one of the
+ def get(self, context, instance_id):
+ """Get a single instance with the given ID."""
+ return self.db.instance_get_by_id(context, instance_id)
+
+ def get_all(self, context, project_id=None, reservation_id=None,
+ fixed_ip=None):
+ """Get all instances, possibly filtered by one of the
given parameters. If there is no filter and the context is
an admin, it will retreive all instances in the system."""
- if instance_id is not None:
- return self.db.instance_get_by_id(context, instance_id)
if reservation_id is not None:
return self.db.instance_get_all_by_reservation(context,
reservation_id)