- utils.makedirs( SYSIMG_PATH )
-
- log.write( "mounting root file system\n" )
- utils.sysexec( "mount -t ext3 %s %s" % (PARTITIONS["root"],SYSIMG_PATH), log )
-
- log.write( "mounting vserver partition in root file system\n" )
- utils.makedirs( SYSIMG_PATH + "/vservers" )
- utils.sysexec( "mount -t ext3 %s %s/vservers" % (PARTITIONS["vservers"],
- SYSIMG_PATH), 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 = []
- try:
- extension_tag = BootAPI.call_api_function(vars, "GetNodeExtensions", (NODE_ID,) )
- if extension_tag:
- extensions = extension_tag.split()
-
- except:
- log.write("WARNING : Failed to query tag 'extensions'\n")
- log.write(traceback.format_exc())
-
- if not extensions:
- log.write("installing only core software\n")
-
- # check if the plain-bootstrapfs tag is set
- download_suffix=".tar.bz2"
- untar_option="-j"
- try:
- if BootAPI.call_api_function (vars, "GetNodePlainBootstrapfs", (NODE_ID,) ):
- download_suffix=".tar"
- untar_option=""
- except:
- log.write("WARNING : Failed to query tag 'plain-bootstrapfs'\n")
- log.write(traceback.format_exc())
-
- if not untar_option:
- log.write("Using uncompressed bootstrapfs images\n")
-
- # see also GetBootMedium in PLCAPI that does similar things
- # figuring the default node family:
- # (1) get node's tags 'arch' and 'pldistro'
- # (2) if unsuccessful search /etc/planetlab/nodefamily on the bootcd
- # (3) if that fails, set to planetlab-i386
-
- try:
- api_pldistro = BootAPI.call_api_function(vars, "GetNodePldistro", (NODE_ID,) )
- except:
- log.write("WARNING : Failed to query tag 'pldistro'\n")
- api_pldistro = None
- try:
- api_arch = BootAPI.call_api_function(vars, "GetNodeArch", (NODE_ID,) )
- except:
- log.write("WARNING : Failed to query tag 'arch'\n")
- api_arch = None
- try:
- (etc_pldistro,etc_arch) = file("/etc/planetlab/nodefamily").read().strip().split("-")
- except:
- log.write("WARNING : Failed to parse /etc/planetlab/nodefamily\n")
- (etc_pldistro,etc_arch)=(None,None)
- default_pldistro="planetlab"
- default_arch="i386"
-
- if api_pldistro:
- pldistro = api_pldistro
- log.write ("Using pldistro from pldistro API tag\n")
- elif etc_pldistro:
- pldistro = etc_pldistro
- log.write ("Using pldistro from /etc/planetlab/nodefamily\n")
- else:
- pldistro = default_pldistro
- log.write ("Using default pldistro\n")
-
- if api_arch:
- arch = api_arch
- log.write ("Using arch from arch API tag\n")
- elif etc_arch:
- arch = etc_arch
- log.write ("Using arch from /etc/planetlab/nodefamily\n")
+ utils.makedirs(SYSIMG_PATH)
+
+ log.write("mounting root file system\n")
+ utils.sysexec("mount -t ext3 {} {}".format(PARTITIONS["root"], SYSIMG_PATH), log)
+
+ fstype = 'ext3' if vars['virt']=='vs' else 'btrfs'
+
+ one_partition = vars['ONE_PARTITION']=='1'
+
+ if (not one_partition):
+ log.write("mounting vserver partition in root file system (type {})\n".format(fstype))
+ utils.makedirs(SYSIMG_PATH + "/vservers")
+ utils.sysexec("mount -t {} {} {}/vservers"\
+ .format(fstype, PARTITIONS["vservers"], SYSIMG_PATH), log)
+
+ if vars['virt']=='lxc':
+ # NOTE: btrfs quota is supported from version: >= btrfs-progs-0.20 (f18+)
+ # older versions will not recongize the 'quota' command.
+ log.write("Enabling btrfs quota on {}/vservers\n".format(SYSIMG_PATH))
+ utils.sysexec_noerr("btrfs quota enable {}/vservers".format(SYSIMG_PATH))
+
+ vars['ROOT_MOUNTED'] = 1
+
+ # this is now retrieved in GetAndUpdateNodeDetails
+ nodefamily = vars['nodefamily']
+ extensions = vars['extensions']
+ # the 'plain' option is for tests mostly
+ plain = vars['plain']
+ if plain:
+ download_suffix = ".tar"
+ uncompress_option = ""
+ log.write("Using plain bootstrapfs images\n")