From 19568a456fa79207c66347597d1ad9dcb7585a8a Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Wed, 8 Nov 2006 23:08:47 +0000 Subject: [PATCH] - fix documentation - don't accept node_ids, only hostnames - if caller is a node, just return that node's slivers --- PLC/Methods/GetSlivers.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/PLC/Methods/GetSlivers.py b/PLC/Methods/GetSlivers.py index 97d2df7b..e1071763 100644 --- a/PLC/Methods/GetSlivers.py +++ b/PLC/Methods/GetSlivers.py @@ -15,9 +15,11 @@ from PLC.SliceAttributes import SliceAttribute, SliceAttributes class GetSlivers(Method): """ - Returns an array of structs representing slivers (slices bound to - nodes). If node_id_or_hostname_list is specified, only slivers - bound to the specified nodes are queried. + Returns an array of structs representing nodes and their slivers + (slices bound to nodes). If node_hostnames is specified, only + information about the specified nodes will be returned. If not + specified and called by a node, only information about the caller + will be returned. All of the information returned by this call can be gathered from other calls, e.g. GetNodes, GetNodeNetworks, GetSlices, etc. This @@ -29,8 +31,7 @@ class GetSlivers(Method): accepts = [ Auth(), - [Mixed(Node.fields['node_id'], - Node.fields['hostname'])] + [Node.fields['hostname']] ] returns = [{ @@ -57,10 +58,14 @@ class GetSlivers(Method): }] }] - def call(self, auth, node_id_or_hostname_list = None): + def call(self, auth, node_hostnames = None): timestamp = int(time.time()) - all_nodes = Nodes(self.api, node_id_or_hostname_list) + if node_hostnames is None and isinstance(self.caller, Node): + all_nodes = {self.caller['node_id']: self.caller} + else: + all_nodes = Nodes(self.api, node_hostnames) + # XXX Add foreign nodes nodenetwork_ids = set() nodegroup_ids = set() @@ -83,7 +88,7 @@ class GetSlivers(Method): all_nodegroups = {} # Get configuration files - all_conf_files = ConfFiles(self.api, enabled = True) + all_conf_files = ConfFiles(self.api, {'enabled': True}) if slice_ids: # Get slices -- 2.47.0