X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fplanetlab%2Fplaggregate.py;h=a5a3a0ee7bcd32d148752be3130b55cf1338e975;hb=31cc4fa991896f000abb106916662923f37bc3a6;hp=325ca180fbfca1e7f12d93c19c15824b63164c33;hpb=32659abc546ba8fd6672d9a41e7eb0fba0a9b2bd;p=sfa.git diff --git a/sfa/planetlab/plaggregate.py b/sfa/planetlab/plaggregate.py index 325ca180..a5a3a0ee 100644 --- a/sfa/planetlab/plaggregate.py +++ b/sfa/planetlab/plaggregate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python2 from collections import defaultdict from sfa.util.xrn import Xrn, hrn_to_urn, urn_to_hrn, get_authority, get_leaf from sfa.util.sfatime import utcparse, datetime_to_string @@ -220,7 +220,7 @@ class PlAggregate: # slice-global tags node['slice-tags'] = pltags_dict['slice-global'] # xxx - # this is where we chould maybe add the nodegroup slice tags, + # this is where we should maybe add the nodegroup slice tags, # but it's tedious... # xxx # sliver tags @@ -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'