3-fold nodefamily now has fcdistro as well
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 26 Jan 2010 13:57:24 +0000 (13:57 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 26 Jan 2010 13:57:24 +0000 (13:57 +0000)
PLC/Methods/GetBootMedium.py
PLC/Methods/GetNodeFlavour.py

index e314122..e8e796d 100644 (file)
@@ -16,6 +16,8 @@ from PLC.Interfaces import Interface, Interfaces
 from PLC.InterfaceTags import InterfaceTag, InterfaceTags
 from PLC.NodeTags import NodeTag, NodeTags
 
+from PLC.Accessors.Accessors_standard import *                 # import node accessors
+
 # could not define this in the class..
 # create a dict with the allowed actions for each type of node
 allowed_actions = {
@@ -241,26 +243,27 @@ class GetBootMedium(Method):
 
         return file
 
-    # see also InstallBootstrapFS in bootmanager that does similar things
+    # see also GetNodeFlavour that does similar things
     def get_nodefamily (self, node):
-        # get defaults from the myplc build
-        try:
-            (pldistro,arch) = file("/etc/planetlab/nodefamily").read().strip().split("-")
-        except:
-            (pldistro,arch) = ("planetlab","i386")
-            
-        # with no valid argument, return system-wide defaults
+        pldistro = self.api.config.PLC_FLAVOUR_NODE_PLDISTRO
+        fcdistro = self.api.config.PLC_FLAVOUR_NODE_FCDISTRO
+        arch: arch = self.api.config.PLC_FLAVOUR_NODE_ARCH
         if not node:
-            return (pldistro,arch)
-
+            return (pldistro,fcdistro,arch)
+        
         node_id=node['node_id']
+        
+        # no support for deployment-based BootCD's, use kvariants instead
+        node_pldistro = GetNodePldistro (self.api).call(auth, node_id)
+        if node_pldistro: pldistro = node_pldistro
 
-        tag=Nodes(self.api,[node_id],['arch'])[0]['arch']
-        if tag: arch=tag
-        tag=Nodes(self.api,[node_id],['pldistro'])[0]['pldistro']
-        if tag: pldistro=tag
+        node_fcdistro = GetNodeFcdistro (self.api).call(auth, node_id)
+        if node_fcdistro: fcdistro = node_fcdistro
 
-        return (pldistro,arch)
+        node_arch = GetNodeArch (self.api).call(auth,node_id)
+        if node_arch: arch = node_arch
+        
+        return (pldistro,fcdistro,arch)
 
     def bootcd_version (self):
         try:
@@ -438,8 +441,8 @@ class GetBootMedium(Method):
             nodename = "".join(map(hexa2,tempbytes))
 
         # get nodefamily
-        (pldistro,arch) = self.get_nodefamily(node)
-        self.nodefamily="%s-%s"%(pldistro,arch)
+        (pldistro,fcdistro,arch) = self.get_nodefamily(node)
+        self.nodefamily="%s-%s-%s"%(pldistro,fcdistro,arch)
 
         # apply on globals
         for attr in [ "BOOTCDDIR", "BOOTCDBUILD", "GENERICDIR" ]:
index 79943f9..7363aba 100644 (file)
@@ -29,7 +29,7 @@ class GetNodeFlavour(Method):
         ]
 
     returns = { 
-        'nodefamily' : Parameter (str, "the node-family this node should be based upon"),
+        'nodefamily' : Parameter (str, "the nodefamily this node should be based upon"),
         'extensions' : [ Parameter (str, "extensions to add to the base install") ],
         'plain' : Parameter (bool, "use plain bootstrapfs image if set (for tests)" ) ,
         }
@@ -45,12 +45,11 @@ class GetNodeFlavour(Method):
         pldistro = GetNodePldistro (self.api).call(auth, node_id)
         if not pldistro: pldistro = self.api.config.PLC_FLAVOUR_NODE_PLDISTRO
 
-        ###fcdistro = GetNodeFcdistro (self.api).call(auth, node_id)
-        ###if not fcdistro: fcdistro = self.api.config.PLC_FLAVOUR_NODE_FCDISTRO
+        fcdistro = GetNodeFcdistro (self.api).call(auth, node_id)
+        if not fcdistro: fcdistro = self.api.config.PLC_FLAVOUR_NODE_FCDISTRO
 
         # xxx would make sense to check the corresponding bootstrapfs is available
-        ###return "%s-%s-%s"%(pldistro,fcdistro,arch)
-        return "%s-%s"%(pldistro,arch)
+        return "%s-%s-%s"%(pldistro,fcdistro,arch)
 
     def extensions (self, auth, node_id, arch):
         try: