From fd26148b4dca05308c3678e3cd27f56294757650 Mon Sep 17 00:00:00 2001 From: parmentelat Date: Fri, 16 Mar 2018 15:58:15 +0100 Subject: [PATCH] the hardware_types in a node rspec is now built by * first looking for the 'hardware_type' tag on the node; if found this ends up in hardware_types (as a single entry) * otherwise the former hard-wired default, suitable for plain planetlab, is used --- sfa/planetlab/plaggregate.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/sfa/planetlab/plaggregate.py b/sfa/planetlab/plaggregate.py index 325ca180..dfae5d5a 100644 --- a/sfa/planetlab/plaggregate.py +++ b/sfa/planetlab/plaggregate.py @@ -264,8 +264,21 @@ class PlAggregate: else: rspec_node['exclusive'] = 'false' - rspec_node['hardware_types'] = [HardwareType({'name': 'plab-pc'}), - HardwareType({'name': 'pc'})] + # expose hardware_types from the hardware_type tag if + # set on node + tags = self.driver.shell.GetNodeTags({ + 'node_id': node['node_id'], + 'tagname': 'hardware_type', + }) + if tags: + rspec_node['hardware_types'] = [ + HardwareType({'name': tags[0]['value']}), + ] + else: + rspec_node['hardware_types'] = [ + HardwareType({'name': 'plab-pc'}), + HardwareType({'name': 'pc'}) + ] # only doing this because protogeni rspec needs # to advertise available initscripts rspec_node['pl_initscripts'] = pl_initscripts.values() @@ -278,11 +291,11 @@ class PlAggregate: } for extra in ('country', 'city'): try: - tts = self.driver.shell.GetSiteTags({ + tags = self.driver.shell.GetSiteTags({ 'site_id' : site['site_id'], 'tagname' : extra, }) - location_dict[extra] = tts[0]['value'] + location_dict[extra] = tags[0]['value'] except: logger.log_exc('extra = {}'.format(extra)) location_dict[extra] = 'unknown' -- 2.43.0