From 0d30e5ebdb3f823e2d788a50ad65fb4abb3192c0 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 14 Jan 2010 15:55:15 +0000 Subject: [PATCH] get rid of the old dirty trick that allowed to spot the right bootstrapfs for alpha nodes and the like the bootmanager configuration is not patched anymore, instead we rely on GetNodeDeployment --- build.sh | 3 --- source/configuration | 5 ---- source/steps/InstallBootstrapFS.py | 33 +++++++++++++++------------ source/steps/ReadNodeConfiguration.py | 16 +------------ 4 files changed, 20 insertions(+), 37 deletions(-) diff --git a/build.sh b/build.sh index 06e9f00..162f73b 100755 --- a/build.sh +++ b/build.sh @@ -28,9 +28,6 @@ BOOTSTRAPDIR="/boot" # Change to our source directory cd $(dirname $0) -# Translate configuration file -sed -i -e "s|SUPPORT_FILE_DIR=.*|SUPPORT_FILE_DIR=$BOOTSTRAPDIR|" source/configuration - # Source bootmanager configuration . source/configuration diff --git a/source/configuration b/source/configuration index e21933a..48ddbc9 100644 --- a/source/configuration +++ b/source/configuration @@ -50,11 +50,6 @@ NONCE_FILE=/tmp/nonce PLCONF_DIR=/etc/planetlab -# directory on the boot server containing -# support files and scripts -SUPPORT_FILE_DIR=/boot - - # this sets the size of the root logical volume, # after the root and swap has been created, remaining # goes to the vserver partition diff --git a/source/steps/InstallBootstrapFS.py b/source/steps/InstallBootstrapFS.py index 2c49acc..93ef59d 100644 --- a/source/steps/InstallBootstrapFS.py +++ b/source/steps/InstallBootstrapFS.py @@ -27,8 +27,6 @@ def Run( vars, log ): SYSIMG_PATH the path where the system image will be mounted PARTITIONS dictionary of generic part. types (root/swap) and their associated devices. - SUPPORT_FILE_DIR directory on the boot servers containing - scripts and support files NODE_ID the id of this machine Sets the following variables: @@ -50,10 +48,6 @@ def Run( vars, log ): if PARTITIONS == None: raise ValueError, "PARTITIONS" - SUPPORT_FILE_DIR= vars["SUPPORT_FILE_DIR"] - if SUPPORT_FILE_DIR == None: - raise ValueError, "SUPPORT_FILE_DIR" - NODE_ID= vars["NODE_ID"] if NODE_ID == "": raise ValueError, "NODE_ID" @@ -91,6 +85,13 @@ def Run( vars, log ): vars['ROOT_MOUNTED']= 1 + # fetch deployment tag (like, 'alpha' or the like) + try: + deployment = BootAPI.call_api_function(vars, "GetNodeDeployment", (NODE_ID,) ) + except: + log.write("WARNING : Failed to query tag 'deployment'\n") + deployment = "" + # which extensions are we part of ? utils.breakpoint("Checking for the extension(s) tags") extensions = [] @@ -166,17 +167,21 @@ def Run( vars, log ): log.write ("Using nodefamily=%s-%s\n"%(pldistro,arch)) - bootstrapfs_names = [ pldistro ] + extensions + # deployment is enough, let operators put what they want in there + if deployment: + bootstrapfs_names = [ deployment ] + else: + bootstrapfs_names = [ "%s-%s"%(x,arch) for x in [ pldistro ] + extensions ] # download and extract support tarball for this step, which has # everything we need to successfully run - # we first try to find a tarball, if it is not found we use yum instead + # installing extensions through yum has been dismantled yum_extensions = [] # download and extract support tarball for this step, - for bootstrapfs_name in bootstrapfs_names: - tarball = "bootstrapfs-%s-%s%s"%(bootstrapfs_name,arch,download_suffix) - source_file= "%s/%s" % (SUPPORT_FILE_DIR,tarball) + for name in bootstrapfs_names: + tarball = "bootstrapfs-%s%s"%(name,download_suffix) + source_file= "/boot/%s" % (SUPPORT_FILE_DIR,tarball) dest_file= "%s/%s" % (SYSIMG_PATH, tarball) # 30 is the connect timeout, 14400 is the max transfer time in @@ -192,12 +197,12 @@ def Run( vars, log ): utils.removefile( dest_file ) else: # the main tarball is required - if bootstrapfs_name == pldistro: + if name == "%s-%s"%(pldistro,arch): raise BootManagerException, "Unable to download main tarball %s from server." % \ source_file else: - log.write("tarball for %s-%s not found, scheduling a yum attempt\n"%(bootstrapfs_name,arch)) - yum_extensions.append(bootstrapfs_name) + log.write("tarball for %s not found, scheduling a yum attempt\n"%(name)) + yum_extensions.append(name) # copy resolv.conf from the base system into our temp dir # so DNS lookups work correctly while we are chrooted diff --git a/source/steps/ReadNodeConfiguration.py b/source/steps/ReadNodeConfiguration.py index 9c9f0df..09e6e1b 100644 --- a/source/steps/ReadNodeConfiguration.py +++ b/source/steps/ReadNodeConfiguration.py @@ -50,8 +50,6 @@ def Run( vars, log ): and read, return 1. Expect the following variables from the store: - SUPPORT_FILE_DIR directory on the boot servers containing - scripts and support files Sets the following variables from the configuration file: WAS_NODE_ID_IN_CONF Set to 1 if the node id was in the conf file @@ -83,16 +81,6 @@ def Run( vars, log ): # make sure we have the variables we need - try: - SUPPORT_FILE_DIR= vars["SUPPORT_FILE_DIR"] - if SUPPORT_FILE_DIR == None: - raise ValueError, "SUPPORT_FILE_DIR" - - except KeyError, var: - raise BootManagerException, "Missing variable in vars: %s\n" % var - except ValueError, var: - raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var - INTERFACE_SETTINGS= {} INTERFACE_SETTINGS['method']= "dhcp" @@ -348,7 +336,6 @@ def __parse_configuration_file( vars, log, file_contents ): of the configuration file is completed. """ - SUPPORT_FILE_DIR= vars["SUPPORT_FILE_DIR"] INTERFACE_SETTINGS= vars["INTERFACE_SETTINGS"] if file_contents is None: @@ -476,8 +463,7 @@ def __parse_configuration_file( vars, log, file_contents ): bs_request= BootServerRequest.BootServerRequest(vars) postVars= {"mac_addr" : INTERFACE_SETTINGS["mac"]} - result= bs_request.DownloadFile( "%s/getnodeid.php" % - SUPPORT_FILE_DIR, + result= bs_request.DownloadFile( "/boot/getnodeid.php", None, postVars, 1, 1, "/tmp/node_id") if result == 0: -- 2.43.0