[Ovirt-devel] [PATCH-appliance] Rename ovirt-appliance to be ovirt-appliance-image and the AOS tooling in the ovirt-recipe rpo

Bryan Kearney bkearney at redhat.com
Fri Sep 19 13:01:36 UTC 2008


---
 Makefile.am                |   11 +-
 autogen.sh                 |    2 +-
 common-install.ks          |   22 ---
 common-pkgs.ks             |   28 ----
 common-post.ks             |   88 -----------
 configure.ac               |    2 +-
 ovirt-appliance-image.ks   |  159 ++++++++++++++++++++
 ovirt-appliance-image.spec |  103 +++++++++++++
 ovirt-appliance.ks         |  349 --------------------------------------------
 ovirt-appliance.spec       |  101 -------------
 10 files changed, 269 insertions(+), 596 deletions(-)
 delete mode 100644 common-install.ks
 delete mode 100644 common-pkgs.ks
 delete mode 100644 common-post.ks
 create mode 100644 ovirt-appliance-image.ks
 create mode 100644 ovirt-appliance-image.spec
 delete mode 100644 ovirt-appliance.ks
 delete mode 100644 ovirt-appliance.spec

diff --git a/Makefile.am b/Makefile.am
index a3553c2..d1f9ebf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,13 +17,10 @@
 
 EXTRA_DIST =			\
   .gitignore			\
-  common-install.ks		\
-  common-pkgs.ks		\
-  common-post.ks		\
   create-ovirt-appliance	\
   gettree.sh			\
-  ovirt-appliance.ks		\
-  ovirt-appliance.spec		\
+  ovirt-appliance-image.ks		\
+  ovirt-appliance-image.spec		\
   release.mk			\
   version
 
@@ -32,10 +29,12 @@ include release.mk
 # FEDORA_URL env var can be set to the root of a fedora mirror
 # OVIRT_URL env var can be set to the root of an ovirt.org mirror
 # SKIP_COMPRESS_IMAGE env var an be set to 1 to skip qcow compression
+# THINCRUST_URL env var can be set to the root of a thuncrust.org mirror
 RPM_FLAGS += \
   --define "fedora_url $(FEDORA_URL)" \
   --define "ovirt_url $(OVIRT_URL)" \
-  --define "skip_compress_image $(SKIP_COMPRESS_IMAGE)"
+  --define "skip_compress_image $(SKIP_COMPRESS_IMAGE)" \
+  --define "thincrust_url ${THINCRUST_URL}"
 
 pkg_name = $(PACKAGE_NAME)
 .PHONY: tar
diff --git a/autogen.sh b/autogen.sh
index 0d2c99c..1f4aeeb 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -35,7 +35,7 @@ THEDIR=`pwd`
 
   test $die = 1 && exit 1
 
-  test -f ovirt-appliance.spec || {
+  test -f ovirt-appliance-image.spec || {
 	  echo "You must run this script in the top-level directory"
 	  exit 1
   }
diff --git a/common-install.ks b/common-install.ks
deleted file mode 100644
index c55303b..0000000
--- a/common-install.ks
+++ /dev/null
@@ -1,22 +0,0 @@
-lang en_US.UTF-8
-keyboard us
-network --device eth0 --bootproto dhcp
-rootpw --iscrypted Xa8QeYfWrtscM
-firewall --disabled
-authconfig --enableshadow --enablemd5
-selinux --disabled
-services --disabled=libvirtd,postgresql --enabled=network,tgtd,nfs,iptables
-timezone --utc UTC
-text
-
-bootloader --location=mbr --driveorder=sda
-# The following is the partition information you requested
-# Note that any partitions you deleted are not expressed
-# here so unless you clear all partitions first, this is
-# not guaranteed to work
-zerombr
-clearpart --all --drives=sda
-part /boot  --ondisk=sda --fstype=ext3 --size=100
-part /      --ondisk=sda --fstype=ext3 --size=20000
-part swap   --ondisk=sda --fstype=swap --size=512
-reboot
diff --git a/common-pkgs.ks b/common-pkgs.ks
deleted file mode 100644
index 226085d..0000000
--- a/common-pkgs.ks
+++ /dev/null
@@ -1,28 +0,0 @@
- at core
-kernel
-cronie
-policycoreutils
-chkconfig
-rootfiles
-dhclient
-libvirt-python
-openssh-clients
-openssh-server
-nfs-utils
-collectd
-collectd-rrdtool
-ipa-server
-ipa-admintools
-scsi-target-utils
-iscsi-initiator-utils
-ovirt-server
-ovirt-node-image-pxe
-ovirt-release
-rhpl
-cobbler
-rubygem-cobbler
-bind-utils
-augeas
-syslinux
-/usr/sbin/lokkit
-curl
diff --git a/common-post.ks b/common-post.ks
deleted file mode 100644
index a5d79ce..0000000
--- a/common-post.ks
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*-Shell-script-*-
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-export PATH
-
-# pretty login screen..
-g=$(printf '\33[1m\33[32m')    # similar to g=$(tput bold; tput setaf 2)
-n=$(printf '\33[m')            # similar to n=$(tput sgr0)
-cat <<EOF > /etc/issue
-
-           888     888 ${g}d8b$n         888
-           888     888 ${g}Y8P$n         888
-           888     888             888
-   .d88b.  Y88b   d88P 888 888d888 888888
-  d88''88b  Y88b d88P  888 888P'   888
-  888  888   Y88o88P   888 888     888
-  Y88..88P    Y888P    888 888     Y88b.
-   'Y88P'      Y8P     888 888      'Y888
-
-  Admin Node
-
-  Virtualization just got the ${g}Green Light$n
-
-EOF
-cp /etc/issue /etc/issue.net
-
-cat > /etc/init.d/ovirt-appliance-first-run << \EOF
-#!/bin/bash
-#
-# ovirt-appliance-first-run First run configuration for oVirt Appliance
-#
-# chkconfig: 3 96 01
-# description: ovirt appliance first run configuration
-#
-
-# Source functions library
-. /etc/init.d/functions
-
-start() {
-	echo -n "Starting ovirt-appliance-first-run: "
-
-	ovirt-server-install > /var/log/ovirt-appliance-first-run.log 2>&1
-
-	RETVAL=$?
-	if [ $RETVAL -eq 0 ]; then
-		echo_success
-	else
-		echo_failure
-	fi
-	echo
-}
-
-case "$1" in
-  start)
-        start
-        ;;
-  *)
-        echo "Usage: ovirt-appliance-first-run {start}"
-        exit 2
-esac
-
-chkconfig ovirt-appliance-first-run off
-EOF
-chmod +x /etc/init.d/ovirt-appliance-first-run
-chkconfig ovirt-appliance-first-run on
-
-cat > /etc/yum.repos.d/ovirt.repo << \EOF
-[ovirt]
-name=ovirt
-baseurl=http://ovirt.org/repos/ovirt/9/$basearch/
-enabled=1
-gpgcheck=0
-EOF
-
-# XXX default configuration db
-cat > /var/www/html/ovirt-cfgdb << \EOF
-rm /files/etc/sysconfig/network-scripts/ifcfg-eth0
-set /files/etc/sysconfig/network-scripts/ifcfg-eth0/DEVICE eth0
-set /files/etc/sysconfig/network-scripts/ifcfg-eth0/ONBOOT yes
-set /files/etc/sysconfig/network-scripts/ifcfg-eth0/BRIDGE ovirtbr0
-rm /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0
-set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/DEVICE ovirtbr0
-set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/BOOTPROTO dhcp
-set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/ONBOOT y
-set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/TYPE Bridge
-set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/PEERNTP yes
-set /files/etc/sysconfig/network-scripts/ifcfg-ovirtbr0/DELAY 0
-EOF
-
diff --git a/configure.ac b/configure.ac
index 3f0fa6e..f62c4af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 # note: the version number here is overridden by the one in release.mk
-AC_INIT([ovirt-appliance], [0.1], [ovirt-devel at redhat.com])
+AC_INIT([ovirt-appliance-image], [0.1], [ovirt-devel at redhat.com])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 
 AC_CONFIG_FILES([Makefile])
diff --git a/ovirt-appliance-image.ks b/ovirt-appliance-image.ks
new file mode 100644
index 0000000..dbd45e0
--- /dev/null
+++ b/ovirt-appliance-image.ks
@@ -0,0 +1,159 @@
+install
+
+lang en_US.UTF-8
+keyboard us
+network --device eth0 --bootproto dhcp
+rootpw --iscrypted Xa8QeYfWrtscM
+firewall --disabled
+authconfig --enableshadow --enablemd5
+selinux --disabled
+services --disabled=libvirtd,postgresql --enabled=network,tgtd,nfs,iptables
+timezone --utc UTC
+text
+
+bootloader --location=mbr --driveorder=sda
+# The following is the partition information you requested
+# Note that any partitions you deleted are not expressed
+# here so unless you clear all partitions first, this is
+# not guaranteed to work
+zerombr
+clearpart --all --drives=sda
+part /boot  --ondisk=sda --fstype=ext3 --size=100
+part /      --ondisk=sda --fstype=ext3 --size=20000
+part swap   --ondisk=sda --fstype=swap --size=512
+reboot
+
+network --device=eth1 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org
+
+%include repos.ks
+
+%packages --nobase
+%include /usr/share/appliance-tools/base-pkgs.ks
+ovirt-appliance
+lokkit
+
+%post
+  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.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=64M
+  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 5`; do
+    dd if=/dev/zero of=/ovirtnfs/disk$i.dsk bs=1 count=1 seek=1G
+  done
+  echo "/ovirtnfs 192.168.50.0/24(rw,no_root_squash)" >> /etc/exports
+
+  # The ace stuff.
+  /sbin/chkconfig --level 35 ace on
+  mkdir /etc/sysconfig/ace
+  echo ovirt >> /etc/sysconfig/ace/appliancename
+  /sbin/chkconfig --add acpid
+
+%end
+
+%post --nochroot
+  set -e
+  python -c '
+from iniparse.ini import INIConfig
+ini = INIConfig()
+fp = open("tmp/tree/.treeinfo")
+ini.readfp(fp)
+fp.close()
+family = ini.general.family
+version = ini.general.version
+arch = ini.general.arch
+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.fedoraproject.org/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
+sed -e 's#^url .*#url --url=$url/releases/$ver/$os/$arch/os#' \
+    -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
+cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \
+  --name=node5 --mac=00:16:3e:12:34:59
+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
+
+%post --nochroot
+  cp ovirt-splash.xpm.gz $INSTALL_ROOT/boot/grub/splash.xpm.gz
+%end
diff --git a/ovirt-appliance-image.spec b/ovirt-appliance-image.spec
new file mode 100644
index 0000000..d7aea2f
--- /dev/null
+++ b/ovirt-appliance-image.spec
@@ -0,0 +1,103 @@
+%{!?ovirt_cache_dir: %define ovirt_cache_dir /var/tmp/ovirt-cache}
+%{!?ovirt_local_repo: %define ovirt_local_repo file://%{ovirt_cache_dir}/ovirt}
+%{!?ovirt_url: %define ovirt_url http://ovirt.org/repos/ovirt}
+%{!?thincrust_url: %define thincrust_url http://www.thincrust.net/repo}
+%{?fedora_url: %define fedora_tree_url %{fedora_url}/releases/%{fedora}/Fedora/%{_arch}/os}
+%{!?fedora_tree_url: %define fedora_tree_url http://download.fedoraproject.org/pub/fedora/linux/releases/%{fedora}/Fedora/%{_arch}/os}
+%{!?bad_pkgs: %define bad_pkgs rubygem-rails,rubygem-activesupport,rubygem-activerecord}
+%define fedora_mirror http://mirrors.fedoraproject.org/mirrorlist
+
+Summary: oVirt Appliance Image
+Name: ovirt-appliance-image
+Source1: version
+Version: %(echo `awk '{ print $1 }' %{SOURCE1}`)
+Release: %(echo `awk '{ print $2 }' %{SOURCE1}`)%{?dist}
+Source0: %{name}-%{version}.tar.gz
+License: Fedora
+Group: Applications/System
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+URL: http://ovirt.org/
+BuildRequires: appliance-tools
+BuildRequires: livecd-tools >= 017
+BuildRequires: syslinux
+BuildRequires: qemu-img
+BuildRequires: wget
+# FIXME: libvirt and kvm require ovirt specific patches presently due to
+# the fact that migration has not been fixed upstream.  Once upstream migration
+# is fixed, these Requires should be fixed.
+Requires: libvirt >= 0.4.4-2ovirt2
+Requires: kvm >= 72-3ovirt3
+Requires: /usr/bin/qemu-img
+
+%define app_root %{_datadir}/%{name}
+
+#  disable debuginfo, makes no sense for appliance and it is created empty anyway
+%define debug_package %{nil}
+
+%description
+The oVirt Appliance image and scripts to install on a Fedora Host
+
+%prep
+%setup -q
+
+%build
+if [ -n "%{?fedora_url}" ]; then
+   cat > repos.ks << EOF
+repo --name=f%{fedora} --baseurl=%{fedora_url}/releases/%{fedora}/Everything/%{_arch}/os
+repo --name=f%{fedora}-updates --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch} --excludepkgs=%{bad_pkgs}
+repo --name=f%{fedora}-updates-newkey --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch}.newkey --excludepkgs=%{bad_pkgs}
+EOF
+else
+  cat > repos.ks << EOF
+repo --name=f%{fedora} --mirrorlist=%{fedora_mirror}?repo=fedora-%{fedora}&arch=%{_arch}
+repo --name=f%{fedora}-updates --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}&arch=%{_arch} --excludepkgs=%{bad_pkgs}
+repo --name=f%{fedora}-updates-newkey --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}.newkey&arch=%{_arch} --excludepkgs=%{bad_pkgs}
+EOF
+fi
+
+cat >> repos.ks << EOF
+repo --name=ovirt-org --baseurl=%{ovirt_url}/%{fedora}/%{_arch}
+repo --name=ovirt-local --baseurl=%{ovirt_local_repo}
+repo --name=thincrust-org --baseurl=%{thincrust_url}/noarch
+EOF
+
+mkdir -p %{ovirt_cache_dir}/appliance-tmp/tree
+mkdir -p %{ovirt_cache_dir}/yum
+./gettree.sh %{fedora_tree_url} %{ovirt_cache_dir}/appliance-tmp/tree
+ln -s %{ovirt_cache_dir}/appliance-tmp tmp
+sudo su - -c "cd $(pwd) && appliance-creator --config ovirt-appliance-image.ks --name ovirt-appliance \
+                  --tmpdir='%{ovirt_cache_dir}/appliance-tmp' --cache='%{ovirt_cache_dir}/yum'"
+sudo su - -c "cd $(pwd) && chown -R $USER *"
+if [ -n "%{?skip_compress_image}" ]; then
+   mv ovirt-appliance-sda.raw ovirt-appliance.img
+else
+   qemu-img convert -c ovirt-appliance-sda.raw -O qcow2 ovirt-appliance-sda.qcow
+   mv ovirt-appliance-sda.qcow ovirt-appliance.img
+fi
+
+%install
+%{__rm} -rf %{buildroot}
+mkdir %{buildroot}
+
+%{__install} -d -m0755 %{buildroot}%{app_root}
+%{__install} -p -m0644 COPYING %{buildroot}%{app_root}
+%{__install} -d -m0755 %{buildroot}%{_localstatedir}/lib/libvirt/images
+%{__install} -p -m0644 ovirt-appliance.img %{buildroot}%{_localstatedir}/lib/libvirt/images
+%{__install} -d -m0755 %{buildroot}%{_sbindir}
+%{__install} -p -m0755 create-ovirt-appliance %{buildroot}%{_sbindir}
+
+%clean
+%{__rm} -rf %{buildroot}
+
+%files
+%defattr(-,root,root,0644)
+%{app_root}/COPYING
+%{_localstatedir}/lib/libvirt/images/ovirt-appliance.img
+%defattr(-,root,root,0755)
+%{_sbindir}/create-ovirt-appliance
+
+%changelog
+* Sun Sep 14 2008 Perry Myers <pmyers at redhat.com> 0.92-1
+- Added Requires on libvirt/kvm
+* Fri Sep 05 2008 Perry Myers <pmyers at redhat.com> 0.92-1
+- Initial build.
diff --git a/ovirt-appliance.ks b/ovirt-appliance.ks
deleted file mode 100644
index faa0bd4..0000000
--- a/ovirt-appliance.ks
+++ /dev/null
@@ -1,349 +0,0 @@
-install
-
-%include common-install.ks
-
-network --device=eth1 --bootproto=static --ip=192.168.50.2 --netmask=255.255.255.0 --onboot=on --nameserver=192.168.50.2 --hostname=management.priv.ovirt.org
-
-%include repos.ks
-
-%packages --nobase
-
-%include common-pkgs.ks
-
-%post
-exec > /root/kickstart-post.log 2>&1
-
-%include common-post.ks
-
-# FIXME [PATCH] fix SelinuxConfig firewall side-effect
-lokkit -f --nostart --disabled
-# FIXME imgcreate.kickstart.NetworkConfig doesn't store nameserver into ifcfg-*
-#       only in resolv.conf which gets overwritten by dhclient-script
-augtool <<EOF
-set /files/etc/sysconfig/network-scripts/ifcfg-eth0/PEERDNS no
-set /files/etc/sysconfig/network-scripts/ifcfg-eth1/DNS1 192.168.50.2
-save
-EOF
-
-# 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
-
-# Enable forwarding so this node can act as a router for the .50 network
-sed -i 's/net.ipv4.ip_forward = .*/net.ipv4.ip_forward = 1/' /etc/sysctl.conf
-cat > /etc/sysconfig/iptables << EOF
-*nat
--A POSTROUTING -o eth0 -j MASQUERADE
-COMMIT
-EOF
-
-# 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 Server
-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
-
-# make collectd.conf.
-cat > /etc/collectd.conf << \EOF
-LoadPlugin network
-LoadPlugin logfile
-LoadPlugin rrdtool
-LoadPlugin unixsock
-
-<Plugin logfile>
-        LogLevel info
-        File STDOUT
-</Plugin>
-
-<Plugin network>
-        Listen "0.0.0.0"
-</Plugin>
-
-<Plugin rrdtool>
-        DataDir "/var/lib/collectd/rrd"
-        CacheTimeout 120
-        CacheFlush   900
-</Plugin>
-
-<Plugin unixsock>
-        SocketFile "/var/lib/collectd/unixsock"
-</Plugin>
-
-EOF
-
-
-principal=ovirtadmin
-password=ovirt
-first_run_file=/etc/init.d/ovirt-server-appliance-first-run
-sed -e "s, at principal@,$principal," \
-    -e "s, at password@,$password,g" \
-   > $first_run_file << \EOF
-#!/bin/bash
-#
-# ovirt-server-appliance-first-run First run configuration for oVirt Server Appliance
-#
-# chkconfig: 3 95 01
-# description: ovirt server appliance first run configuration
-#
-
-# Source functions library
-. /etc/init.d/functions
-
-export PATH=/usr/kerberos/bin:$PATH
-
-start() {
-	echo -n "Starting ovirt-server-appliance-first-run: "
-	(
-	# workaround for https://bugzilla.redhat.com/show_bug.cgi?id=451936
-	sed -i '/\[kdcdefaults\]/a \ kdc_ports = 88' /usr/share/ipa/kdc.conf.template
-	# set up freeipa
-	ipa-server-install -r PRIV.OVIRT.ORG -p @password@ -P @password@ -a @password@ \
-	  --hostname management.priv.ovirt.org -u dirsrv -U
-
-        # workaround for https://bugzilla.redhat.com/show_bug.cgi?id=459061
-        # note: this has to happen after ipa-server-install or the templating
-	# feature in ipa-server-install chokes on the characters in the regexp
-	# we add here.
-        sed -i -e 's#<Proxy \*>#<ProxyMatch ^.*/ipa/ui.*$>#' \
-          /etc/httpd/conf.d/ipa.conf
-        sed -i -e 's#</Proxy>#</ProxyMatch>#' /etc/httpd/conf.d/ipa.conf
-        # workaround for https://bugzilla.redhat.com/show_bug.cgi?id=459209
-        sed -i -e 's/^/#/' /etc/httpd/conf.d/ipa-rewrite.conf
-	service httpd restart
-	# now create the ovirtadmin user
-	echo @password@|kinit admin
-	# change max username length policy
-	ldapmodify -h management.priv.ovirt.org -p 389 -Y GSSAPI <<LDAP
-dn: cn=ipaConfig,cn=etc,dc=priv,dc=ovirt,dc=org
-changetype: modify
-replace: ipaMaxUsernameLength
-ipaMaxUsernameLength: 12
-LDAP
-	ipa-adduser -f Ovirt -l Admin -p @password@ @principal@
-	# make ovitadmin also an IPA admin
-	ipa-modgroup -a ovirtadmin admins
-	ipa-moduser --setattr krbPasswordExpiration=19700101000000Z @principal@
-
-	) > /var/log/ovirt-server-appliance-first-run.log 2>&1
-	RETVAL=$?
-	if [ $RETVAL -eq 0 ]; then
-		echo_success
-	else
-		echo_failure
-	fi
-	echo
-}
-
-case "$1" in
-  start)
-        start
-        ;;
-  *)
-        echo "Usage: ovirt-server-appliance-first-run {start}"
-        exit 2
-esac
-
-chkconfig ovirt-server-appliance-first-run off
-EOF
-chmod +x $first_run_file
-chkconfig ovirt-server-appliance-first-run on
-
-cat > /etc/init.d/ovirt-server-appliance << \EOF
-#!/bin/bash
-#
-# ovirt-server-appliance oVirt Server Appliance service
-#
-# chkconfig: 3 60 40
-# description: ovirt server Appliance service
-#
-
-# Source functions library
-. /etc/init.d/functions
-
-start() {
-    echo -n "Starting ovirt-server-appliance: "
-    dnsmasq -i eth1 -F 192.168.50.6,192.168.50.252 \
-        -G 00:16:3e:12:34:57,192.168.50.3 -G 00:16:3e:12:34:58,192.168.50.4 \
-        -G 00:16:3e:12:34:59,192.168.50.5 \
-        -s priv.ovirt.org \
-        -W _ovirt._tcp,management.priv.ovirt.org,80 \
-        -W _ipa._tcp,management.priv.ovirt.org,80 \
-        -W _ldap._tcp,management.priv.ovirt.org,389 \
-        -W _collectd._tcp,management.priv.ovirt.org,25826 \
-        -W _identify._tcp,management.priv.ovirt.org,12120 \
-        --enable-tftp --tftp-root=/var/lib/tftpboot -M pxelinux.0 \
-        -O option:router,192.168.50.2 -O option:ntp-server,192.168.50.2 \
-        --dhcp-option=12 \
-        -R --local /priv.ovirt.org/ --server 192.168.122.1
-
-    # Set up the fake iscsi target
-    tgtadm --lld iscsi --op new --mode target --tid 1 \
-        -T ovirtpriv:storage
-
-    #
-    # Now associate them to the backing stores
-    #
-    tgtadm --lld iscsi --op new --mode logicalunit --tid 1 \
-        --lun 1 -b /ovirtiscsi/iSCSI3
-    tgtadm --lld iscsi --op new --mode logicalunit --tid 1 \
-        --lun 2 -b /ovirtiscsi/iSCSI4
-    tgtadm --lld iscsi --op new --mode logicalunit --tid 1 \
-        --lun 3 -b /ovirtiscsi/iSCSI5
-
-    #
-    # Now make them available
-    #
-    tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
-
-    echo_success
-    echo
-}
-
-stop() {
-    echo -n "Stopping ovirt-server-appliance: "
-
-    # stop access to the iscsi target
-    tgtadm --lld iscsi --op unbind --mode target --tid 1 -I ALL
-
-    # unbind the LUNs
-    tgtadm --lld iscsi --op delete --mode logicalunit --tid 1 --lun 3
-    tgtadm --lld iscsi --op delete --mode logicalunit --tid 1 --lun 2
-    tgtadm --lld iscsi --op delete --mode logicalunit --tid 1 --lun 1
-
-    # shutdown the target
-    tgtadm --lld iscsi --op delete --mode target --tid 1
-
-    kill $(cat /var/run/dnsmasq.pid)
-
-    echo_success
-    echo
-}
-
-case "$1" in
-    start)
-        start
-        ;;
-    stop)
-        stop
-        ;;
-    restart)
-        stop
-        start
-        ;;
-    *)
-        echo "Usage: ovirt-server-appliance {start|stop|restart}"
-        exit 2
-esac
-EOF
-chmod +x /etc/init.d/ovirt-server-appliance
-chkconfig ovirt-server-appliance on
-
-%end
-
-%post --nochroot
-  # distribution tree is ready in tmp/tree
-  set -e
-  python -c '
-from iniparse.ini import INIConfig
-ini = INIConfig()
-fp = open("tmp/tree/.treeinfo")
-ini.readfp(fp)
-fp.close()
-family = ini.general.family
-version = ini.general.version
-arch = ini.general.arch
-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.fedoraproject.org/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
-sed -e 's#^url .*#url --url=$url/releases/$ver/$os/$arch/os#' \
-    -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
-cobbler system add --netboot-enabled=1 --profile=oVirt-Node-$arch \
-  --name=node5 --mac=00:16:3e:12:34:59
-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
-  # ovirt/ovirt
-  echo ovirt:Cobbler:68db208a546dcedf34edf0b4fe0ab1f2 > /etc/cobbler/users.digest
-  # make cobbler check happier
-  mkdir -p /etc/vsftpd
-  touch /etc/vsftpd/vsftpd.conf
-  # 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
diff --git a/ovirt-appliance.spec b/ovirt-appliance.spec
deleted file mode 100644
index 8a2158e..0000000
--- a/ovirt-appliance.spec
+++ /dev/null
@@ -1,101 +0,0 @@
-%{!?ovirt_cache_dir: %define ovirt_cache_dir /var/tmp/ovirt-cache}
-%{!?ovirt_local_repo: %define ovirt_local_repo file://%{ovirt_cache_dir}/ovirt}
-%{!?ovirt_url: %define ovirt_url http://ovirt.org/repos/ovirt}
-%{?fedora_url: %define fedora_tree_url %{fedora_url}/releases/%{fedora}/Fedora/%{_arch}/os}
-%{!?fedora_tree_url: %define fedora_tree_url http://download.fedoraproject.org/pub/fedora/linux/releases/%{fedora}/Fedora/%{_arch}/os}
-%{!?bad_pkgs: %define bad_pkgs rubygem-rails,rubygem-activesupport,rubygem-activerecord}
-%define fedora_mirror http://mirrors.fedoraproject.org/mirrorlist
-
-Summary: oVirt Appliance
-Name: ovirt-appliance
-Source1: version
-Version: %(echo `awk '{ print $1 }' %{SOURCE1}`)
-Release: %(echo `awk '{ print $2 }' %{SOURCE1}`)%{?dist}
-Source0: %{name}-%{version}.tar.gz
-License: Fedora
-Group: Applications/System
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
-URL: http://ovirt.org/
-BuildRequires: appliance-tools
-BuildRequires: livecd-tools >= 017
-BuildRequires: syslinux
-BuildRequires: qemu-img
-BuildRequires: wget
-# FIXME: libvirt and kvm require ovirt specific patches presently due to
-# the fact that migration has not been fixed upstream.  Once upstream migration
-# is fixed, these Requires should be fixed.
-Requires: libvirt >= 0.4.4-2ovirt2
-Requires: kvm >= 72-3ovirt3
-Requires: /usr/bin/qemu-img
-
-%define app_root %{_datadir}/%{name}
-
-#  disable debuginfo, makes no sense for appliance and it is created empty anyway
-%define debug_package %{nil}
-
-%description
-The oVirt Appliance image and scripts to install on a Fedora Host
-
-%prep
-%setup -q
-
-%build
-if [ -n "%{?fedora_url}" ]; then
-   cat > repos.ks << EOF
-repo --name=f%{fedora} --baseurl=%{fedora_url}/releases/%{fedora}/Everything/%{_arch}/os
-repo --name=f%{fedora}-updates --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch} --excludepkgs=%{bad_pkgs}
-repo --name=f%{fedora}-updates-newkey --baseurl=%{fedora_url}/updates/%{fedora}/%{_arch}.newkey --excludepkgs=%{bad_pkgs}
-EOF
-else
-  cat > repos.ks << EOF
-repo --name=f%{fedora} --mirrorlist=%{fedora_mirror}?repo=fedora-%{fedora}&arch=%{_arch}
-repo --name=f%{fedora}-updates --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}&arch=%{_arch} --excludepkgs=%{bad_pkgs}
-repo --name=f%{fedora}-updates-newkey --mirrorlist=%{fedora_mirror}?repo=updates-released-f%{fedora}.newkey&arch=%{_arch} --excludepkgs=%{bad_pkgs}
-EOF
-fi
-
-cat >> repos.ks << EOF
-repo --name=ovirt-org --baseurl=%{ovirt_url}/%{fedora}/%{_arch}
-repo --name=ovirt-local --baseurl=%{ovirt_local_repo}
-EOF
-
-mkdir -p %{ovirt_cache_dir}/appliance-tmp/tree
-mkdir -p %{ovirt_cache_dir}/yum
-./gettree.sh %{fedora_tree_url} %{ovirt_cache_dir}/appliance-tmp/tree
-ln -s %{ovirt_cache_dir}/appliance-tmp tmp
-sudo su - -c "cd $(pwd) && appliance-creator --config ovirt-appliance.ks --name %{name} \
-                  --tmpdir='%{ovirt_cache_dir}/appliance-tmp' --cache='%{ovirt_cache_dir}/yum'"
-sudo su - -c "cd $(pwd) && chown -R $USER *"
-if [ -n "%{?skip_compress_image}" ]; then
-   mv %{name}-sda.raw %{name}.img
-else
-   qemu-img convert -c %{name}-sda.raw -O qcow2 %{name}-sda.qcow
-   mv %{name}-sda.qcow %{name}.img
-fi
-
-%install
-%{__rm} -rf %{buildroot}
-mkdir %{buildroot}
-
-%{__install} -d -m0755 %{buildroot}%{app_root}
-%{__install} -p -m0644 COPYING %{buildroot}%{app_root}
-%{__install} -d -m0755 %{buildroot}%{_localstatedir}/lib/libvirt/images
-%{__install} -p -m0644 %{name}.img %{buildroot}%{_localstatedir}/lib/libvirt/images
-%{__install} -d -m0755 %{buildroot}%{_sbindir}
-%{__install} -p -m0755 create-%{name} %{buildroot}%{_sbindir}
-
-%clean
-%{__rm} -rf %{buildroot}
-
-%files
-%defattr(-,root,root,0644)
-%{app_root}/COPYING
-%{_localstatedir}/lib/libvirt/images/%{name}.img
-%defattr(-,root,root,0755)
-%{_sbindir}/create-%{name}
-
-%changelog
-* Sun Sep 14 2008 Perry Myers <pmyers at redhat.com> 0.92-1
-- Added Requires on libvirt/kvm
-* Fri Sep 05 2008 Perry Myers <pmyers at redhat.com> 0.92-1
-- Initial build.
-- 
1.5.5.1




More information about the ovirt-devel mailing list