install -D -m 755 bootmanager.sh $RPM_BUILD_ROOT/var/www/html/boot/bootmanager.sh
for file in \
uudecode.gz \
- alpina-BootLVM.tar.gz \
- alpina-PartDisks.tar.gz \
PlanetLab-Bootstrap.tar.bz2 ; do
install -D -m 644 support-files/$file $RPM_BUILD_ROOT/var/www/html/boot/$file
done
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
+
import xmlrpclib
import xml.parsers.expat
import hmac
#!/usr/bin/python2 -u
-# ------------------------------------------------------------------------
-# THIS file used to be named alpina.py, from the node installer. Since then
-# the installer has been expanded to include all the functions of the boot
-# manager as well, hence the new name for this file.
-# ------------------------------------------------------------------------
-
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
import string
import sys, os, traceback
import notify_messages
import BootServerRequest
-
-
# all output is written to this file
LOG_FILE= "/tmp/bm.log"
UPLOAD_LOG_PATH = "/alpina-logs/upload.php"
# override machine's current state from the command line
self.forceState = forceState
- # this contains a set of information used and updated
- # by each step
- self.VARS= {}
-
# the main logging point
self.LOG= log
# set to 1 if we can run after initialization
self.CAN_RUN = 0
- if not self.ReadBMConf():
- self.LOG.LogEntry( "Unable to read configuration vars." )
- return
-
- # find out which directory we are running it, and set a variable
- # for that. future steps may need to get files out of the bootmanager
- # directory
- current_dir= os.getcwd()
- self.VARS['BM_SOURCE_DIR']= current_dir
-
- # not sure what the current PATH is set to, replace it with what
- # we know will work with all the boot cds
- os.environ['PATH']= string.join(BIN_PATH,":")
-
- self.CAN_RUN= 1
-
- def ReadBMConf(self):
- """
- read in and store all variables in VARS_FILE into
- self.VARS
-
- each line is in the format name=val (any whitespace around
- the = is removed. everything after the = to the end of
- the line is the value
- """
-
+ # read in and store all variables in VARS_FILE into each line
+ # is in the format name=val (any whitespace around the = is
+ # removed. everything after the = to the end of the line is
+ # the value
+ vars = {}
vars_file= file(self.VARS_FILE,'r')
+ validConfFile = True
for line in vars_file:
# if its a comment or a whitespace line, ignore
if line[:1] == "#" or string.strip(line) == "":
parts= string.split(line,"=")
if len(parts) != 2:
self.LOG.LogEntry( "Invalid line in vars file: %s" % line )
- return 0
+ validConfFile = False
+ break
name= string.strip(parts[0])
value= string.strip(parts[1])
+ vars[name]= value
- self.VARS[name]= value
+ vars_file.close()
+ if not validConfFile:
+ self.LOG.LogEntry( "Unable to read configuration vars." )
+ return
+
+ # find out which directory we are running it, and set a variable
+ # for that. future steps may need to get files out of the bootmanager
+ # directory
+ current_dir= os.getcwd()
+ vars['BM_SOURCE_DIR']= current_dir
+
+ # not sure what the current PATH is set to, replace it with what
+ # we know will work with all the boot cds
+ os.environ['PATH']= string.join(BIN_PATH,":")
+
+ # this contains a set of information used and updated
+ # by each step
+ self.VARS= vars
+
+ self.CAN_RUN= 1
- return 1
-
def Run(self):
"""
core boot manager logic.
self.VARS['STATE_CHANGE_NOTIFY']= 1
self.VARS['STATE_CHANGE_NOTIFY_MESSAGE']= \
notify_messages.MSG_NODE_NOT_INSTALLED
- UpdateBootStateWithPLC.Run( self.VARS, self.LOG )
+ raise BootManagerException, \
+ notify_messages.MSG_NODE_NOT_INSTALLED
+
+ def _bootRun():
+ # implements the boot logic, which consists of first
+ # double checking that the node was properly installed,
+ # checking whether someone added or changed disks, and
+ # then finally chain boots.
+
+ InstallInit.Run( self.VARS, self.LOG )
+ if ValidateNodeInstall.Run( self.VARS, self.LOG ):
+ WriteModprobeConfig.Run( self.VARS, self.LOG )
+ WriteNetworkConfig.Run( self.VARS, self.LOG )
+ # the following step should be done by NM
+ UpdateNodeConfiguration.Run( self.VARS, self.LOG )
+ CheckForNewDisks.Run( self.VARS, self.LOG )
+ SendHardwareConfigToPLC.Run( self.VARS, self.LOG )
+ ChainBootNode.Run( self.VARS, self.LOG )
+ else:
+ _nodeNotInstalled()
def _rinsRun():
# implements the reinstall logic, which will check whether
# 'boot' state and chainboot into the production system
if not CheckHardwareRequirements.Run( self.VARS, self.LOG ):
self.VARS['BOOT_STATE']= 'dbg'
- UpdateBootStateWithPLC.Run( self.VARS, self.LOG )
raise BootManagerException, "Hardware requirements not met."
- self.RunInstaller()
-
- if ValidateNodeInstall.Run( self.VARS, self.LOG ):
- SendHardwareConfigToPLC.Run( self.VARS, self.LOG )
- ChainBootNode.Run( self.VARS, self.LOG )
- else:
- _nodeNotInstalled()
-
+ # runinstaller
+ InstallInit.Run( self.VARS, self.LOG )
+ InstallPartitionDisks.Run( self.VARS, self.LOG )
+ InstallBootstrapRPM.Run( self.VARS, self.LOG )
+ InstallWriteConfig.Run( self.VARS, self.LOG )
+ InstallBuildVServer.Run( self.VARS, self.LOG )
+ InstallNodeInit.Run( self.VARS, self.LOG )
+ InstallUninitHardware.Run( self.VARS, self.LOG )
+ self.VARS['BOOT_STATE']= 'boot'
+ self.VARS['STATE_CHANGE_NOTIFY']= 1
+ self.VARS['STATE_CHANGE_NOTIFY_MESSAGE']= \
+ notify_messages.MSG_INSTALL_FINISHED
+ UpdateBootStateWithPLC.Run( self.VARS, self.LOG )
+ _bootRun()
+
def _newRun():
# implements the new install logic, which will first check
# with the user whether it is ok to install on this
UpdateBootStateWithPLC.Run( self.VARS, self.LOG )
_rinsRun()
- def _bootRun():
- # implements the boot logic, which consists of first
- # double checking that the node was properly installed,
- # checking whether someone added or changed disks, and
- # then finally chain boots.
-
- if ValidateNodeInstall.Run( self.VARS, self.LOG ):
- UpdateNodeConfiguration.Run( self.VARS, self.LOG )
- CheckForNewDisks.Run( self.VARS, self.LOG )
- SendHardwareConfigToPLC.Run( self.VARS, self.LOG )
- ChainBootNode.Run( self.VARS, self.LOG )
- else:
- _nodeNotInstalled()
-
-
def _debugRun():
# implements debug logic, which just starts the sshd
# and just waits around
+ self.VARS['BOOT_STATE']='dbg'
+ UpdateBootStateWithPLC.Run( self.VARS, self.LOG )
StartDebug.Run( self.VARS, self.LOG )
def _badRun():
# should never happen; log event
self.LOG.write( "\nInvalid BOOT_STATE = %s\n" % self.VARS['BOOT_STATE'])
- self.VARS['BOOT_STATE']= 'dbg'
- UpdateBootStateWithPLC.Run( self.VARS, self.LOG )
- StartDebug.Run( self.VARS, self.LOG )
+ _debugRun()
global NodeRunStates
# setup state -> function hash table
NodeRunStates['boot'] = _bootRun
NodeRunStates['dbg'] = _debugRun
+ success = 0
try:
InitializeBootManager.Run( self.VARS, self.LOG )
ReadNodeConfiguration.Run( self.VARS, self.LOG )
stateRun = NodeRunStates.get(self.VARS['BOOT_STATE'],_badRun)
stateRun()
+ success = 1
except KeyError, e:
self.LOG.write( "\n\nKeyError while running: %s\n" % str(e) )
except BootManagerException, e:
self.LOG.write( "\n\nException while running: %s\n" % str(e) )
-
- return 1
-
-
-
- def RunInstaller(self):
- """
- since the installer can be invoked at more than one place
- in the boot manager logic, seperate the steps necessary
- to do it here
- """
-
- InstallInit.Run( self.VARS, self.LOG )
- InstallPartitionDisks.Run( self.VARS, self.LOG )
- InstallBootstrapRPM.Run( self.VARS, self.LOG )
- InstallWriteConfig.Run( self.VARS, self.LOG )
- InstallBuildVServer.Run( self.VARS, self.LOG )
- InstallNodeInit.Run( self.VARS, self.LOG )
- InstallUninitHardware.Run( self.VARS, self.LOG )
-
- self.VARS['BOOT_STATE']= 'boot'
- self.VARS['STATE_CHANGE_NOTIFY']= 1
- self.VARS['STATE_CHANGE_NOTIFY_MESSAGE']= \
- notify_messages.MSG_INSTALL_FINISHED
- UpdateBootStateWithPLC.Run( self.VARS, self.LOG )
+ except:
+ self.LOG.write( "\n\nImplementation Error\n")
+ traceback.print_exc(file=self.LOG.OutputFile)
+ traceback.print_exc()
- SendHardwareConfigToPLC.Run( self.VARS, self.LOG )
+ if not success:
+ try:
+ _debugRun()
+ except BootManagerException, e:
+ self.LOG.write( "\n\nException while running: %s\n" % str(e) )
+ except:
+ self.LOG.write( "\n\nImplementation Error\n")
+ traceback.print_exc(file=self.LOG.OutputFile)
+ traceback.print_exc()
-
+ return success
+
+
def main(argv):
global NodeRunStates
NodeRunStates = {'new':None,
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
import os, sys
import re
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
class BootManagerException(Exception):
def __init__( self, err ):
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
+
import string
MINHW = 0x001
options = options | modeloptions.get(info,0)
return options
+
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
+
"""
Various functions that are used to allow the boot manager to run on various
different cds are included here
-#!/usr/bin/env python
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
"""
The point of this small utility is to take a file in the format
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
"""
this file contains the ids of messages that we can send the contacts
at a site, through the BootNotifyOwners call
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
+
import os
from Exceptions import *
import BootAPI
-import StartDebug
AUTH_FAILURE_COUNT_FILE= "/tmp/authfailurecount"
log.write( "Maximum number of authentication failures reached.\n" )
log.write( "Canceling boot process and going into debug mode.\n" )
- StartDebug.Run( vars, log )
-
raise BootManagerException, "Unable to authenticate node."
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
+
import string
import re
import os
-import InstallWriteConfig
import UpdateBootStateWithPLC
from Exceptions import *
import utils
import compatibility
-from systeminfo import systeminfo
+import systeminfo
import BootAPI
import notify_messages
NODE_MODEL_OPTIONS= vars["NODE_MODEL_OPTIONS"]
+ PARTITIONS= vars["PARTITIONS"]
+ if PARTITIONS == None:
+ raise ValueError, "PARTITIONS"
+
except KeyError, var:
raise BootManagerException, "Missing variable in vars: %s\n" % var
except ValueError, var:
# simply creating an instance of this class and listing the system
# block devices will make them show up so vgscan can find the planetlab
# volume group
- systeminfo().get_block_device_list()
+ systeminfo.get_block_device_list(vars, log)
utils.sysexec( "vgscan", log )
utils.sysexec( "vgchange -ay planetlab", log )
utils.makedirs( SYSIMG_PATH )
- utils.sysexec( "mount /dev/planetlab/root %s" % SYSIMG_PATH, log )
- utils.sysexec( "mount /dev/planetlab/vservers %s/vservers" %
- SYSIMG_PATH, log )
- utils.sysexec( "mount -t proc none %s/proc" % SYSIMG_PATH, log )
+ cmd = "mount %s %s" % (PARTITIONS["root"],SYSIMG_PATH)
+ utils.sysexec( cmd, log )
+ cmd = "mount %s %s/vservers" % (PARTITIONS["vservers"],SYSIMG_PATH)
+ utils.sysexec( cmd, log )
+ cmd = "mount -t proc none %s/proc" % SYSIMG_PATH
+ utils.sysexec( cmd, log )
ROOT_MOUNTED= 1
vars['ROOT_MOUNTED']= 1
- node_update_cmd= "/usr/local/planetlab/bin/NodeUpdate.py start noreboot"
-
log.write( "Running node update.\n" )
- utils.sysexec( "chroot %s %s" % (SYSIMG_PATH,node_update_cmd), log )
+ cmd = "chroot %s /usr/local/planetlab/bin/NodeUpdate.py start noreboot" \
+ % SYSIMG_PATH
+ utils.sysexec( cmd, log )
log.write( "Updating ssh public host key with PLC.\n" )
ssh_host_key= ""
update_vals['ssh_host_key']= ssh_host_key
BootAPI.call_api_function( vars, "BootUpdateNode", (update_vals,) )
- # rewrite modprobe.conf in case there were any module changes
- # from a new kernel installed.
- log.write( "Rewriting /etc/modprobe.conf\n" )
- (network_count,storage_count)= \
- InstallWriteConfig.write_modprobeconf_file( vars, log )
-
# get the kernel version
option = ''
if NODE_MODEL_OPTIONS & ModelOptions.SMP:
utils.sysexec_noerr( "chroot %s umount /rcfs" % SYSIMG_PATH, log )
except OSError, e:
pass
+
utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH, log )
- utils.sysexec_noerr( "umount -r /dev/planetlab/vservers", log )
- utils.sysexec_noerr( "umount -r /dev/planetlab/root", log )
+ utils.sysexec_noerr( "umount -r %s/vservers" % SYSIMG_PATH, log )
+ utils.sysexec_noerr( "umount -r %s" % SYSIMG_PATH, log )
utils.sysexec_noerr( "vgchange -an", log )
ROOT_MOUNTED= 0
vars['ROOT_MOUNTED']= 0
- # before we do the real kexec, check to see if we had any
- # network drivers written to modprobe.conf. if not, return -1,
- # which will cause this node to be switched to a debug state.
- if network_count == 0:
- log.write( "\nIt appears we don't have any network drivers. Aborting.\n" )
-
- vars['BOOT_STATE']= 'dbg'
- vars['STATE_CHANGE_NOTIFY']= 1
- vars['STATE_CHANGE_NOTIFY_MESSAGE']= \
- notify_messages.MSG_NO_DETECTED_NETWORK
- UpdateBootStateWithPLC.Run( vars, log )
-
- return
-
log.write( "Unloading modules and chain booting to new kernel.\n" )
# further use of log after Upload will only output to screen
log.write( "Couldn't read /proc/modules, continuing.\n" )
- kargs = "root=/dev/mapper/planetlab-root ramdisk_size=8192"
+ kargs = "root=%s ramdisk_size=8192" % PARTITIONS["mapper-root"]
if NODE_MODEL_OPTIONS & ModelOptions.SMP:
kargs = kargs + " " + "acpi=off"
try:
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
import string
import InstallPartitionDisks
from Exceptions import *
-from systeminfo import systeminfo
+import systeminfo
import compatibility
import utils
import os
raise ValueError, "SYSIMG_PATH"
MINIMUM_DISK_SIZE= int(vars["MINIMUM_DISK_SIZE"])
+
+ PARTITIONS= vars["PARTITIONS"]
+ if PARTITIONS == None:
+ raise ValueError, "PARTITIONS"
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
- sysinfo= systeminfo()
-
- all_devices= sysinfo.get_block_device_list()
+ all_devices= systeminfo.get_block_device_list(vars, log)
# find out if there are unused disks in all_devices that are greater
# than old cds need extra utilities to run lvm
# this is the lvm partition, if it exists on that device
lvm_partition= "%s1" % device
- already_added= utils.sysexec_noerr( "pvdisplay %s | grep -q 'planetlab'" %
- lvm_partition )
+ cmd = "pvdisplay %s | grep -q 'planetlab'" % lvm_partition
+ already_added= utils.sysexec_noerr(cmd, log)
if already_added:
log.write( "It appears %s is part of the volume group, continuing.\n" %
# just to be extra paranoid, ignore the device if it already has
# an lvm partition on it (new disks won't have this, and that is
# what this code is for, so it should be ok).
- has_lvm= utils.sysexec_noerr( "sfdisk -l %s | grep -q 'Linux LVM'" %
- device )
+ cmd = "sfdisk -l %s | grep -q 'Linux LVM'" % device
+ has_lvm= utils.sysexec_noerr(cmd, log)
if has_lvm:
- log.write( "It appears %s has/had lvm already setup on "\
- "it, continuing.\n" % device )
- continue
+ log.write( "It appears %s has lvm already setup on it.\n" % device)
+ paranoid = False
+ if paranoid:
+ 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 ):
except OSError, e:
pass
- utils.sysexec_noerr( "umount /dev/planetlab/vservers", log )
- utils.sysexec_noerr( "umount /dev/planetlab/root", log )
+ # umount in order to extend disk size
+ utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH, log )
+ utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH, log )
+ utils.sysexec_noerr( "umount %s" % SYSIMG_PATH, log )
utils.sysexec( "vgchange -an", log )
vars['ROOT_MOUNTED']= 0
- if not utils.sysexec_noerr( "vgextend planetlab %s" %
- string.join(new_devices," "), log ):
- log.write( "Failed to add physical volumes %s to " \
- "volume group, continuing.\n" % string.join(new_devices," "))
- return 1
-
- # now, get the number of unused extents, and extend the vserver
- # logical volume by that much.
- remaining_extents= \
+ while True:
+ cmd = "vgextend planetlab %s" % string.join(new_devices," ")
+ if not utils.sysexec_noerr( cmd, log ):
+ log.write( "Failed to add physical volumes %s to " \
+ "volume group, continuing.\n" % string.join(new_devices," "))
+ res = 1
+ break
+
+ # now, get the number of unused extents, and extend the vserver
+ # logical volume by that much.
+ remaining_extents= \
InstallPartitionDisks.get_remaining_extents_on_vg( vars, log )
- log.write( "Extending vservers logical volume.\n" )
-
- if not utils.sysexec_noerr("lvextend -l +%s /dev/planetlab/vservers" %
- remaining_extents, log):
- log.write( "Failed to extend vservers logical volume, continuing\n" )
- return 1
-
- log.write( "making the ext3 filesystem match new logical volume size.\n" )
- if not utils.sysexec_noerr("resize2fs /dev/planetlab/vservers",log):
- log.write( "Failed to make ext3 file system match, continuing\n" )
- return 1
-
- log.write( "Succesfully extended vservers partition by %4.2f GB\n" %
- extended_gb_size )
+ log.write( "Extending vservers logical volume.\n" )
+ utils.sysexec( "vgchange -ay", log )
+ cmd = "lvextend -l +%s %s" % (remaining_extents, PARTITIONS["vservers"])
+ if not utils.sysexec_noerr(cmd, log):
+ log.write( "Failed to extend vservers logical volume, continuing\n" )
+ res = 1
+ break
+
+ log.write( "making the ext3 filesystem match new logical volume size.\n" )
+ if BOOT_CD_VERSION[0] == 2:
+ cmd = "resize2fs %s" % PARTITIONS["vservers"]
+ resize = utils.sysexec_noerr(cmd,log)
+ elif BOOT_CD_VERSION[0] == 3:
+ vars['ROOT_MOUNTED']= 1
+ cmd = "mount %s %s" % (PARTITIONS["root"],SYSIMG_PATH)
+ utils.sysexec_noerr( cmd, log )
+ cmd = "mount %s %s/vservers" % \
+ (PARTITIONS["vservers"],SYSIMG_PATH)
+ utils.sysexec_noerr( cmd, log )
+ cmd = "ext2online %s/vservers" % SYSIMG_PATH
+ resize = utils.sysexec_noerr(cmd,log)
+ utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH, log )
+ utils.sysexec_noerr( "umount %s" % SYSIMG_PATH, log )
+ vars['ROOT_MOUNTED']= 0
+
+ utils.sysexec( "vgchange -an", log )
+
+ if not resize:
+ log.write( "Failed to resize vservers partition, continuing.\n" )
+ res = 1
+ break
+ else:
+ log.write( "Extended vservers partition by %4.2f GB\n" %
+ extended_gb_size )
+ res = 1
+ break
+
else:
log.write( "No new disk devices to add to volume group.\n" )
+ res = 1
- return 1
+ return res
+#!/usr/bin/python2
+
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
import os
import popen2
import string
-from systeminfo import systeminfo
+import systeminfo
from Exceptions import *
import utils
import notify_messages
raise BootManagerException, \
"Variable in install store blank, shouldn't be: %s" % var
- sysinfo= systeminfo()
-
# lets see if we have enough memory to run
log.write( "Checking for available memory.\n" )
- total_mem= sysinfo.get_total_phsyical_mem()
+ total_mem= systeminfo.get_total_phsyical_mem(vars, log)
if total_mem is None:
raise BootManagerException, "Unable to read total physical memory"
# get a list of block devices to attempt to install on
# (may include cdrom devices)
- install_devices= sysinfo.get_block_device_list()
+ install_devices= systeminfo.get_block_device_list(vars, log)
# save the list of block devices in the log
log.write( "Detected block devices:\n" )
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
from Exceptions import *
welcome_message= \
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
import string
from Exceptions import *
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
import os
import xmlrpclib
import socket
hardware setup (to fix old cd problems)
Sets the following variables:
- BOOT_CD_VERSION A two number tuple of the boot cd version
+ PARTITIONS A dictionary of generic partition types and their
+ associated devices.
+ BOOT_CD_VERSION A two number tuple of the boot cd version
"""
log.write( "\n\nStep: Initializing the BootManager.\n" )
-
+ # define the basic partition paths
+ PARTITIONS= {}
+ PARTITIONS["root"]= "/dev/planetlab/root"
+ PARTITIONS["swap"]= "/dev/planetlab/swap"
+ PARTITIONS["vservers"]= "/dev/planetlab/vservers"
+ # Linux 2.6 mounts LVM with device mapper
+ PARTITIONS["mapper-root"]= "/dev/mapper/planetlab-root"
+ PARTITIONS["mapper-swap"]= "/dev/mapper/planetlab-swap"
+ PARTITIONS["mapper-vservers"]= "/dev/mapper/planetlab-vservers"
+ vars["PARTITIONS"]= PARTITIONS
+
log.write( "Opening connection to API server\n" )
try:
api_inst= xmlrpclib.Server( vars['BOOT_API_SERVER'], verbose=0 )
+#!/usr/bin/python2
+
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
import os, sys, string
import popen2
+#!/usr/bin/python2
+
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
import os
+#!/usr/bin/python2
+
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
import os, sys, shutil
import string
PLCONF_DIR The directory to store the configuration file in
Sets the following variables:
- SYSIMG_PATH the directory where the system image will be mounted,
- (= TEMP_PATH/SYSIMG_DIR)
+ SYSIMG_PATH the directory where the system image will be mounted,
+ (= TEMP_PATH/SYSIMG_DIR)
"""
log.write( "\n\nStep: Install: Initializing.\n" )
except OSError, e:
pass
- utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH, log )
- utils.sysexec_noerr( "umount %s/mnt/cdrom" % SYSIMG_PATH, log )
- utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH, log )
- utils.sysexec_noerr( "umount %s" % SYSIMG_PATH, log )
-
+ utils.sysexec_noerr( "umount %s/proc" % SYSIMG_PATH )
+ utils.sysexec_noerr( "umount %s/mnt/cdrom" % SYSIMG_PATH )
+ utils.sysexec_noerr( "umount %s/vservers" % SYSIMG_PATH )
+ utils.sysexec_noerr( "umount %s" % SYSIMG_PATH )
+ vars['ROOT_MOUNTED']= 0
+
log.write( "Removing any old files, directories\n" )
utils.removedir( TEMP_PATH )
+#!/usr/bin/python2
+
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
from Exceptions import *
import utils
+#!/usr/bin/python2
+
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
import os, sys
import string
ROOT_SIZE the size of the root logical volume
SWAP_SIZE the size of the swap partition
BOOT_CD_VERSION A tuple of the current bootcd version
-
- Sets the following variables:
- PARTITIONS diction of generic part. types (root/swap)
- and their associated devices.
- Current keys/values:
- root /dev/planetlab/root
- swap /dev/planetlab/swap
-
"""
log.write( "\n\nStep: Install: partitioning disks.\n" )
NODE_MODEL_OPTIONS= vars["NODE_MODEL_OPTIONS"]
+ PARTITIONS= vars["PARTITIONS"]
+ if PARTITIONS == None:
+ raise ValueError, "PARTITIONS"
+
except KeyError, var:
raise BootManagerException, "Missing variable in vars: %s\n" % var
except ValueError, var:
if BOOT_CD_VERSION[0] == 2:
compatibility.setup_partdisks_2x_cd( vars, log )
- import parted
-
- # define the basic partition paths
- PARTITIONS= {}
- PARTITIONS["root"]= "/dev/planetlab/root"
- PARTITIONS["swap"]= "/dev/planetlab/swap"
- PARTITIONS["vservers"]= "/dev/planetlab/vservers"
- # Linux 2.6 mounts LVM with device mapper
- PARTITIONS["mapper-root"]= "/dev/mapper/planetlab-root"
- PARTITIONS["mapper-swap"]= "/dev/mapper/planetlab-swap"
- PARTITIONS["mapper-vservers"]= "/dev/mapper/planetlab-vservers"
- vars["PARTITIONS"]= PARTITIONS
-
-
# disable swap if its on
utils.sysexec_noerr( "swapoff %s" % PARTITIONS["swap"], log )
# shutdown and remove any lvm groups/volumes
utils.sysexec_noerr( "vgscan", log )
utils.sysexec_noerr( "vgchange -ay", log )
- utils.sysexec_noerr( "lvremove -f /dev/planetlab/root", log )
- utils.sysexec_noerr( "lvremove -f /dev/planetlab/swap", log )
- utils.sysexec_noerr( "lvremove -f /dev/planetlab/vservers", log )
+ utils.sysexec_noerr( "lvremove -f %s" % PARTITIONS["root"], log )
+ utils.sysexec_noerr( "lvremove -f %s" % PARTITIONS["swap"], log )
+ utils.sysexec_noerr( "lvremove -f %s" % PARTITIONS["vservers"], log )
utils.sysexec_noerr( "vgchange -an", log )
utils.sysexec_noerr( "vgremove planetlab", log )
utils.sysexec( "mkfs.ext2 -q %s -m %d -j %s" % (option,rbp,devname), log )
# save the list of block devices in the log
- log.write( "Block devices used (in lvm):\n" )
- log.write( repr(used_devices) + "\n" )
- log.write( "End of block devices used (in lvm).\n" )
+ log.write( "Block devices used (in lvm): %s\n" % repr(used_devices))
# list of block devices used may be updated
vars["INSTALL_BLOCK_DEVICES"]= used_devices
+#!/usr/bin/python2
+
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
import os
+#!/usr/bin/python2
+
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
import os, string
from Exceptions import *
import utils
-from systeminfo import systeminfo
+import systeminfo
import BootAPI
import ModelOptions
"""
Writes out the following configuration files for the node:
/etc/fstab
- /etc/hosts
- /etc/sysconfig/network-scripts/ifcfg-eth0
/etc/resolv.conf (if applicable)
- /etc/sysconfig/network
- /etc/modprobe.conf
/etc/ssh/ssh_host_key
/etc/ssh/ssh_host_rsa_key
/etc/ssh/ssh_host_dsa_key
except ValueError, var:
raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
- try:
- # we need to keys in PARTITIONS, root and swap, make sure
- # they exist
- val= PARTITIONS["root"]
- val= PARTITIONS["swap"]
- val= PARTITIONS["vservers"]
- val= PARTITIONS["mapper-root"]
- val= PARTITIONS["mapper-swap"]
- val= PARTITIONS["mapper-vservers"]
- except KeyError, part:
- log.write( "Missing partition in PARTITIONS: %s\n" % part )
- return 0
-
-
log.write( "Setting local time to UTC\n" )
utils.sysexec( "chroot %s ln -sf /usr/share/zoneinfo/UTC /etc/localtime" % \
SYSIMG_PATH, log )
-
log.write( "Enabling ntp at boot\n" )
utils.sysexec( "chroot %s chkconfig ntpd on" % SYSIMG_PATH, log )
log.write( "Unable to create directory\n" )
return 0
-
- log.write( "Writing network configuration\n" )
- write_network_configuration( vars, log )
-
- # write out the modprobe.conf file for the system. make sure
- # the order of the ethernet devices are listed in the same order
- # as the boot cd loaded the modules. this is found in /tmp/loadedmodules
- # ultimately, the order will only match the boot cd order if
- # the kernel modules have the same name - which should be true for the later
- # version boot cds because they use the same kernel version.
- # older boot cds use a 2.4.19 kernel, and its possible some of the network
- # module names have changed, in which case the system might not boot
- # if the network modules are activated in a different order that the
- # boot cd.
- log.write( "Writing /etc/modprobe.conf\n" )
- write_modprobeconf_file( vars, log )
-
- # dump the modprobe.conf file to the log (not to screen)
- log.write( "Contents of new modprobe.conf file:\n" )
- modulesconf_file= file("%s/etc/modprobe.conf" % SYSIMG_PATH, "r" )
- contents= modulesconf_file.read()
- log.write( contents + "\n" )
- modulesconf_file.close()
- modulesconf_file= None
- log.write( "End contents of new modprobe.conf file.\n" )
-
log.write( "Writing system /etc/fstab\n" )
fstab= file( "%s/etc/fstab" % SYSIMG_PATH, "w" )
fstab.write( "%s none swap sw 0 0\n" % \
rootdev= file( "%s/%s" % (SYSIMG_PATH,PARTITIONS["mapper-root"]), "w" )
rootdev.close()
- initrd, kernel_version= getKernelVersion(vars,log)
+ initrd, kernel_version= systeminfo.getKernelVersion(vars,log)
utils.removefile( "%s/boot/%s" % (SYSIMG_PATH, initrd) )
utils.sysexec( "chroot %s mkinitrd /boot/initrd-%s.img %s" % \
(SYSIMG_PATH, kernel_version, kernel_version), log )
utils.sysexec( "chmod 644 %s/%s.pub" % (SYSIMG_PATH,key_file), log )
return 1
-
-
-
-def write_network_configuration( vars, log ):
- """
- Write out the network configuration for this machine:
- /etc/hosts
- /etc/sysconfig/network-scripts/ifcfg-eth0
- /etc/resolv.conf (if applicable)
- /etc/sysconfig/network
-
- It is assumed the caller mounted the root partition and the vserver partition
- starting on SYSIMG_PATH - it is not checked here.
-
- The values to be used for the network settings are to be set in vars
- in the variable 'NETWORK_SETTINGS', which is a dictionary
- with keys:
-
- Key Used by this function
- -----------------------------------------------
- node_id
- node_key
- method x
- ip x
- mac x (optional)
- gateway x
- network x
- broadcast x
- netmask x
- dns1 x
- dns2 x (optional)
- hostname x
- domainname x
- """
-
- try:
- SYSIMG_PATH= vars["SYSIMG_PATH"]
- if SYSIMG_PATH == "":
- raise ValueError, "SYSIMG_PATH"
-
- 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
-
-
- try:
- network_settings= vars['NETWORK_SETTINGS']
- except KeyError, e:
- raise BootManagerException, "No network settings found in vars."
-
- try:
- hostname= network_settings['hostname']
- domainname= network_settings['domainname']
- method= network_settings['method']
- ip= network_settings['ip']
- gateway= network_settings['gateway']
- network= network_settings['network']
- netmask= network_settings['netmask']
- dns1= network_settings['dns1']
- mac= network_settings['mac']
- except KeyError, e:
- raise BootManagerException, "Missing value %s in network settings." % str(e)
-
- try:
- dns2= ''
- dns2= network_settings['dns2']
- except KeyError, e:
- pass
-
-
- log.write( "Writing /etc/hosts\n" )
- hosts_file= file("%s/etc/hosts" % SYSIMG_PATH, "w" )
- hosts_file.write( "127.0.0.1 localhost\n" )
- if method == "static":
- hosts_file.write( "%s %s.%s\n" % (ip, hostname, domainname) )
- hosts_file.close()
- hosts_file= None
-
-
- log.write( "Writing /etc/sysconfig/network-scripts/ifcfg-eth0\n" )
- eth0_file= file("%s/etc/sysconfig/network-scripts/ifcfg-eth0" %
- SYSIMG_PATH, "w" )
- eth0_file.write( "DEVICE=eth0\n" )
- if method == "static":
- eth0_file.write( "BOOTPROTO=static\n" )
- eth0_file.write( "IPADDR=%s\n" % ip )
- eth0_file.write( "NETMASK=%s\n" % netmask )
- eth0_file.write( "GATEWAY=%s\n" % gateway )
- else:
- eth0_file.write( "BOOTPROTO=dhcp\n" )
- eth0_file.write( "DHCP_HOSTNAME=%s\n" % hostname )
- if mac != "":
- eth0_file.write( "HWADDR=%s\n" % mac )
- eth0_file.write( "ONBOOT=yes\n" )
- eth0_file.write( "USERCTL=no\n" )
- eth0_file.close()
- eth0_file= None
-
- if method == "static":
- log.write( "Writing /etc/resolv.conf\n" )
- resolv_file= file("%s/etc/resolv.conf" % SYSIMG_PATH, "w" )
- if dns1 != "":
- resolv_file.write( "nameserver %s\n" % dns1 )
- if dns2 != "":
- resolv_file.write( "nameserver %s\n" % dns2 )
- resolv_file.write( "search %s\n" % domainname )
- resolv_file.close()
- resolv_file= None
-
- log.write( "Writing /etc/sysconfig/network\n" )
- network_file= file("%s/etc/sysconfig/network" % SYSIMG_PATH, "w" )
- network_file.write( "NETWORKING=yes\n" )
- network_file.write( "HOSTNAME=%s.%s\n" % (hostname, domainname) )
- if method == "static":
- network_file.write( "GATEWAY=%s\n" % gateway )
- network_file.close()
- network_file= None
-
-
-
-def write_modprobeconf_file( vars, log, filename = "/etc/modprobe.conf"):
- """
- write out the system file /etc/modprobe.conf with the current
- set of modules.
-
- returns a tuple of the number of network driver lines and storage
- driver lines written as (networkcount,storagecount)
- """
-
- # make sure we have this class loaded
- from systeminfo import systeminfo
-
- try:
- SYSIMG_PATH= vars["SYSIMG_PATH"]
- if SYSIMG_PATH == "":
- raise ValueError, "SYSIMG_PATH"
-
- 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
-
- initrd, kernel_version= getKernelVersion(vars,log)
- sysinfo= systeminfo()
- sysmods= sysinfo.get_system_modules(SYSIMG_PATH, kernel_version)
- if sysmods is None:
- raise BootManagerException, "Unable to get list of system modules."
-
- eth_count= 0
- scsi_count= 0
-
- modulesconf_file= file("%s/%s" % (SYSIMG_PATH,filename), "w" )
-
- for type in sysmods:
- if type == sysinfo.MODULE_CLASS_SCSI:
- for a_mod in sysmods[type]:
- if scsi_count == 0:
- modulesconf_file.write( "alias scsi_hostadapter %s\n" %
- a_mod )
- else:
- modulesconf_file.write( "alias scsi_hostadapter%d %s\n" %
- (scsi_count,a_mod) )
- scsi_count= scsi_count + 1
-
- elif type == sysinfo.MODULE_CLASS_NETWORK:
- for a_mod in sysmods[type]:
- modulesconf_file.write( "alias eth%d %s\n" %
- (eth_count,a_mod) )
- eth_count= eth_count + 1
-
- modulesconf_file.close()
- modulesconf_file= None
-
- return (eth_count,scsi_count)
-
-def getKernelVersion( vars, log):
- # make sure we have the variables we need
- try:
- SYSIMG_PATH= vars["SYSIMG_PATH"]
- if SYSIMG_PATH == "":
- raise ValueError, "SYSIMG_PATH"
-
- NODE_MODEL_OPTIONS=vars["NODE_MODEL_OPTIONS"]
- 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
-
- option = ''
- if NODE_MODEL_OPTIONS & ModelOptions.SMP:
- option = 'smp'
- try:
- os.stat("%s/boot/kernel-boot%s" % (SYSIMG_PATH,option))
- os.stat("%s/boot/initrd-boot%s" % (SYSIMG_PATH,option))
- except OSError, e:
- # smp kernel is not there; remove option from modeloptions
- # such that the rest of the code base thinks we are just
- # using the base kernel.
- NODE_MODEL_OPTIONS = NODE_MODEL_OPTIONS & ~ModelOptions.SMP
- vars["NODE_MODEL_OPTIONS"] = NODE_MODEL_OPTIONS
- log.write( "WARNING: Couldn't locate smp kernel.\n")
- option = ''
- initrd= os.readlink( "%s/boot/initrd-boot%s" % (SYSIMG_PATH,option) )
- kernel_version= initrd.replace("initrd-", "").replace(".img", "")
- return (initrd, kernel_version)
+#!/usr/bin/python2
+
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
import sys, os, traceback
import string
from Exceptions import *
import BootServerRequest
import BootAPI
-import StartDebug
import notify_messages
import UpdateBootStateWithPLC
if not hostname_resolve_ok:
log.write( "Hostname does not resolve correctly, will not continue.\n" )
- StartDebug.Run( vars, log )
-
if can_make_api_call:
log.write( "Notifying contacts of problem.\n" )
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
+
from Exceptions import *
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
import os
from Exceptions import *
+#!/usr/bin/python2 -u
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
from Exceptions import *
import BootAPI
import notify_messages
log.write( "Successfully updated boot state for this node at PLC\n" )
- if "STATE_CHANGE_NOTIFY" in vars.keys():
- if vars["STATE_CHANGE_NOTIFY"] == 1:
- message= vars['STATE_CHANGE_NOTIFY_MESSAGE']
- include_pis= 0
- include_techs= 1
- include_support= 0
-
- sent= 0
- try:
- sent= BootAPI.call_api_function( vars, "BootNotifyOwners",
- (message,
- include_pis,
- include_techs,
- include_support) )
- except BootManagerException, e:
- log.write( "Call to BootNotifyOwners failed: %s.\n" % e )
-
- if sent == 0:
- log.write( "Unable to notify site contacts of state change.\n" )
-
+ notify = vars.get("STATE_CHANGE_NOTIFY",0)
+
+ if notify:
+ message= vars['STATE_CHANGE_NOTIFY_MESSAGE']
+ include_pis= 0
+ include_techs= 1
+ include_support= 0
+
+ sent= 0
+ try:
+ sent= BootAPI.call_api_function( vars, "BootNotifyOwners",
+ (message,
+ include_pis,
+ include_techs,
+ include_support) )
+ except BootManagerException, e:
+ log.write( "Call to BootNotifyOwners failed: %s.\n" % e )
+
+ if sent == 0:
+ log.write( "Unable to notify site contacts of state change.\n" )
+
return 1
+#!/usr/bin/python2 -u
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
+
import os
-import InstallWriteConfig
import InstallBuildVServer
from Exceptions import *
import utils
if not ROOT_MOUNTED:
raise BootManagerException, "Root isn't mounted on SYSIMG_PATH\n"
-
- log.write( "Updating node network configuration\n" )
- InstallWriteConfig.write_network_configuration( vars, log )
-
-
log.write( "Updating vserver's /etc/hosts and /etc/resolv.conf files\n" )
# create a list of the full directory paths of all the vserver images that
+#!/usr/bin/python2 -u
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
import os
from Exceptions import *
import utils
-from systeminfo import systeminfo
+import systeminfo
import compatibility
import ModelOptions
NODE_MODEL_OPTIONS= vars["NODE_MODEL_OPTIONS"]
+ PARTITIONS= vars["PARTITIONS"]
+ if PARTITIONS == None:
+ raise ValueError, "PARTITIONS"
+
except KeyError, var:
raise BootManagerException, "Missing variable in vars: %s\n" % var
except ValueError, var:
# simply creating an instance of this class and listing the system
# block devices will make them show up so vgscan can find the planetlab
# volume group
- systeminfo().get_block_device_list()
+ systeminfo.get_block_device_list(vars, log)
try:
utils.sysexec( "vgscan", log )
utils.makedirs( SYSIMG_PATH )
try:
- utils.sysexec( "mount /dev/planetlab/root %s" % SYSIMG_PATH, log )
- utils.sysexec( "mount /dev/planetlab/vservers %s/vservers" %
- SYSIMG_PATH, log )
+ utils.sysexec("mount %s %s" % (PARTITIONS["root"],SYSIMG_PATH),log)
+ utils.sysexec("mount %s %s/vservers" % \
+ (PARTITIONS["vservers"], SYSIMG_PATH), log)
utils.sysexec( "mount -t proc none %s/proc" % SYSIMG_PATH, log )
except BootManagerException, e:
log.write( "BootManagerException during vgscan/vgchange: %s\n" %
+#!/usr/bin/python2
+
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+
+
"""
This directory contains individual step classes
"""
"InstallNodeInit",
"InstallPartitionDisks",
"InstallUninitHardware",
- "InstallWriteConfig"]
+ "InstallWriteConfig",
+ "WriteNetworkConfig",
+ "WriteModprobeConfig"]
#!/usr/bin/python2
-# --------------
-# THIS file used to be named 'blockdevicescan.py', but has been renamed
-# systeminfo.py and made more generic (now includes info about memory,
-# and other hardware info on the machine)
-# --------------
-
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
-# expected /proc/partitions format
-#
#----------------------------------------------------
#major minor #blocks name
#
import string
+import sys
import os
import popen2
import merge_hw_tables
import re
+import errno
+import ModelOptions
+from Exceptions import *
hwdatapath = "usr/share/hwdata"
-class systeminfo:
- """
- a utility class for finding and returning information about
- block devices, memory, and other hardware on the system
- """
-
- PROC_MEMINFO_PATH= "/proc/meminfo"
+"""
+a utility class for finding and returning information about
+block devices, memory, and other hardware on the system
+"""
+PROC_MEMINFO_PATH= "/proc/meminfo"
+PROC_PARTITIONS_PATH= "/proc/partitions"
- PROC_PARTITIONS_PATH= "/proc/partitions"
+# set when the sfdisk -l <dev> trick has been done to make
+# all devices show up
+DEVICES_SCANNED_FLAG= "/tmp/devices_scanned"
- # set when the sfdisk -l <dev> trick has been done to make
- # all devices show up
- DEVICES_SCANNED_FLAG= "/tmp/devices_scanned"
-
- # a /proc/partitions block is 1024 bytes
- # a GB to a HDD manufacturer is 10^9 bytes
- BLOCKS_PER_GB = pow(10, 9) / 1024.0;
-
-
- # -n is numeric ids (no lookup), -m is machine readable
- LSPCI_CMD= "/sbin/lspci -nm"
-
- MODULE_CLASS_NETWORK= "network"
- MODULE_CLASS_SCSI= "scsi"
-
- PCI_CLASS_NETWORK_ETHERNET=0x0200L
- PCI_CLASS_STORAGE_SCSI=0x0100L
- PCI_CLASS_STORAGE_IDE=0x0101L
- PCI_CLASS_STORAGE_FLOPPY=0x0102L
- PCI_CLASS_STORAGE_IPI=0x0103L
- PCI_CLASS_STORAGE_RAID=0x0104L
- PCI_CLASS_STORAGE_OTHER=0x0180L
-
- PCI_ANY=0xffffffffL
-
- def get_total_phsyical_mem(self):
- """
- return the total physical memory of the machine, in kilobytes.
-
- Return None if /proc/meminfo not readable.
- """
-
- try:
- meminfo_file= file(self.PROC_MEMINFO_PATH,"r")
- except IOError, e:
- return
+# a /proc/partitions block is 1024 bytes
+# a GB to a HDD manufacturer is 10^9 bytes
+BLOCKS_PER_GB = pow(10, 9) / 1024.0;
- total_memory= None
-
- for line in meminfo_file:
- try:
- (fieldname,value)= string.split(line,":")
- except ValueError, e:
- # this will happen for lines that don't have two values
- # (like the first line on 2.4 kernels)
- continue
+# -n is numeric ids (no lookup), -m is machine readable
+LSPCI_CMD= "/sbin/lspci -nm"
- fieldname= string.strip(fieldname)
- value= string.strip(value)
-
- if fieldname == "MemTotal":
- try:
- (total_memory,units)= string.split(value)
- except ValueError, e:
- return
-
- if total_memory == "" or total_memory == None or \
- units == "" or units == None:
- return
+MODULE_CLASS_NETWORK= "network"
+MODULE_CLASS_SCSI= "scsi"
- if string.lower(units) != "kb":
- return
+PCI_CLASS_NETWORK_ETHERNET=0x0200L
+PCI_CLASS_STORAGE_SCSI=0x0100L
+PCI_CLASS_STORAGE_IDE=0x0101L
+PCI_CLASS_STORAGE_FLOPPY=0x0102L
+PCI_CLASS_STORAGE_IPI=0x0103L
+PCI_CLASS_STORAGE_RAID=0x0104L
+PCI_CLASS_STORAGE_OTHER=0x0180L
- try:
- total_memory= int(total_memory)
- except ValueError, e:
- return
+PCI_ANY=0xffffffffL
- break
+def get_total_phsyical_mem(vars = {}, log = sys.stderr):
+ """
+ return the total physical memory of the machine, in kilobytes.
- meminfo_file.close()
+ Return None if /proc/meminfo not readable.
+ """
- return total_memory
+ try:
+ meminfo_file= file(PROC_MEMINFO_PATH,"r")
+ except IOError, e:
+ return
+ total_memory= None
+ for line in meminfo_file:
- def get_block_device_list(self):
- """
- get a list of block devices from this system.
- return an associative array, where the device name
- (full /dev/device path) is the key, and the value
- is a tuple of (major,minor,numblocks,gb_size,readonly)
- """
+ try:
+ (fieldname,value)= string.split(line,":")
+ except ValueError, e:
+ # this will happen for lines that don't have two values
+ # (like the first line on 2.4 kernels)
+ continue
+
+ fieldname= string.strip(fieldname)
+ value= string.strip(value)
- # make sure we can access to the files/directories in /proc
- if not os.access(self.PROC_PARTITIONS_PATH, os.F_OK):
- return None
+ if fieldname == "MemTotal":
+ try:
+ (total_memory,units)= string.split(value)
+ except ValueError, e:
+ return
+ if total_memory == "" or total_memory == None or \
+ units == "" or units == None:
+ return
- # only do this once every system boot
- if not os.access(self.DEVICES_SCANNED_FLAG, os.R_OK):
-
- # this is ugly. under devfs, device
- # entries in /dev/scsi/.. and /dev/ide/...
- # don't show up until you attempt to read
- # from the associated device at /dev (/dev/sda).
- # so, lets run sfdisk -l (list partitions) against
- # most possible block devices, that way they show
- # up when it comes time to do the install.
- for dev_prefix in ('sd','hd'):
- block_dev_num= 0
- while block_dev_num < 10:
- if block_dev_num < 26:
- devicename= "/dev/%s%c" % \
- (dev_prefix, chr(ord('a')+block_dev_num))
- else:
- devicename= "/dev/%s%c%c" % \
- ( dev_prefix,
- chr(ord('a')+((block_dev_num/26)-1)),
- chr(ord('a')+(block_dev_num%26)) )
-
- os.system( "sfdisk -l %s > /dev/null 2>&1" % devicename )
- block_dev_num = block_dev_num + 1
-
- additional_scan_devices= ("/dev/cciss/c0d0p", "/dev/cciss/c0d1p",
- "/dev/cciss/c0d2p", "/dev/cciss/c0d3p",
- "/dev/cciss/c0d4p", "/dev/cciss/c0d5p",
- "/dev/cciss/c0d6p", "/dev/cciss/c0d7p",
- "/dev/cciss/c1d0p", "/dev/cciss/c1d1p",
- "/dev/cciss/c1d2p", "/dev/cciss/c1d3p",
- "/dev/cciss/c1d4p", "/dev/cciss/c1d5p",
- "/dev/cciss/c1d6p", "/dev/cciss/c1d7p",)
-
- for devicename in additional_scan_devices:
- os.system( "sfdisk -l %s > /dev/null 2>&1" % devicename )
+ if string.lower(units) != "kb":
+ return
- os.system( "touch %s" % self.DEVICES_SCANNED_FLAG )
-
+ try:
+ total_memory= int(total_memory)
+ except ValueError, e:
+ return
- devicelist= {}
+ break
- partitions_file= file(self.PROC_PARTITIONS_PATH,"r")
- line_count= 0
-
- for line in partitions_file:
- line_count= line_count + 1
+ meminfo_file.close()
+ return total_memory
- # skip the first two lines always
- if line_count < 2:
- continue
+def get_block_device_list(vars = {}, log = sys.stderr):
+ """
+ get a list of block devices from this system.
+ return an associative array, where the device name
+ (full /dev/device path) is the key, and the value
+ is a tuple of (major,minor,numblocks,gb_size,readonly)
+ """
- parts= string.split(line)
+ # make sure we can access to the files/directories in /proc
+ if not os.access(PROC_PARTITIONS_PATH, os.F_OK):
+ return None
+
+ # table with valid scsi/sata/ide/raid block device names
+ valid_blk_names = {}
+ # add in valid sd and hd block device names
+ for blk_prefix in ('sd','hd'):
+ for blk_num in map ( \
+ lambda x: chr(x), range(ord('a'),ord('z')+1)):
+ devicename="%s%c" % (blk_prefix, blk_num)
+ valid_blk_names[devicename]=None
+
+ # add in valid scsi raid block device names
+ for M in range(0,1+1):
+ for N in range(0,7+1):
+ devicename = "cciss/c%dd%d" % (M,N)
+ valid_blk_names[devicename]=None
+
+ # only do this once every system boot
+ if not os.access(DEVICES_SCANNED_FLAG, os.R_OK):
+
+ # this is ugly. under devfs, device
+ # entries in /dev/scsi/.. and /dev/ide/...
+ # don't show up until you attempt to read
+ # from the associated device at /dev (/dev/sda).
+ # so, lets run sfdisk -l (list partitions) against
+ # most possible block devices, that way they show
+ # up when it comes time to do the install.
+ devicenames = valid_blk_names.keys()
+ devicenames.sort()
+ for devicename in devicenames:
+ os.system( "sfdisk -l /dev/%s > /dev/null 2>&1" % devicename )
+
+ # touch file
+ fb = open(DEVICES_SCANNED_FLAG,"w")
+ fb.close()
+
+ devicelist= {}
+
+ partitions_file= file(PROC_PARTITIONS_PATH,"r")
+ line_count= 0
+ for line in partitions_file:
+ line_count= line_count + 1
+
+ # skip the first two lines always
+ if line_count < 2:
+ continue
+
+ parts= string.split(line)
+
+ if len(parts) < 4:
+ continue
+
+ device= parts[3]
+
+ # skip and ignore any partitions
+ if not valid_blk_names.has_key(device):
+ continue
- if len(parts) < 4:
- continue
-
- device= parts[3]
+ try:
+ major= int(parts[0])
+ minor= int(parts[1])
+ blocks= int(parts[2])
+ except ValueError, err:
+ continue
- dev_name= "/dev/%s" % device
-
- try:
- major= int(parts[0])
- minor= int(parts[1])
- blocks= int(parts[2])
- except ValueError, err:
- continue
-
- # skip and ignore any partitions
- if minor != 0:
- continue
-
- gb_size= blocks/self.BLOCKS_PER_GB
-
- # parse the output of hdparm <disk> to get the readonly flag;
- # if this fails, assume it isn't read only
- readonly= 0
-
- hdparm_cmd = popen2.Popen3("hdparm %s 2> /dev/null" % dev_name)
- status= hdparm_cmd.wait()
-
- if os.WIFEXITED(status) and os.WEXITSTATUS(status) == 0:
- try:
- hdparm_output= hdparm_cmd.fromchild.read()
- hdparm_cmd= None
-
- # parse the output of hdparm, the lines we are interested
- # in look
- # like:
- #
- # readonly = 0 (off)
- #
-
- for line in string.split(hdparm_output,"\n"):
-
- line= string.strip(line)
- if line == "":
- continue
-
- line_parts= string.split(line,"=")
- if len(line_parts) < 2:
- continue
-
- name= string.strip(line_parts[0])
-
- if name == "readonly":
- value= string.strip(line_parts[1])
- if len(value) == 0:
- break
-
- if value[0] == "1":
- readonly= 1
- break
-
- except IOError:
- pass
-
- devicelist[dev_name]= (major,minor,blocks,gb_size,readonly)
+ gb_size= blocks/BLOCKS_PER_GB
-
- return devicelist
+ # check to see if the blk device is readonly
+ try:
+ # can we write to it?
+ dev_name= "/dev/%s" % device
+ fb = open(dev_name,"w")
+ fb.close()
+ readonly=False
+ except IOError, e:
+ # check if EROFS errno
+ if errno.errorcode.get(e.errno,None) == 'EROFS':
+ readonly=True
+ else:
+ # got some other errno, pretend device is readonly
+ readonly=True
+ devicelist[dev_name]= (major,minor,blocks,gb_size,readonly)
+ return devicelist
- def get_system_modules( self, install_root, kernel_version= None ):
- """
- Return a list of kernel modules that this system requires.
- This requires access to the installed system's root
- directory, as the following files must exist and are used:
- <install_root>/usr/share/hwdata/pcitable
- <install_root>/lib/modules/(first entry if kernel_version unspecified)/modules.pcimap
- <install_root>/lib/modules/(first entry if kernel version unspecified)/modules.dep
- If there are more than one kernels installed, and the kernel
- version is not specified, then only the first one in
- /lib/modules is used.
+def get_system_modules( vars = {}, log = sys.stderr):
+ """
+ Return a list of kernel modules that this system requires.
+ This requires access to the installed system's root
+ directory, as the following files must exist and are used:
+ <install_root>/usr/share/hwdata/pcitable
+ <install_root>/lib/modules/(first entry if kernel_version unspecified)/modules.pcimap
+ <install_root>/lib/modules/(first entry if kernel version unspecified)/modules.dep
+
+ If there are more than one kernels installed, and the kernel
+ version is not specified, then only the first one in
+ /lib/modules is used.
+
+ Returns a dictionary, keys being the type of module:
+ - scsi MODULE_CLASS_SCSI
+ - network MODULE_CLASS_NETWORK
+ The value being the kernel module name to load.
+
+ Some sata devices show up under an IDE device class,
+ hence the reason for checking for ide devices as well.
+ If there actually is a match in the pci -> module lookup
+ table, and its an ide device, its most likely sata,
+ as ide modules are built in to the kernel.
+ """
- Returns a dictionary, keys being the type of module:
- - scsi MODULE_CLASS_SCSI
- - network MODULE_CLASS_NETWORK
- The value being the kernel module name to load.
+ if not vars.has_key("SYSIMG_PATH"):
+ vars["SYSIMG_PATH"]="/"
+ SYSIMG_PATH=vars["SYSIMG_PATH"]
- Some sata devices show up under an IDE device class,
- hence the reason for checking for ide devices as well.
- If there actually is a match in the pci -> module lookup
- table, and its an ide device, its most likely sata,
- as ide modules are built in to the kernel.
- """
+ if not vars.has_key("NODE_MODEL_OPTIONS"):
+ vars["NODE_MODEL_OPTIONS"] = 0;
- # get the kernel version we are assuming
- if kernel_version is None:
- try:
- kernel_version= os.listdir( "%s/lib/modules/" % install_root )
- except OSError, e:
- return
+ initrd, kernel_version = getKernelVersion(vars, log)
- if len(kernel_version) == 0:
- return
+ # get the kernel version we are assuming
+ if kernel_version is None:
+ try:
+ kernel_version= os.listdir( "%s/lib/modules/" % SYSIMG_PATH )
+ except OSError, e:
+ return
- if len(kernel_version) > 1:
- print( "WARNING: We may be returning modules for the wrong kernel." )
+ if len(kernel_version) == 0:
+ return
- kernel_version= kernel_version[0]
+ if len(kernel_version) > 1:
+ print( "WARNING: We may be returning modules for the wrong kernel." )
- print( "Using kernel version %s" % kernel_version )
+ kernel_version= kernel_version[0]
- # test to make sure the three files we need are present
- pcitable_path = "%s/%s/pcitable" % (install_root,hwdatapath)
- modules_pcimap_path = "%s/lib/modules/%s/modules.pcimap" % \
- (install_root,kernel_version)
- modules_dep_path = "%s/lib/modules/%s/modules.dep" % \
- (install_root,kernel_version)
+ print( "Using kernel version %s" % kernel_version )
- for path in (pcitable_path,modules_pcimap_path,modules_dep_path):
- if not os.access(path,os.R_OK):
- print( "Unable to read %s" % path )
- return
+ # test to make sure the three files we need are present
+ pcitable_path = "%s/%s/pcitable" % (SYSIMG_PATH,hwdatapath)
+ modules_pcimap_path = "%s/lib/modules/%s/modules.pcimap" % \
+ (SYSIMG_PATH,kernel_version)
+ modules_dep_path = "%s/lib/modules/%s/modules.dep" % \
+ (SYSIMG_PATH,kernel_version)
- # now, with those three files, merge them all into one easy to
- # use lookup table
- (all_pci_ids, all_modules) = merge_hw_tables.merge_files( modules_dep_path,
- modules_pcimap_path,
- pcitable_path )
- if all_modules is None:
- print( "Unable to merge pci id tables." )
+ for path in (pcitable_path,modules_pcimap_path,modules_dep_path):
+ if not os.access(path,os.R_OK):
+ print( "Unable to read %s" % path )
return
- # this is the actual data structure we return
- system_mods= {}
+ # now, with those three files, merge them all into one easy to
+ # use lookup table
+ (all_pci_ids, all_modules) = merge_hw_tables.merge_files( modules_dep_path,
+ modules_pcimap_path,
+ pcitable_path )
+ if all_modules is None:
+ print( "Unable to merge pci id tables." )
+ return
+
+ # this is the actual data structure we return
+ system_mods= {}
+
+ # these are the lists that will be in system_mods
+ network_mods= []
+ scsi_mods= []
+
+
+ # get all the system devices from lspci
+ lspci_prog= popen2.Popen3( LSPCI_CMD, 1 )
+ if lspci_prog is None:
+ print( "Unable to run %s with popen2.Popen3" % LSPCI_CMD )
+ return
+
+ returncode= lspci_prog.wait()
+ if returncode != 0:
+ print( "Running %s failed" % LSPCI_CMD )
+ return
+ else:
+ print( "Successfully ran %s" % LSPCI_CMD )
+
+ # for every lspci line, parse in the four tuple PCI id and the
+ # search for the corresponding driver from the dictionary
+ # generated by merge_hw_tables
+ for line in lspci_prog.fromchild:
+ # A sample line:
+ #
+ # 00:1f.1 "Class 0101" "8086" "2411" -r02 -p80 "8086" "2411"
+ #
+ # Remove '"', 'Class ', and anything beginning with '-'
+ # (usually revisions and prog-if flags) so that we can
+ # split on whitespace:
+ #
+ # 00:1f.1 0101 8086 2411 8086 2411
+ #
+ line = line.strip()
+ line = line.replace('"', '')
+ line = line.replace('Class ', '')
+ line = re.sub('-[^ ]*', '', line)
+
+ parts = line.split()
+ try:
+ if len(parts) < 4:
+ raise
+ classid = long(parts[1], 16)
+ vendorid = long(parts[2], 16)
+ deviceid = long(parts[3], 16)
+ except:
+ print "Invalid line:", line
+ continue
+
+ if classid not in (PCI_CLASS_NETWORK_ETHERNET,
+ PCI_CLASS_STORAGE_SCSI,
+ PCI_CLASS_STORAGE_RAID,
+ PCI_CLASS_STORAGE_OTHER,
+ PCI_CLASS_STORAGE_IDE):
+ continue
+
+ # Device may have a subvendorid and subdeviceid
+ try:
+ subvendorid = long(parts[4], 16)
+ subdeviceid = long(parts[5], 16)
+ except:
+ subvendorid = PCI_ANY
+ subdeviceid = PCI_ANY
+
+ # search for driver that most closely matches the full_id
+ # to drivers that can handle any subvendor/subdevice
+ # version of the hardware.
+ full_ids = ((vendorid,deviceid,subvendorid,subdeviceid),
+ (vendorid,deviceid,subvendorid,PCI_ANY),
+ (vendorid,deviceid,PCI_ANY,PCI_ANY))
+
+ for full_id in full_ids:
+ module = all_pci_ids.get(full_id, None)
+ if module is not None:
+ if classid == PCI_CLASS_NETWORK_ETHERNET:
+ network_mods.append(module[0])
+ elif classid in (PCI_CLASS_STORAGE_SCSI,
+ PCI_CLASS_STORAGE_RAID,
+ PCI_CLASS_STORAGE_OTHER,
+ PCI_CLASS_STORAGE_IDE):
+ scsi_mods.append(module[0])
+ else:
+ print "not network or scsi: 0x%x" % classid
+ break
- # these are the lists that will be in system_mods
- network_mods= []
- scsi_mods= []
+ system_mods[MODULE_CLASS_SCSI]= scsi_mods
+ system_mods[MODULE_CLASS_NETWORK]= network_mods
+ return system_mods
- # get all the system devices from lspci
- lspci_prog= popen2.Popen3( self.LSPCI_CMD, 1 )
- if lspci_prog is None:
- print( "Unable to run %s with popen2.Popen3" % self.LSPCI_CMD )
- return
-
- returncode= lspci_prog.wait()
- if returncode != 0:
- print( "Running %s failed" % self.LSPCI_CMD )
- return
- else:
- print( "Successfully ran %s" % self.LSPCI_CMD )
-
- # for every lspci line, parse in the four tuple PCI id and the
- # search for the corresponding driver from the dictionary
- # generated by merge_hw_tables
- for line in lspci_prog.fromchild:
- # A sample line:
- #
- # 00:1f.1 "Class 0101" "8086" "2411" -r02 -p80 "8086" "2411"
- #
- # Remove '"', 'Class ', and anything beginning with '-'
- # (usually revisions and prog-if flags) so that we can
- # split on whitespace:
- #
- # 00:1f.1 0101 8086 2411 8086 2411
- #
- line = line.strip()
- line = line.replace('"', '')
- line = line.replace('Class ', '')
- line = re.sub('-[^ ]*', '', line)
-
- parts = line.split()
- try:
- if len(parts) < 4:
- raise
- classid = long(parts[1], 16)
- vendorid = long(parts[2], 16)
- deviceid = long(parts[3], 16)
- except:
- print "Invalid line:", line
- continue
-
- if classid not in (self.PCI_CLASS_NETWORK_ETHERNET,
- self.PCI_CLASS_STORAGE_SCSI,
- self.PCI_CLASS_STORAGE_RAID,
- self.PCI_CLASS_STORAGE_OTHER,
- self.PCI_CLASS_STORAGE_IDE):
- continue
-
- # Device may have a subvendorid and subdeviceid
- try:
- subvendorid = long(parts[4], 16)
- subdeviceid = long(parts[5], 16)
- except:
- subvendorid = self.PCI_ANY
- subdeviceid = self.PCI_ANY
-
- # search for driver that most closely matches the full_id
- # to drivers that can handle any subvendor/subdevice
- # version of the hardware.
- full_ids = ((vendorid,deviceid,subvendorid,subdeviceid),
- (vendorid,deviceid,subvendorid,self.PCI_ANY),
- (vendorid,deviceid,self.PCI_ANY,self.PCI_ANY))
-
- for full_id in full_ids:
- module = all_pci_ids.get(full_id, None)
- if module is not None:
- if classid == self.PCI_CLASS_NETWORK_ETHERNET:
- network_mods.append(module[0])
- elif classid in (self.PCI_CLASS_STORAGE_SCSI,
- self.PCI_CLASS_STORAGE_RAID,
- self.PCI_CLASS_STORAGE_OTHER,
- self.PCI_CLASS_STORAGE_IDE):
- scsi_mods.append(module[0])
- else:
- print "not network or scsi: 0x%x" % classid
- break
-
- system_mods[self.MODULE_CLASS_SCSI]= scsi_mods
- system_mods[self.MODULE_CLASS_NETWORK]= network_mods
-
- return system_mods
+def getKernelVersion( vars = {} , log = sys.stderr):
+ # make sure we have the variables we need
+ try:
+ SYSIMG_PATH= vars["SYSIMG_PATH"]
+ if SYSIMG_PATH == "":
+ raise ValueError, "SYSIMG_PATH"
- def remove_quotes( self, str ):
- """
- remove double quotes off of a string if they exist
- """
- if str == "" or str == None:
- return str
- if str[:1] == '"':
- str= str[1:]
- if str[len(str)-1] == '"':
- str= str[:len(str)-1]
- return str
+ NODE_MODEL_OPTIONS=vars["NODE_MODEL_OPTIONS"]
+ 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
+ option = ''
+ if NODE_MODEL_OPTIONS & ModelOptions.SMP:
+ option = 'smp'
+ try:
+ os.stat("%s/boot/kernel-boot%s" % (SYSIMG_PATH,option))
+ os.stat("%s/boot/initrd-boot%s" % (SYSIMG_PATH,option))
+ except OSError, e:
+ # smp kernel is not there; remove option from modeloptions
+ # such that the rest of the code base thinks we are just
+ # using the base kernel.
+ NODE_MODEL_OPTIONS = NODE_MODEL_OPTIONS & ~ModelOptions.SMP
+ vars["NODE_MODEL_OPTIONS"] = NODE_MODEL_OPTIONS
+ log.write( "WARNING: Couldn't locate smp kernel.\n")
+ option = ''
+ try:
+ initrd= os.readlink( "%s/boot/initrd-boot%s" % (SYSIMG_PATH,option) )
+ kernel_version= initrd.replace("initrd-", "").replace(".img", "")
+ except OSError, e:
+ initrd = None
+ kernel_version = None
+
+ return (initrd, kernel_version)
if __name__ == "__main__":
- info= systeminfo()
-
- devices= info.get_block_device_list()
+ devices= get_block_device_list()
print "block devices detected:"
if not devices:
print "no devices found!"
print ""
- memory= info.get_total_phsyical_mem()
+ memory= get_total_phsyical_mem()
if not memory:
print "unable to read /proc/meminfo for memory"
else:
print ""
- import sys
kernel_version = None
if len(sys.argv) > 2:
kernel_version = sys.argv[1]
- modules= info.get_system_modules("/",kernel_version)
+ modules= get_system_modules()
if not modules:
print "unable to list system modules"
else:
for type in modules:
- if type == info.MODULE_CLASS_SCSI:
+ if type == MODULE_CLASS_SCSI:
print( "all scsi modules:" )
for a_mod in modules[type]:
print a_mod
- elif type == info.MODULE_CLASS_NETWORK:
+ elif type == MODULE_CLASS_NETWORK:
print( "all network modules:" )
for a_mod in modules[type]:
print a_mod
+#!/usr/bin/python2
+
# Copyright (c) 2003 Intel Corporation
# All rights reserved.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-
-# * Neither the name of the Intel Corporation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
-# YOUR JURISDICTION. It is licensee's responsibility to comply with any
-# export regulations applicable in licensee's jurisdiction. Under
-# CURRENT (May 2000) U.S. export regulations this software is eligible
-# for export from the U.S. and can be downloaded by or otherwise
-# exported or reexported worldwide EXCEPT to U.S. embargoed destinations
-# which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
-# Afghanistan and any other country to which the U.S. has embargoed
-# goods and services.
-
+#
+# Copyright (c) 2004-2006 The Trustees of Princeton University
+# All rights reserved.
+# expected /proc/partitions format
import os, sys, shutil
import popen2
+++ /dev/null
-Contains vgscan, vgchange and the lvm library.
-Just enough to load the root partion for booting
-a node after its installed
+++ /dev/null
-/usr/lib
-/lib
+++ /dev/null
-/lib/liblvm-10.so
-/lib/liblvm-10.so.1
-/lib/liblvm-10.so.1.0
-/sbin/vgchange
-/sbin/vgscan
-/sbin/vgmknodes
-/sbin/vgextend
-/sbin/lvextend
-/sbin/pvdisplay
+++ /dev/null
-#!/bin/sh
-
-# make sure the yum rpm is in extra-rpms/stage3rpms
-if [ ! -e extra-rpms/stage3rpms/yum-*planetlab.noarch.rpm ]; then
- echo "yum RPM doesn't exist in extra-rpms/stage3rpms/"
- echo "see extra-rpms/stage3rpms/README_EXTERNAL_RPMS."
- exit 1
-fi
-
-# make sure the pycurl rpm is in extra-rpms/stage3rpms
-if [ ! -e extra-rpms/stage3rpms/pycurl-*.i386.rpm ]; then
- echo "pycurl RPM doesn't exist in extra-rpms/stage3rpms/"
- echo "see extra-rpms/stage3rpms/README_EXTERNAL_RPMS."
- exit 1
-fi
-
-echo "Adding all extra rpms to extract directory..."
-cp -vr extra-rpms/* rpm-extract/
-
-for i in `ls extra-rpms/`; do
- echo $i >> keep-files
-done
-
-exit 0
-
+++ /dev/null
-Contains all the files necessary to run RPM
+++ /dev/null
-/usr/lib/libbz2.so.1
-/usr/lib/libbz2.so.1.0.2
+++ /dev/null
-/usr/lib/libelf-0.76.so
-/usr/lib/libelf.so.1
+++ /dev/null
-/etc/ld.so.conf
-/etc/localtime
-/etc/nsswitch.conf
-/etc/rpc
-/lib/ld-2.3.2.so
-/lib/ld-linux.so.2
-/lib/libBrokenLocale-2.3.2.so
-/lib/libBrokenLocale.so.1
-/lib/libSegFault.so
-/lib/libanl-2.3.2.so
-/lib/libanl.so.1
-/lib/libc-2.3.2.so
-/lib/libc.so.6
-/lib/libcrypt-2.3.2.so
-/lib/libcrypt.so.1
-/lib/libdl-2.3.2.so
-/lib/libdl.so.2
-/lib/libm-2.3.2.so
-/lib/libm.so.6
-/lib/libnsl-2.3.2.so
-/lib/libnsl.so.1
-/lib/libnss_compat-2.3.2.so
-/lib/libnss_compat.so.2
-/lib/libnss_dns-2.3.2.so
-/lib/libnss_dns.so.2
-/lib/libnss_files-2.3.2.so
-/lib/libnss_files.so.2
-/lib/libnss_hesiod-2.3.2.so
-/lib/libnss_hesiod.so.2
-/lib/libnss_nis-2.3.2.so
-/lib/libnss_nis.so.2
-/lib/libnss_nisplus-2.3.2.so
-/lib/libnss_nisplus.so.2
-/lib/libpthread-0.10.so
-/lib/libpthread.so.0
-/lib/libresolv-2.3.2.so
-/lib/libresolv.so.2
-/lib/librt-2.3.2.so
-/lib/librt.so.1
-/lib/libthread_db-1.0.so
-/lib/libthread_db.so.1
-/lib/libutil-2.3.2.so
-/lib/libutil.so.1
-/sbin/ldconfig
-/sbin/sln
-/usr/lib/gconv/ANSI_X3.110.so
-/usr/lib/gconv/ARMSCII-8.so
-/usr/lib/gconv/ASMO_449.so
-/usr/lib/gconv/BIG5.so
-/usr/lib/gconv/BIG5HKSCS.so
-/usr/lib/gconv/CP10007.so
-/usr/lib/gconv/CP1125.so
-/usr/lib/gconv/CP1250.so
-/usr/lib/gconv/CP1251.so
-/usr/lib/gconv/CP1252.so
-/usr/lib/gconv/CP1253.so
-/usr/lib/gconv/CP1254.so
-/usr/lib/gconv/CP1255.so
-/usr/lib/gconv/CP1256.so
-/usr/lib/gconv/CP1257.so
-/usr/lib/gconv/CP1258.so
-/usr/lib/gconv/CP737.so
-/usr/lib/gconv/CP775.so
-/usr/lib/gconv/CSN_369103.so
-/usr/lib/gconv/CWI.so
-/usr/lib/gconv/DEC-MCS.so
-/usr/lib/gconv/EBCDIC-AT-DE-A.so
-/usr/lib/gconv/EBCDIC-AT-DE.so
-/usr/lib/gconv/EBCDIC-CA-FR.so
-/usr/lib/gconv/EBCDIC-DK-NO-A.so
-/usr/lib/gconv/EBCDIC-DK-NO.so
-/usr/lib/gconv/EBCDIC-ES-A.so
-/usr/lib/gconv/EBCDIC-ES-S.so
-/usr/lib/gconv/EBCDIC-ES.so
-/usr/lib/gconv/EBCDIC-FI-SE-A.so
-/usr/lib/gconv/EBCDIC-FI-SE.so
-/usr/lib/gconv/EBCDIC-FR.so
-/usr/lib/gconv/EBCDIC-IS-FRISS.so
-/usr/lib/gconv/EBCDIC-IT.so
-/usr/lib/gconv/EBCDIC-PT.so
-/usr/lib/gconv/EBCDIC-UK.so
-/usr/lib/gconv/EBCDIC-US.so
-/usr/lib/gconv/ECMA-CYRILLIC.so
-/usr/lib/gconv/EUC-CN.so
-/usr/lib/gconv/EUC-JISX0213.so
-/usr/lib/gconv/EUC-JP.so
-/usr/lib/gconv/EUC-KR.so
-/usr/lib/gconv/EUC-TW.so
-/usr/lib/gconv/GB18030.so
-/usr/lib/gconv/GBBIG5.so
-/usr/lib/gconv/GBGBK.so
-/usr/lib/gconv/GBK.so
-/usr/lib/gconv/GEORGIAN-ACADEMY.so
-/usr/lib/gconv/GEORGIAN-PS.so
-/usr/lib/gconv/GOST_19768-74.so
-/usr/lib/gconv/GREEK-CCITT.so
-/usr/lib/gconv/GREEK7-OLD.so
-/usr/lib/gconv/GREEK7.so
-/usr/lib/gconv/HP-ROMAN8.so
-/usr/lib/gconv/IBM037.so
-/usr/lib/gconv/IBM038.so
-/usr/lib/gconv/IBM1004.so
-/usr/lib/gconv/IBM1026.so
-/usr/lib/gconv/IBM1046.so
-/usr/lib/gconv/IBM1047.so
-/usr/lib/gconv/IBM1124.so
-/usr/lib/gconv/IBM1129.so
-/usr/lib/gconv/IBM1132.so
-/usr/lib/gconv/IBM1133.so
-/usr/lib/gconv/IBM1160.so
-/usr/lib/gconv/IBM1161.so
-/usr/lib/gconv/IBM1162.so
-/usr/lib/gconv/IBM1163.so
-/usr/lib/gconv/IBM1164.so
-/usr/lib/gconv/IBM256.so
-/usr/lib/gconv/IBM273.so
-/usr/lib/gconv/IBM274.so
-/usr/lib/gconv/IBM275.so
-/usr/lib/gconv/IBM277.so
-/usr/lib/gconv/IBM278.so
-/usr/lib/gconv/IBM280.so
-/usr/lib/gconv/IBM281.so
-/usr/lib/gconv/IBM284.so
-/usr/lib/gconv/IBM285.so
-/usr/lib/gconv/IBM290.so
-/usr/lib/gconv/IBM297.so
-/usr/lib/gconv/IBM420.so
-/usr/lib/gconv/IBM423.so
-/usr/lib/gconv/IBM424.so
-/usr/lib/gconv/IBM437.so
-/usr/lib/gconv/IBM500.so
-/usr/lib/gconv/IBM850.so
-/usr/lib/gconv/IBM851.so
-/usr/lib/gconv/IBM852.so
-/usr/lib/gconv/IBM855.so
-/usr/lib/gconv/IBM856.so
-/usr/lib/gconv/IBM857.so
-/usr/lib/gconv/IBM860.so
-/usr/lib/gconv/IBM861.so
-/usr/lib/gconv/IBM862.so
-/usr/lib/gconv/IBM863.so
-/usr/lib/gconv/IBM864.so
-/usr/lib/gconv/IBM865.so
-/usr/lib/gconv/IBM866.so
-/usr/lib/gconv/IBM866NAV.so
-/usr/lib/gconv/IBM868.so
-/usr/lib/gconv/IBM869.so
-/usr/lib/gconv/IBM870.so
-/usr/lib/gconv/IBM871.so
-/usr/lib/gconv/IBM874.so
-/usr/lib/gconv/IBM875.so
-/usr/lib/gconv/IBM880.so
-/usr/lib/gconv/IBM891.so
-/usr/lib/gconv/IBM903.so
-/usr/lib/gconv/IBM904.so
-/usr/lib/gconv/IBM905.so
-/usr/lib/gconv/IBM918.so
-/usr/lib/gconv/IBM922.so
-/usr/lib/gconv/IBM930.so
-/usr/lib/gconv/IBM932.so
-/usr/lib/gconv/IBM933.so
-/usr/lib/gconv/IBM935.so
-/usr/lib/gconv/IBM937.so
-/usr/lib/gconv/IBM939.so
-/usr/lib/gconv/IBM943.so
-/usr/lib/gconv/IEC_P27-1.so
-/usr/lib/gconv/INIS-8.so
-/usr/lib/gconv/INIS-CYRILLIC.so
-/usr/lib/gconv/INIS.so
-/usr/lib/gconv/ISIRI-3342.so
-/usr/lib/gconv/ISO-2022-CN-EXT.so
-/usr/lib/gconv/ISO-2022-CN.so
-/usr/lib/gconv/ISO-2022-JP-3.so
-/usr/lib/gconv/ISO-2022-JP.so
-/usr/lib/gconv/ISO-2022-KR.so
-/usr/lib/gconv/ISO-IR-197.so
-/usr/lib/gconv/ISO-IR-209.so
-/usr/lib/gconv/ISO646.so
-/usr/lib/gconv/ISO8859-1.so
-/usr/lib/gconv/ISO8859-10.so
-/usr/lib/gconv/ISO8859-11.so
-/usr/lib/gconv/ISO8859-13.so
-/usr/lib/gconv/ISO8859-14.so
-/usr/lib/gconv/ISO8859-15.so
-/usr/lib/gconv/ISO8859-16.so
-/usr/lib/gconv/ISO8859-2.so
-/usr/lib/gconv/ISO8859-3.so
-/usr/lib/gconv/ISO8859-4.so
-/usr/lib/gconv/ISO8859-5.so
-/usr/lib/gconv/ISO8859-6.so
-/usr/lib/gconv/ISO8859-7.so
-/usr/lib/gconv/ISO8859-8.so
-/usr/lib/gconv/ISO8859-9.so
-/usr/lib/gconv/ISO_10367-BOX.so
-/usr/lib/gconv/ISO_2033.so
-/usr/lib/gconv/ISO_5427-EXT.so
-/usr/lib/gconv/ISO_5427.so
-/usr/lib/gconv/ISO_5428.so
-/usr/lib/gconv/ISO_6937-2.so
-/usr/lib/gconv/ISO_6937.so
-/usr/lib/gconv/JOHAB.so
-/usr/lib/gconv/KOI-8.so
-/usr/lib/gconv/KOI8-R.so
-/usr/lib/gconv/KOI8-T.so
-/usr/lib/gconv/KOI8-U.so
-/usr/lib/gconv/LATIN-GREEK-1.so
-/usr/lib/gconv/LATIN-GREEK.so
-/usr/lib/gconv/MAC-IS.so
-/usr/lib/gconv/MAC-SAMI.so
-/usr/lib/gconv/MAC-UK.so
-/usr/lib/gconv/MACINTOSH.so
-/usr/lib/gconv/NATS-DANO.so
-/usr/lib/gconv/NATS-SEFI.so
-/usr/lib/gconv/SAMI-WS2.so
-/usr/lib/gconv/SHIFT_JISX0213.so
-/usr/lib/gconv/SJIS.so
-/usr/lib/gconv/T.61.so
-/usr/lib/gconv/TCVN5712-1.so
-/usr/lib/gconv/TIS-620.so
-/usr/lib/gconv/TSCII.so
-/usr/lib/gconv/UHC.so
-/usr/lib/gconv/UNICODE.so
-/usr/lib/gconv/UTF-16.so
-/usr/lib/gconv/UTF-32.so
-/usr/lib/gconv/UTF-7.so
-/usr/lib/gconv/VISCII.so
-/usr/lib/gconv/gconv-modules
-/usr/lib/gconv/gconv-modules.cache
-/usr/lib/gconv/libCNS.so
-/usr/lib/gconv/libGB.so
-/usr/lib/gconv/libISOIR165.so
-/usr/lib/gconv/libJIS.so
-/usr/lib/gconv/libJISX0213.so
-/usr/lib/gconv/libKSC.so
-/usr/sbin/glibc_post_upgrade
-/usr/sbin/iconvconfig
+++ /dev/null
-/usr/include/popt.h
-/usr/lib/libpopt.a
-/usr/lib/libpopt.la
-/usr/lib/libpopt.so
-/usr/lib/libpopt.so.0
-/usr/lib/libpopt.so.0.0.0
-/usr/share/locale/cs/LC_MESSAGES/popt.mo
-/usr/share/locale/da/LC_MESSAGES/popt.mo
-/usr/share/locale/de/LC_MESSAGES/popt.mo
-/usr/share/locale/es/LC_MESSAGES/popt.mo
-/usr/share/locale/eu_ES/LC_MESSAGES/popt.mo
-/usr/share/locale/fi/LC_MESSAGES/popt.mo
-/usr/share/locale/fr/LC_MESSAGES/popt.mo
-/usr/share/locale/gl/LC_MESSAGES/popt.mo
-/usr/share/locale/hu/LC_MESSAGES/popt.mo
-/usr/share/locale/id/LC_MESSAGES/popt.mo
-/usr/share/locale/is/LC_MESSAGES/popt.mo
-/usr/share/locale/it/LC_MESSAGES/popt.mo
-/usr/share/locale/ja/LC_MESSAGES/popt.mo
-/usr/share/locale/ko/LC_MESSAGES/popt.mo
-/usr/share/locale/no/LC_MESSAGES/popt.mo
-/usr/share/locale/pl/LC_MESSAGES/popt.mo
-/usr/share/locale/pt/LC_MESSAGES/popt.mo
-/usr/share/locale/pt_BR/LC_MESSAGES/popt.mo
-/usr/share/locale/ro/LC_MESSAGES/popt.mo
-/usr/share/locale/ru/LC_MESSAGES/popt.mo
-/usr/share/locale/sk/LC_MESSAGES/popt.mo
-/usr/share/locale/sl/LC_MESSAGES/popt.mo
-/usr/share/locale/sr/LC_MESSAGES/popt.mo
-/usr/share/locale/sv/LC_MESSAGES/popt.mo
-/usr/share/locale/tr/LC_MESSAGES/popt.mo
-/usr/share/locale/uk/LC_MESSAGES/popt.mo
-/usr/share/locale/wa/LC_MESSAGES/popt.mo
-/usr/share/locale/zh/LC_MESSAGES/popt.mo
-/usr/share/locale/zh_CN.GB2312/LC_MESSAGES/popt.mo
+++ /dev/null
-/bin/rpm
-/etc/rpm
-/usr/bin/gendiff
-/usr/bin/rpm2cpio
-/usr/bin/rpmdb
-/usr/bin/rpmquery
-/usr/bin/rpmsign
-/usr/bin/rpmverify
-/usr/lib/librpm-4.2.so
-/usr/lib/librpmbuild-4.2.so
-/usr/lib/librpmdb-4.2.so
-/usr/lib/librpmio-4.2.so
-/usr/lib/rpm
-/usr/lib/rpm/athlon-linux
-/usr/lib/rpm/athlon-linux/macros
-/usr/lib/rpm/config.guess
-/usr/lib/rpm/config.sub
-/usr/lib/rpm/convertrpmrc.sh
-/usr/lib/rpm/i386-linux
-/usr/lib/rpm/i386-linux/macros
-/usr/lib/rpm/i486-linux
-/usr/lib/rpm/i486-linux/macros
-/usr/lib/rpm/i586-linux
-/usr/lib/rpm/i586-linux/macros
-/usr/lib/rpm/i686-linux
-/usr/lib/rpm/i686-linux/macros
-/usr/lib/rpm/macros
-/usr/lib/rpm/mkinstalldirs
-/usr/lib/rpm/noarch-linux
-/usr/lib/rpm/noarch-linux/macros
-/usr/lib/rpm/rpm.daily
-/usr/lib/rpm/rpm.log
-/usr/lib/rpm/rpm.xinetd
-/usr/lib/rpm/rpm2cpio.sh
-/usr/lib/rpm/rpmd
-/usr/lib/rpm/rpme
-/usr/lib/rpm/rpmi
-/usr/lib/rpm/rpmk
-/usr/lib/rpm/rpmpopt-4.2
-/usr/lib/rpm/rpmq
-/usr/lib/rpm/rpmrc
-/usr/lib/rpm/rpmu
-/usr/lib/rpm/rpmv
-/usr/lib/rpm/tgpg
-/usr/share/locale/cs/LC_MESSAGES/rpm.mo
-/usr/share/locale/da/LC_MESSAGES/rpm.mo
-/usr/share/locale/de/LC_MESSAGES/rpm.mo
-/usr/share/locale/fi/LC_MESSAGES/rpm.mo
-/usr/share/locale/fr/LC_MESSAGES/rpm.mo
-/usr/share/locale/gl/LC_MESSAGES/rpm.mo
-/usr/share/locale/is/LC_MESSAGES/rpm.mo
-/usr/share/locale/ja/LC_MESSAGES/rpm.mo
-/usr/share/locale/ko/LC_MESSAGES/rpm.mo
-/usr/share/locale/no/LC_MESSAGES/rpm.mo
-/usr/share/locale/pl/LC_MESSAGES/rpm.mo
-/usr/share/locale/pt/LC_MESSAGES/rpm.mo
-/usr/share/locale/pt_BR/LC_MESSAGES/rpm.mo
-/usr/share/locale/ro/LC_MESSAGES/rpm.mo
-/usr/share/locale/ru/LC_MESSAGES/rpm.mo
-/usr/share/locale/sk/LC_MESSAGES/rpm.mo
-/usr/share/locale/sl/LC_MESSAGES/rpm.mo
-/usr/share/locale/sr/LC_MESSAGES/rpm.mo
-/usr/share/locale/sv/LC_MESSAGES/rpm.mo
-/usr/share/locale/tr/LC_MESSAGES/rpm.mo
-/var/lib/rpm
-/var/spool/repackage
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2005 The Trustees of Princeton University
#
-# $Id: Makefile,v 1.2 2005/09/02 19:09:33 mlhuang Exp $
+# $Id: Makefile,v 1.4 2006/08/20 21:21:13 thierry Exp $
#
-all: alpina-BootLVM.tar.gz alpina-PartDisks.tar.gz PlanetLab-Bootstrap.tar.bz2
-
-alpina-BootLVM.tar.gz:
- ./buildsupport.sh build BootLVM
-
-alpina-BootstrapRPM.tar.gz:
- ./buildsupport.sh build BootstrapRPM
-
-alpina-PartDisks.tar.gz:
- ./buildsupport.sh build PartDisks
+all: PlanetLab-Bootstrap.tar.bz2
PlanetLab-Bootstrap.tar.bz2:
./buildnode.sh
clean:
- ./buildsupport.sh clean
rm -f PlanetLab-Bootstrap.tar.bz2
+++ /dev/null
-#!/bin/sh
-
-echo "Adding special files:"
-cp lib-paths rpm-extract
-
-echo "lib-paths" >> keep-files
-
-exit 0
+++ /dev/null
-stage 1 is everything need to get the disks online, mounted, and
-the new swap turned on (so we can create a larger tempfs for
-later stages)
+++ /dev/null
-/usr/lib
-/lib
+++ /dev/null
-/lib/liblvm-10.so
-/lib/liblvm-10.so.1
-/lib/liblvm-10.so.1.0
-/sbin/e2fsadm
-/sbin/lvchange
-/sbin/lvcreate
-/sbin/lvdisplay
-/sbin/lvextend
-/sbin/lvmchange
-/sbin/lvmcreate_initrd
-/sbin/lvmdiskscan
-/sbin/lvmsadc
-/sbin/lvmsar
-/sbin/lvreduce
-/sbin/lvremove
-/sbin/lvrename
-/sbin/lvscan
-/sbin/pvchange
-/sbin/pvcreate
-/sbin/pvdata
-/sbin/pvdisplay
-/sbin/pvmove
-/sbin/pvscan
-/sbin/vgcfgbackup
-/sbin/vgcfgrestore
-/sbin/vgchange
-/sbin/vgck
-/sbin/vgcreate
-/sbin/vgdisplay
-/sbin/vgexport
-/sbin/vgextend
-/sbin/vgimport
-/sbin/vgmerge
-/sbin/vgmknodes
-/sbin/vgreduce
-/sbin/vgremove
-/sbin/vgrename
-/sbin/vgscan
-/sbin/vgsplit
-/sbin/vgchange.static
-/sbin/vgscan.static
-/sbin/vgwrapper
+++ /dev/null
-/usr/lib/libparted-1.4.so.14
-/usr/lib/libparted-1.4.so.14.3.7
-/usr/lib/python2.2/site-packages/partedmodule.so
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2005-2006 The Trustees of Princeton University
#
-# $Id: buildnode.sh,v 1.10 2006/04/11 22:13:18 mlhuang Exp $
+# $Id: buildnode.sh,v 1.12 2006/08/11 13:04:03 thierry Exp $
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
# because groupinstall does not honor Requires(pre) dependencies
# properly, most %pre scripts require coreutils to be installed first,
# and some of our %post scripts require python.
-mkfedora -v -r $releasever -a $basearch -k -p dev -p coreutils -p python -g PlanetLab $VROOT
+mkfedora -v -r $releasever -a $basearch -k -p udev -p coreutils -p python -g PlanetLab $VROOT
# Disable unnecessary services
echo "* Disabling unnecessary services"
+++ /dev/null
-#!/bin/bash
-
-# for each file in support-rpms/*.list, extract the rpm and
-# keep the files from the list
-
-# list of stage tar ball we need to build, this is basically
-# the list of stage directories
-ALL_STAGES='PartDisks BootstrapRPM BootLVM'
-
-# new files, in each stage dir
-RPM_EXTRACT_DIR='rpm-extract/'
-KEEP_FILE_LIST='keep-files'
-
-# source files, in each stage dir
-SOURCE_RPM_DIR='source-rpms/'
-EXTRA_FILES='lib-paths'
-CUSTOM_SCRIPT='custom.sh'
-
-# destination for upload command
-DEST_USER='root'
-DEST_SERVER='yankee.cs.princeton.edu'
-DEST_PATH='/export0/echo/alpina/'
-
-
-build()
-{
- BUILD_STAGE=$1
-
- for STAGE_DIR in $BUILD_STAGE; do
-
- echo "Building $STAGE_DIR"
- cd $STAGE_DIR
-
- STAGE_DEST_FILE="alpina-$STAGE_DIR.tar.gz"
-
- for file in `ls $SOURCE_RPM_DIR/*.list`; do
- RPM_NAME="`basename $file list`rpm"
- RPM_FILE="$SOURCE_RPM_DIR/$RPM_NAME"
-
- echo
- echo "Extracting $RPM_NAME:"
- extract $RPM_FILE $RPM_EXTRACT_DIR
-
- echo "Files to be kept from $RPM_NAME:"
- for line in `cat $file`; do
- echo "./$RPM_EXTRACT_DIR/$line"
- echo "./$line" >> $KEEP_FILE_LIST
- done
-
- done
-
- if [[ -f $CUSTOM_SCRIPT ]]; then
- echo "Running stage specific script"
- ./$CUSTOM_SCRIPT
-
- if [[ "$?" -ne 0 ]]; then
- echo "Custom stage script failed, exiting."
- exit 1
- fi
- fi
-
- echo "Compressing files:"
- cd $RPM_EXTRACT_DIR
- tar --files-from=../$KEEP_FILE_LIST --exclude=CVS -cvzf ../../$STAGE_DEST_FILE
- cd ..
-
- echo "Completed building $STAGE_DIR"
-
- cd ..
-
- done
-}
-
-upload()
-{
- UPLOAD_STAGE=$1
-
- STAGE_FILE_LIST=''
- for STAGE_DIR in $UPLOAD_STAGE; do
- STAGE_FILE_LIST="$STAGE_FILE_LIST alpina-$STAGE_DIR.tar.gz"
- done
-
- scp $STAGE_FILE_LIST $DEST_USER@$DEST_SERVER:$DEST_PATH
-}
-
-clean()
-{
- CLEAN_STAGE=$1
-
- for STAGE_DIR in $CLEAN_STAGE; do
- rm -rf $STAGE_DIR/$RPM_EXTRACT_DIR
- rm -f $STAGE_DIR/$KEEP_FILE_LIST
-
- STAGE_DEST_FILE="alpina-$STAGE_DIR.tar.gz"
- rm -f $STAGE_DEST_FILE
-
- echo "Cleaned $STAGE_DIR"
- done
-}
-
-extract()
-{
- RPM=$1
- DEST=$2
-
- mkdir -p $DEST
- rpm2cpio $RPM > $DEST/out.cpio
- (cd $DEST && cpio -ivd < out.cpio && rm out.cpio)
-}
-
-usage()
-{
- echo "Usage buildsupport.sh (build|upload|clean)";
-}
-
-# find out what do do
-COMMAND=$1
-STAGE=$2
-
-
-if [[ -z "$STAGE" ]]; then
- # if the stage is blank, build all
- STAGE=$ALL_STAGES
-else
- # make sure the stage exists
- if [[ ! -d "$STAGE" ]]; then
- usage
- exit 1
- fi
-fi
-
-case "$COMMAND" in
- build) build "$STAGE";;
- upload) upload "$STAGE";;
- clean) clean "$STAGE";;
- *) usage; exit 1;;
-esac