Repository: libcloud Updated Branches: refs/heads/trunk c472bb8c2 -> 4816cbbfd
Added location filter in list_nodes of CloudStack Closes #737 Signed-off-by: Tomaz Muraus <to...@tomaz.me> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2f777cae Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2f777cae Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2f777cae Branch: refs/heads/trunk Commit: 2f777cae68129f9d3e5f2a4f53bf695e79df7271 Parents: c472bb8 Author: lionel <lio...@sixsq.com> Authored: Wed Apr 6 15:01:59 2016 +0200 Committer: Tomaz Muraus <to...@tomaz.me> Committed: Wed Apr 13 18:08:13 2016 +0200 ---------------------------------------------------------------------- libcloud/compute/drivers/cloudstack.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/2f777cae/libcloud/compute/drivers/cloudstack.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py index 33edda7..387e1c7 100644 --- a/libcloud/compute/drivers/cloudstack.py +++ b/libcloud/compute/drivers/cloudstack.py @@ -1348,7 +1348,7 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver): return locations - def list_nodes(self, project=None): + def list_nodes(self, project=None, location=None): """ @inherits: :class:`NodeDriver.list_nodes` @@ -1356,12 +1356,21 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver): the defined project. :type project: :class:`.CloudStackProject` + :keyword location: Limit nodes returned to those in the defined + location. + :type location: :class:`.NodeLocation` + :rtype: ``list`` of :class:`CloudStackNode` """ args = {} + if project: args['projectid'] = project.id + + if location is not None: + args['zoneid'] = location.id + vms = self._sync_request('listVirtualMachines', params=args) addrs = self._sync_request('listPublicIpAddresses', params=args) port_forwarding_rules = self._sync_request('listPortForwardingRules')