expose node hrn to the OMF resource controller
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 12 Mar 2010 10:19:48 +0000 (10:19 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 12 Mar 2010 10:19:48 +0000 (10:19 +0000)
PLC/Accessors/Accessors_standard.py
PLC/Methods/GetSlivers.py
db-config.d/010-node_tags

index a5f42d9..774903c 100644 (file)
@@ -66,6 +66,11 @@ define_accessors(current_module, Node, "Deployment", "deployment",
 define_accessors(current_module, Node, "Extensions", "extensions", 
                  "node/config", "space-separated list of extensions to install",
                  get_roles=all_roles, set_roles=["admin"],expose_in_api=True)
+# access HRN
+define_accessors(current_module, Node, "Hrn","hrn",
+                 "node/sfa", "SFA human readable name",
+                 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
+
 # test nodes perform their installation from an uncompressed bootstrapfs
 define_accessors(current_module, Node, "PlainBootstrapfs", "plain-bootstrapfs", 
                  "node/config", "use uncompressed bootstrapfs when set",
index 2d201b9..98fd425 100644 (file)
@@ -20,6 +20,8 @@ from PLC.SliceTags import SliceTag, SliceTags
 from PLC.InitScripts import InitScript, InitScripts
 from PLC.Methods.GetSliceFamily import GetSliceFamily
 
+from PLC.Accessors.Accessors_standard import *
+
 # XXX used to check if slice expiration time is sane
 MAXINT =  2L**31-1
 
@@ -281,7 +283,7 @@ class GetSlivers(Method):
         personsitekeys=get_all_admin_keys(self.api)
         accounts.append({'name':'root','keys':personsitekeys})
 
-       node.update_last_contact()
+        hrn = GetNodeHrn(self.api).call(auth,node['node_id'])
 
         # XMPP config for omf federation
         try:
@@ -294,6 +296,8 @@ class GetSlivers(Method):
         except:
             xmpp={'server':None,'user':None,'password':None}
 
+       node.update_last_contact()
+
         return {
             'timestamp': timestamp,
             'node_id': node['node_id'],
@@ -305,4 +309,5 @@ class GetSlivers(Method):
             'slivers': slivers,
             'accounts': accounts,
             'xmpp':xmpp,
+            'hrn':hrn,
             }
index 6e835e7..c25230d 100644 (file)
@@ -8,8 +8,8 @@ nodetag_types = \
 [
     # Node HRN (SFA specific human readable name)
     {'tagname': 'hrn',
-     'description': 'SFA specific human readable name',
-     'category' : 'sfa/general',
+     'description': 'SFA human readable name',
+     'category' : 'node/sfa',
      'min_role_id': 10},
 ]