diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2008-09-18 14:25:31 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2008-09-18 14:25:31 -0400 |
commit | 627af2331e236347883376a6af0edb4de7449e52 (patch) | |
tree | ece9057a22d7fdea7fef03108db2085b874628cd | |
parent | 7de4732ca424ac2ac27ae8731619fce3c36ba81b (diff) | |
download | cobbler-627af2331e236347883376a6af0edb4de7449e52.tar.gz cobbler-627af2331e236347883376a6af0edb4de7449e52.tar.xz cobbler-627af2331e236347883376a6af0edb4de7449e52.zip |
Fix some errors in the templates as part of development with the ipappend 2 feature; updates
to Andrew Brown's work with physical machine cloning
-rw-r--r-- | cobbler/pxegen.py | 2 | ||||
-rw-r--r-- | contrib/cloner/base.cfg | 77 | ||||
-rw-r--r-- | templates/pxedefault.template | 1 | ||||
-rw-r--r-- | templates/pxeprofile.template | 5 | ||||
-rw-r--r-- | templates/pxesystem.template | 2 |
5 files changed, 17 insertions, 70 deletions
diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py index 0191e782..f6cd13c8 100644 --- a/cobbler/pxegen.py +++ b/cobbler/pxegen.py @@ -223,6 +223,8 @@ class PXEGen: listfile = open(os.path.join(s390path, "profile_list"),"w+") for profile in profile_list: distro = profile.get_conceptual_parent() + if distro is None: + raise CX(_("profile is missing distribution: %s, %s") % (profile.name, profile.distro)) if distro.arch == "s390x": listfile.write("%s\n" % profile.name) f2 = os.path.join(self.bootloc, "s390x", profile.name) diff --git a/contrib/cloner/base.cfg b/contrib/cloner/base.cfg index d4b1ee6b..2bc45e1d 100644 --- a/contrib/cloner/base.cfg +++ b/contrib/cloner/base.cfg @@ -1,7 +1,3 @@ -# this is a livecd config developed by Andrew Brown <ambrown4@ncsu.edu> for saving -# and loading drive images to NFS locations, all based on kernel arguments. This is -# for use with livecd creator. - lang en_US.UTF-8 keyboard us timezone US/Eastern @@ -19,6 +15,7 @@ services --disable sshd repo --name=todos --baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/9/Everything/i386/os/ repo --name=updatez --baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/9/i386/ +repo --name=partimageng --baseurl=file:///usr/src/redhat/RPMS/i386/ text bootloader --location=mbr @@ -76,6 +73,9 @@ grub eject tree +# Add libraries for partimage: +partimage-ng + %post cat > /etc/rc.d/init.d/fedora-live << EOF @@ -118,6 +118,7 @@ touch /media/.hal-mtab # PUT CUSOTMIZATIONS HERE mkdir -p /mnt/nfs + cat << EOFpython > /tmp/imaging.py import subprocess import sys @@ -164,6 +165,8 @@ ret = call("mount %s /mnt/nfs" % nfspath) if ret: sys.exit("Couldn't mount") +pimg = "partimage-ng" + # Make the directory where we'll save everything call("mkdir -p %s" % fullpath) @@ -172,38 +175,9 @@ if action == "save": call("rm -f -- %s" % os.path.join(fullpath, "*")) for drivenum, drive in enumerate(drivelist): - # Save off mbr and the data between mbr and the first partition - # in case grub stuck a stage 1.5 bootloader there. - print "Saving mbr..." - mbrpath = os.path.join(fullpath, "%s.mbr" % drivenum) - sfdiskpath = os.path.join(fullpath, "%s.sfdisk" % drivenum) - call("dd if=%s of=%s bs=512 count=63" % (drive, mbrpath)) - - # Save off extended partition information - print "Saving extended partition info..." - call("sfdisk %s -d > %s" % (drive, sfdiskpath)) - - for partition in os.popen("sfdisk -l %s" % drive, 'r').readlines(): - if not partition.startswith(drive): - continue - - # ex: /dev/sda1 - partdevice = partition.split()[0] - - # ex: 1 - partnum = partdevice[len(drive):] - - # ex: Linux, Extended, Win95... - parttype = partition.split()[-1] - - # Decide what to do depending on parttype... - if parttype in ("Empty", "Extended"): - continue - - # for now, everything is dd - print "Saving %s" % partdevice - partimagepath = os.path.join(fullpath, "%s.%s" % (drivenum, partnum)) - call("dd if=%s of=%s conv=sync,noerror" % (partdevice, partimagepath)) + print "Saving %s" % drive + imagepath = os.path.join(fullpath, "%s.img" % drivenum) + call("%s -i save %s %s" % (pimg, drive, imagepath)) print "Finished saving. Rebooting" #call("/sbin/shutdown -r now") @@ -211,34 +185,9 @@ if action == "save": elif action == "load": for drivenum, drive in enumerate(drivelist): - print "Restoring partition info for %s" % drive - - mbrpath = os.path.join(fullpath, "%s.mbr" % drivenum) - sfdiskpath = os.path.join(fullpath, "%s.sfdisk" % drivenum) - - call("dd if=%s of=%s" % (mbrpath, drive)) - call("sfdisk %s < %s" % (drive, sfdiskpath)) - - call("sfdisk %s -R" % drive) - for partpath in glob(os.path.join(fullpath, "%s.*" % drivenum)): - # partpath is full path to partition file on nfs mount - # ex: /export/blade1/0.1 - - # partfile ex: 0.1 - partfile = os.path.split(partpath)[-1] - - # partnum ex: 1 - partnum = partfile.split(".")[-1] - if partnum in ("mbr", "fdisk") or not partnum.isdigit(): - continue - - partition = drive + partnum - print "Restoring %s" % partition - - # Don't exit if dd "fails", dd returns 1 here because device runs - # out of room even if it fits perfectly apparently - - call("dd if=%s of=%s" % (partpath, partition)) + print "Restoring %s" % drive + imagepath = os.path.join(fullpath, "%s.img" % drivenum) + call("%s restore %s %s" % (pimg, imagepath, drive)) print "Finished loading image. Rebooting" #call("/sbin/shutdown -r now") diff --git a/templates/pxedefault.template b/templates/pxedefault.template index bba48b37..bb09893c 100644 --- a/templates/pxedefault.template +++ b/templates/pxedefault.template @@ -4,7 +4,6 @@ MENU TITLE Cobbler | http://cobbler.et.redhat.com TIMEOUT 200 TOTALTIMEOUT 6000 ONTIMEOUT local -IPAPPEND 2 LABEL local MENU LABEL (local) diff --git a/templates/pxeprofile.template b/templates/pxeprofile.template index 3b5a53d0..ffe908ab 100644 --- a/templates/pxeprofile.template +++ b/templates/pxeprofile.template @@ -1,8 +1,5 @@ -default linux -prompt 0 -timeout 1 -ipappend 2 LABEL $profile_name kernel $kernel_path $menu_label $append_line + ipappend 2 diff --git a/templates/pxesystem.template b/templates/pxesystem.template index 2e23a42b..a39f6f02 100644 --- a/templates/pxesystem.template +++ b/templates/pxesystem.template @@ -1,8 +1,8 @@ default linux prompt 0 timeout 1 -ipappend 2 label linux kernel $kernel_path + ipappend 2 $append_line |