[Ovirt-devel] [PATCH appliance] Move logic for appliance setup from kickstart to recipe
Perry Myers
pmyers at redhat.com
Sun Nov 9 07:46:00 UTC 2008
The only logic left in the kickstart is generic appliance setup information
Signed-off-by: Perry Myers <pmyers at redhat.com>
---
ovirt-appliance.ks | 100 +--------------------------------------------------
1 files changed, 2 insertions(+), 98 deletions(-)
diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks
index dd56ee5..e34ab87 100644
--- a/ovirt-appliance.ks
+++ b/ovirt-appliance.ks
@@ -33,46 +33,8 @@ ovirt-recipe
lokkit
%post
-# cleanup rpmdb to allow non-matching host and chroot RPM versions
-rm -f /var/lib/rpm/__db*
- exec > /root/kickstart-post.log 2>&1
-
- # the code to contact the host we are running on and make it configure itself
- # note that this has to be done in rc.local (as opposed to ovirt-wui-dev)
- # because when ovirt-wui-dev starts, the host-browser is not yet running
- cat >> /etc/rc.d/rc.local << \EOF
-# Try to contact the host we are running on; if we succeed, we'll use it as
-# one of the managed nodes; if not, no big deal
-(exec 3<> /dev/tcp/192.168.50.1/7777 && echo "AWAKE" 1>&3 \
- && exec 3<> /dev/tcp/192.168.50.1/7777 && echo "IDENTIFY" 1>&3) || :
-EOF
-
- # make sure to update the /etc/hosts with the list of all possible DHCP
- # addresses we can hand out; dnsmasq uses this
- sed -i -e 's/management\.priv\.ovirt\.org//' /etc/hosts
- echo "192.168.50.1 physical.priv.ovirt.org" >> /etc/hosts
- echo "192.168.50.2 management.priv.ovirt.org" >> /etc/hosts
- for i in `seq 3 252` ; do
- echo "192.168.50.$i node$i.priv.ovirt.org" >> /etc/hosts
- done
-
- # Create sparse files for iSCSI backing stores
- mkdir -p /ovirtiscsi
- for i in `seq 3 5`; do
- dd if=/dev/null of=/ovirtiscsi/iSCSI$i bs=1 count=1 seek=3G
- done
-
- # make an NFS directory with some small, fake disks and export them via NFS
- # to show off the NFS part of the WUI
- mkdir -p /ovirtnfs
- for i in `seq 1 3`; do
- dd if=/dev/zero of=/ovirtnfs/disk$i.dsk bs=1 count=1 seek=3G
- done
- echo "/ovirtnfs 192.168.50.0/24(rw,no_root_squash)" >> /etc/exports
-
- # add an NFS directory to use for Cobbler image storage
- mkdir -p /cobblernfs
- echo "/cobblernfs 192.168.50.0/24(rw,no_root_squash)" >> /etc/exports
+ # cleanup rpmdb to allow non-matching host and chroot RPM versions
+ rm -f /var/lib/rpm/__db*
# The ace stuff.
/sbin/chkconfig --level 35 ace on
@@ -96,63 +58,5 @@ print "%s %s %s" % (family, version, arch)' | ( read os ver arch
dest=$INSTALL_ROOT/var/www/cobbler/ks_mirror/$os-$ver-$arch
printf "Importing $os-$ver-$arch ..."
cp -a tmp/tree $dest
- url=http://download.fedora.redhat.com/pub/fedora/linux
- cat >> $INSTALL_ROOT/etc/rc.d/rc.cobbler-import << EOF
-#!/bin/sh
-# Import Cobbler profiles on first boot
-
-exec > /root/cobbler-import.log 2>&1
-
-# run only once
-chmod -x \$0
-set -x
-
-cobbler import --name=$os-$ver --arch=$arch \
- --path=/var/www/cobbler/ks_mirror/$os-$ver-$arch
-cobbler repo add --name=f9-$arch --arch=$arch --mirror-locally=0 \
- --mirror=$url/releases/9/Everything/$arch/os
-cobbler repo add --name=f9-$arch-updates --arch=$arch --mirror-locally=0 \
- --mirror=$url/updates/9/$arch.newkey
-sed -e 's#^reboot.*#poweroff#' /etc/cobbler/sample_end.ks \
- > /etc/cobbler/sample-$os-$ver-$arch.ks
-cobbler profile edit --name=$os-$ver-$arch \
- --repos="f9-$arch f9-$arch-updates" \
- --kickstart=/etc/cobbler/sample-$os-$ver-$arch.ks
-
-# TODO extract Node boot params from /var/lib/tftboot/pxelinux.cfg/default
-# before Cobbler overwrites it
-cobbler distro add --name="oVirt-Node-$arch" --arch=$arch \
- --initrd=/var/lib/tftpboot/initrd0.img --kernel=/var/lib/tftpboot/vmlinuz0 \
- --kopts="rootflags=loop root=/ovirt-node-image.iso rootfstype=iso9660 ro console=ttyS0,115200n8 console=tty0"
-cobbler profile add --name=oVirt-Node-$arch --distro=oVirt-Node-$arch
-cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \
- --name=node3 --mac=00:16:3e:12:34:57
-cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \
- --name=node4 --mac=00:16:3e:12:34:58 --kopts="ovirt_init=scsi ovirt_local_boot"
-cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \
- --name=node5 --mac=00:16:3e:12:34:59 --kopts="ovirt_init=scsi"
-set +x
-echo "Add new oVirt Nodes as Cobbler systems to make them PXE boot oVirt Node image directly."
-echo "oVirt-Node-$arch is also default boot option in Cobbler menu"
-EOF
- chmod +x $INSTALL_ROOT/etc/rc.d/rc.cobbler-import
- echo "[ -x /etc/rc.d/rc.cobbler-import ] && /etc/rc.d/rc.cobbler-import" \
- >> $INSTALL_ROOT/etc/rc.d/rc.local
- printf "oVirt-Node-$arch" > $INSTALL_ROOT/tmp/cobbler-default
- echo done
)
%end
-
-# Cobbler configuration
-%post
- exec >> /root/kickstart-post.log 2>&1
- # TODO use Augeas 0.3.0 Inifile lens
- sed -i -e "s/^module = authn_denyall.*/module = authn_configfile/" \
- /etc/cobbler/modules.conf
- sed -i -e "s/^server:.*/server: '192.168.50.2'/" \
- -e "s/^next_server:.*/next_server: '192.168.50.2'/" \
- /etc/cobbler/settings
- sed -i -e '/kernel /a \\tIPAPPEND 2' /etc/cobbler/pxesystem.template
- sed -i -e "s/^ONTIMEOUT.*/ONTIMEOUT $(cat /tmp/cobbler-default)/" \
- /etc/cobbler/pxedefault.template
-%end
--
1.6.0.3
More information about the ovirt-devel
mailing list