- 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
-
- # check which nodegroups we are part of (>=4.0)
- utils.breakpoint("querying nodegroups for loading extensions")
- try:
- nodes = BootAPI.call_api_function(vars, "GetNodes", ([NODE_ID], ['nodegroup_ids']))
- node = nodes[0]
- nodegroups = BootAPI.call_api_function(vars, "GetNodeGroups", (node['nodegroup_ids'], ['groupname']))
- nodegroupnames = [ nodegroup['groupname'].lower() for nodegroup in nodegroups ]
-
- except:
- log.write("WARNING : Failed to query nodegroups - installing only core software\n")
- nodegroupnames = []
- pass
-
- # see also GetBootMedium in PLCAPI that does similar things
- # figuring the default node family:
- # (1) look at /etc/planetlab/nodefamily on the bootcd
- # (2) if that fails, set to planetlab-i386
- try:
- (pldistro,arch) = file("/etc/planetlab/nodefamily").read().strip().split("-")
- except:
- (pldistro,arch) = ("planetlab","i386")
-
- # scan nodegroupnames - temporary, as most of this nodegroup-based info
- # should be more adequately defined in the nodes data model
- known_archs = [ 'i386', 'x86_64' ]
- extensions = []
- # (1) if groupname == arch, nodefamily becomes pldistro-groupname
- # (2) else if groupname looks like pldistro-arch, it is taken as a nodefamily
- # (3) otherwise groupname is taken as an extension
- for nodegroupname in nodegroupnames:
- if nodegroupname in known_archs:
- arch = nodegroupname
- else:
- is_nodefamily = False
- for known_arch in known_archs:
- try:
- (api_pldistro,api_arch)=nodegroupname.split("-")
- # sanity check
- if api_arch != known_arch: raise Exception,"mismatch"
- (pldistro,arch) = (api_pldistro, api_arch)
- is_nodefamily = True
- break
- except:
- pass
- if not is_nodefamily:
- extensions.append(nodegroupname)
-
- bootstrapfs_names = [ pldistro ] + extensions
+ 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']
+
+ # in upgrade mode: we need to cleanup the disk to make
+ # it safe to just untar the new bootstrapfs tarball again
+ # on top of the hard drive
+ if upgrade:
+ CleanupSysimgBeforeUpgrade(SYSIMG_PATH, nodefamily, log)
+
+ # the 'plain' option is for tests mostly
+ plain = vars['plain']
+ if plain:
+ download_suffix = ".tar"
+ uncompress_option = ""
+ log.write("Using plain bootstrapfs images\n")
+ else:
+ download_suffix = ".tar.bz2"
+ uncompress_option = "-j"
+ log.write("Using compressed bootstrapfs images\n")
+
+ log.write ("Using nodefamily={}\n".format(nodefamily))
+ if not extensions:
+ log.write("Installing only core software\n")
+ else:
+ log.write("Requested extensions {}\n".format(extensions))
+
+ bootstrapfs_names = [ nodefamily ] + extensions