import utils
import os
+import ModelOptions
+
def Run( vars, log ):
"""
Expect the following variables to be set:
SYSIMG_PATH the path where the system image will be mounted
MINIMUM_DISK_SIZE any disks smaller than this size, in GB, are not used
+ NODE_MODEL_OPTIONS the node's model options
Set the following variables upon successfully running:
ROOT_MOUNTED the node root file system is mounted
if PARTITIONS == None:
raise ValueError, "PARTITIONS"
+ NODE_MODEL_OPTIONS= vars["NODE_MODEL_OPTIONS"]
except KeyError, var:
raise BootManagerException, "Missing variable in vars: %s\n" % var
except ValueError, var:
log.write("To paranoid to add %s to vservers lvm.\n" % device)
continue
- log.write( "Attempting to add %s to the volume group\n" % device )
-
if not InstallPartitionDisks.single_partition_device( device, vars, log ):
log.write( "Unable to partition %s, not using it.\n" % device )
continue
- log.write( "Successfully initialized %s\n" % device )
+ log.write( "Successfully partitioned %s\n" % device )
+
+ if NODE_MODEL_OPTIONS & ModelOptions.RAWDISK:
+ log.write( "Running on a raw disk node, not using it.\n" )
+ continue
part_path= InstallPartitionDisks.get_partition_path_from_device( device,
vars, log )
+
+ log.write( "Attempting to add %s to the volume group\n" % device )
+
if not InstallPartitionDisks.create_lvm_physical_volume( part_path,
vars, log ):
log.write( "Unable to create lvm physical volume %s, not using it.\n" %
if PARTITIONS == None:
raise ValueError, "PARTITIONS"
+ if NODE_MODEL_OPTIONS & ModelOptions.RAWDISK:
+ VSERVERS_SIZE= "-1"
+ if "VSERVER_SIZE" in vars:
+ VSERVERS_SIZE= vars["VSERVERS_SIZE"]
+ if VSERVERS_SIZE == "" or VSERVERS_SIZE == 0:
+ raise ValueError, "VSERVERS_SIZE"
+
except KeyError, var:
raise BootManagerException, "Missing variable in vars: %s\n" % var
except ValueError, var:
used_devices= []
- for device in INSTALL_BLOCK_DEVICES:
+ for device in sorted(INSTALL_BLOCK_DEVICES):
if single_partition_device( device, vars, log ):
- used_devices.append( device )
- log.write( "Successfully initialized %s\n" % device )
+ if (len(used_devices) > 0 and
+ (vars['NODE_MODEL_OPTIONS'] & ModelOptions.RAWDISK)):
+ log.write( "Running in raw disk mode, not using %s.\n" % device )
+ else:
+ used_devices.append( device )
+ log.write( "Successfully initialized %s\n" % device )
else:
log.write( "Unable to partition %s, not using it.\n" % device )
continue
# create root logical volume
utils.sysexec( "lvcreate -L%s -nroot planetlab" % ROOT_SIZE, log )
- # create vservers logical volume with all remaining space
- # first, we need to get the number of remaining extents we can use
- remaining_extents= get_remaining_extents_on_vg( vars, log )
-
- utils.sysexec( "lvcreate -l%s -nvservers planetlab" % remaining_extents, log )
+ if vars['NODE_MODEL_OPTIONS'] & ModelOptions.RAWDISK and VSERVERS_SIZE != "-1":
+ utils.sysexec( "lvcreate -L%s -nvservers planetlab" % VSERVERS_SIZE, log )
+ remaining_extents= get_remaining_extents_on_vg( vars, log )
+ utils.sysexec( "lvcreate -l%s -nrawdisk planetlab" % remaining_extents, log )
+ else:
+ # create vservers logical volume with all remaining space
+ # first, we need to get the number of remaining extents we can use
+ remaining_extents= get_remaining_extents_on_vg( vars, log )
+
+ utils.sysexec( "lvcreate -l%s -nvservers planetlab" % remaining_extents, log )
# activate volume group (should already be active)
#utils.sysexec( TEMP_PATH + "vgchange -ay planetlab", log )