Repository: libcloud Updated Branches: refs/heads/trunk 2a42270d9 -> 93c38981d
[LIBCLOUD-575] ex_all_tenants option for list_nodes() in OpenStack Closes #312 Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/93c38981 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/93c38981 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/93c38981 Branch: refs/heads/trunk Commit: 93c38981d91c23640a91ece503fb63dc7f331b82 Parents: 2a42270 Author: Zak Estrada <[email protected]> Authored: Mon Jun 9 15:37:57 2014 -0500 Committer: Tomaz Muraus <[email protected]> Committed: Wed Jun 11 10:03:56 2014 +0200 ---------------------------------------------------------------------- CHANGES.rst | 4 ++++ libcloud/compute/drivers/openstack.py | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/93c38981/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index 324590d..250430d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -213,6 +213,10 @@ Compute (GUTHUB-308) [Dustin Oberloh] +- Add ex_all_tenants argument to the list_nodes method in the OpenStack driver. + (GITHUB-312) + [LIBCLOUD-575, Zak Estrada] + Storage ~~~~~~~ http://git-wip-us.apache.org/repos/asf/libcloud/blob/93c38981/libcloud/compute/drivers/openstack.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/openstack.py b/libcloud/compute/drivers/openstack.py index e2c5057..fd116e8 100644 --- a/libcloud/compute/drivers/openstack.py +++ b/libcloud/compute/drivers/openstack.py @@ -218,9 +218,20 @@ class OpenStackNodeDriver(NodeDriver, OpenStackDriverMixin): def reboot_node(self, node): return self._reboot_node(node, reboot_type='HARD') - def list_nodes(self): + def list_nodes(self, ex_all_tenants=False): + """ + List the nodes in a tenant + + :param ex_all_tenants: List nodes for all the tenants. Note: Your user + must have admin privileges for this + functionality to work. + :type ex_all_tenants: ``bool`` + """ + params = {} + if ex_all_tenants: + params = {'all_tenants': 1} return self._to_nodes( - self.connection.request('/servers/detail').object) + self.connection.request('/servers/detail', params=params).object) def create_volume(self, size, name, location=None, snapshot=None): if snapshot:
