David Huff
2009-Oct-14 20:09 UTC
[Ovirt-devel] Refactor ovirt-node code base for inclusion in Fedora
Main reason for refactor is no ovirt-node-image binary image allowed in fedora. Moves tools and kickstart files form ovirt-node-image to subpackage ovirt-node-recipe. Removes old sub packages form ovirt-node, stateless, logos, selinux. Modifies init scripts to meet Fedora packaging guidelines: added status, reload, and lockfile, rhbz: 514221 Added License file.
David Huff
2009-Oct-14 20:09 UTC
[Ovirt-devel] [PATCH 01/10] Modified init scripts for inclusion in Fedora
ovirt
ovirt-early
ovirt-firstboot
ovirt-post
Added reload to init functions
Added status
Added lockfile
---
scripts/ovirt | 18 ++++++++++++++++++
scripts/ovirt-early | 16 ++++++++++++++++
scripts/ovirt-firstboot | 18 +++++++++++++++++-
scripts/ovirt-post | 18 ++++++++++++++++++
4 files changed, 69 insertions(+), 1 deletions(-)
diff --git a/scripts/ovirt b/scripts/ovirt
index 4ff03f2..9503c06 100755
--- a/scripts/ovirt
+++ b/scripts/ovirt
@@ -10,7 +10,13 @@
. /etc/init.d/functions
. /etc/init.d/ovirt-functions
+prog=ovirt
+lockfile=/var/lock/subsys/$prog
+
start() {
+
+ touch $lockfile
+
if is_standalone; then
return 0
fi
@@ -74,6 +80,8 @@ start() {
else
log "skipping libvirt-qpid and matahari configuration, could not
find $libvirt_qpid_conf"
fi
+
+ rm -f $lockfile
}
case "$1" in
@@ -89,6 +97,16 @@ case "$1" in
test $? == 0 && success || failure
echo
;;
+ status)
+ status $prog
+ ;;
+ reload)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
*)
echo "Usage: ovirt {start}"
exit 2
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index cdd4afd..dcbcac4 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -10,6 +10,9 @@
. /etc/init.d/functions
. /etc/init.d/ovirt-functions
+prog=ovirt-early
+lockfile=/var/lock/subsys/$prog
+
BONDING_MODCONF_FILE=/etc/modprobe.d/bonding
AUGTOOL_CONFIG=/var/tmp/augtool-config
@@ -130,6 +133,7 @@ find_disk() {
start() {
+ touch $lockfile
# oVirt boot parameters
# BOOTIF=link|eth*|<MAC> (appended by pxelinux)
# ovirt_init=[usb|scsi[:serial#]|/dev/...]
@@ -433,6 +437,8 @@ start() {
fi
fi
fi
+
+ rm -f $lockfile
return 0
}
@@ -481,6 +487,16 @@ case "$1" in
test $? == 0 && success || failure
echo
;;
+ status)
+ status $prog
+ ;;
+ reload)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
*)
echo "Usage: ovirt-early {start}"
exit 2
diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot
index bdafb33..335bdaa 100755
--- a/scripts/ovirt-firstboot
+++ b/scripts/ovirt-firstboot
@@ -27,6 +27,9 @@
. /etc/init.d/functions
. /etc/init.d/ovirt-functions
+prog=ovirt-firstboot
+lockfile=/var/lock/subsys/$prog
+
trap '__st=$?; stop_log; exit $__st' 0
trap 'exit $?' 1 2 13 15
@@ -35,6 +38,8 @@ start ()
if ! is_firstboot && ! is_auto_install; then
return
fi
+
+ touch $lockfile
# by default in standalone, disable collectd until server is configured
service collectd stop > /dev/null 2>&1
@@ -63,6 +68,8 @@ start ()
disable_firstboot
ovirt_store_firstboot_config >> $OVIRT_LOGFILE 2>&1
+
+ rm -f $lockfile
}
case "$1" in
@@ -78,7 +85,16 @@ case "$1" in
test $? == 0 && success || failure
echo
;;
-
+ status)
+ status $prog
+ ;;
+ reload)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
*)
echo "Usage: ovirt-firstboot {start}"
exit 2
diff --git a/scripts/ovirt-post b/scripts/ovirt-post
index 1fcfd6a..5cc8b8a 100755
--- a/scripts/ovirt-post
+++ b/scripts/ovirt-post
@@ -10,6 +10,9 @@
. /etc/init.d/functions
. /etc/init.d/ovirt-functions
+prog=ovirt-post
+lockfile=/var/lock/subsys/$prog
+
start() {
# wait for libvirt to finish initializing
local count=0
@@ -24,6 +27,9 @@ start() {
count=$(expr $count + 1)
sleep 1
fi
+
+ touch $lockfile
+
done
BACKUP=$(mktemp)
ISSUE=/etc/issue
@@ -61,6 +67,8 @@ start() {
# Removed ovirt-identify-node since it has now
# been replaced with the matahari qmf agent.
+
+ rm -f $lockfile
}
case "$1" in
@@ -76,6 +84,16 @@ case "$1" in
test $? == 0 && success || failure
echo
;;
+ status)
+ status $prog
+ ;;
+ reload)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
*)
echo "Usage: ovirt-post {start}"
exit 2
--
1.6.2.5
David Huff
2009-Oct-14 20:09 UTC
[Ovirt-devel] [PATCH 02/10] Added recipe dir and ks files
---
recipe/common-blacklist.ks | 161 +++++++++++++++++++++++++++++++++++++++++
recipe/common-install.ks | 19 +++++
recipe/common-pkgs.ks | 75 +++++++++++++++++++
recipe/common-post.ks | 170 ++++++++++++++++++++++++++++++++++++++++++++
recipe/ovirt-node-image.ks | 118 ++++++++++++++++++++++++++++++
5 files changed, 543 insertions(+), 0 deletions(-)
create mode 100644 recipe/common-blacklist.ks
create mode 100644 recipe/common-install.ks
create mode 100644 recipe/common-pkgs.ks
create mode 100644 recipe/common-post.ks
create mode 100644 recipe/ovirt-node-image.ks
diff --git a/recipe/common-blacklist.ks b/recipe/common-blacklist.ks
new file mode 100644
index 0000000..81f46d6
--- /dev/null
+++ b/recipe/common-blacklist.ks
@@ -0,0 +1,161 @@
+# -*-Shell-script-*-
+%post
+
+echo "Removing excess RPMs"
+
+# kernel pulls in mkinitrd which pulls in isomd5sum which pulls in python,
+# and livecd-tools needs lokkit to configure SELinux.
+# However, this is just an install-time dependency; we can remove
+# it afterwards, which we do here
+RPMS="system-config-firewall-tui system-config-network-tui rhpl \
+ rpm-python kudzu libsemanage-python"
+
+RPMS="$RPMS mkinitrd isomd5sum dmraid checkpolicy"
+
+# Remove additional RPMs forcefully
+RPMS="$RPMS gamin pm-utils kbd usermode vbetool ConsoleKit hdparm \
+ efibootmgr linux-atm-libs fedora-release-notes \
+ psmisc cryptsetup-luks pciutils mtools syslinux \
+ wireless-tools radeontool libicu gnupg2 \
+ fedora-logos"
+
+# cronie pulls in exim (sendmail) which pulls in all kinds of perl deps
+RPMS="$RPMS exim perl-version perl-Pod-Simple perl-libs
perl-Module-Pluggable \
+ perl-Pod-Escapes perl"
+
+RPMS="$RPMS sysklogd"
+
+# workaround for gpxe issue with the virt-preview qemu on F11 host kernel
+# https://bugzilla.redhat.com/show_bug.cgi?id=512358
+RPMS="$RPMS gpxe-roms-qemu"
+ln -snf ../etherboot/e1000-82542.zrom /usr/share/qemu/pxe-e1000.bin
+ln -snf ../etherboot/ne.zrom /usr/share/qemu/pxe-ne2k_pci.bin
+ln -snf ../etherboot/pcnet32.zrom /usr/share/qemu/pxe-pcnet.bin
+ln -snf ../etherboot/rtl8139.zrom /usr/share/qemu/pxe-rtl8139.bin
+ln -snf ../etherboot/virtio-net.zrom /usr/share/qemu/pxe-virtio.bin
+
+# Things we could probably remove if libvirt didn't link against them
+#RPMS="$RPMS avahi PolicyKit xen-libs"
+
+# Things we could probably remove if qemu-kvm didn't link against them
+#RPMS="$RPMS SDL alsa-lib"
+
+# Pam complains when this is missing
+#RPMS="$RPM ConsoleKit-libs"
+
+for rpm in $RPMS; do
+ rpm -v -e --nodeps $rpm 2> /dev/null
+done
+
+# the following are lists of kernel modules we are pretty sure we won't
need;
+# note that these can be single files or whole directories. They are specified
+# starting at $MODULES; so if you want to remove the NLS stuff from the
+# fs subdir, your mods entry would be "fs/nls"
+fs_mods="fs/nls fs/9p fs/affs fs/autofs fs/autofs4 fs/befs fs/bfs fs/cifs
\
+ fs/coda fs/cramfs fs/dlm fs/ecryptfs fs/efs fs/exportfs fs/ext4 \
+ fs/freevxfs fs/gfs2 fs/hfs fs/hfsplus fs/jbd2 fs/jffs \
+ fs/jffs2 fs/jfs fs/minix fs/ncpfs fs/ocfs2 fs/qnx4 fs/reiserfs \
+ fs/romfs fs/sysv fs/udf fs/ufs fs/xfs"
+
+net_mods="net/9p net/appletalk net/atm net/ax25 \
+ net/bluetooth net/dccp net/decnet net/ieee80211 net/ipx net/irda \
+ net/mac80211 net/netrom net/rfkill net/rose net/sched net/tipc \
+ net/wanrouter net/wireless"
+
+driver_mods="drivers/auxdisplay drivers/net/appletalk \
+ drivers/net/hamradio drivers/net/pcmcia drivers/net/tokenring \
+ drivers/net/wireless drivers/net/irda drivers/atm drivers/usb/atm \
+ drivers/acpi drivers/char/drm drivers/char/mwave \
+ drivers/char/ipmp drivers/char/pcmcia drivers/crypto drivers/dca \
+ drivers/firmware drivers/memstick drivers/mmc drivers/mfs \
+ drivers/parport drivers/video drivers/watchdog drivers/net/ppp* \
+ drivers/usb/serial drivers/usb/misc drivers/usb/class \
+ drivers/usb/image drivers/rtc drivers/char/lp*"
+
+misc_mods="drivers/bluetooth drivers/firewire drivers/i2c drivers/isdn \
+ drivers/media drivers/misc drivers/leds drivers/mtd drivers/w1 sound \
+ drivers/input drivers/pcmcia drivers/scsi/pcmcia"
+
+echo "Removing excess kernel modules"
+MODULES="/lib/modules/*/kernel"
+RM="rm -rf"
+
+for mods in $fs_mods $net_mods $misc_mods $driver_mods ; do
+ $RM $MODULES/$mods
+done
+
+echo "Removing all timezones except for UTC"
+find /usr/share/zoneinfo -regextype egrep -type f \
+ ! -regex ".*/UTC|.*/GMT" -exec $RM {} \;
+
+echo "Removing blacklisted files and directories"
+blacklist="/etc/alsa /etc/pki /usr/share/hwdata/MonitorsDB \
+ /usr/share/hwdata/oui.txt /usr/share/hwdata/videoaliases \
+ /usr/share/firstboot /usr/share/lua /usr/share/kde4 /usr/share/pixmaps \
+ /usr/share/hwdata/videodrivers /usr/share/icons /usr/share/fedora-release \
+ /usr/share/tabset /usr/share/libvirt /usr/share/augeas/lenses/tests \
+ /usr/share/tc /usr/share/emacs /usr/share/info \
+ /usr/src /usr/etc /usr/games /usr/include /usr/local \
+
/usr/sbin/{dell*,sasldblistusers2,build-locale-archive,glibc_post_upgrade.*}"
+blacklist_lib="/usr/{,lib64}/tc \
+ /usr/lib{,64}/tls /usr/lib{,64}/sse2 \
+ /usr/lib{,64}/pkgconfig /usr/lib{,64}/nss \
+ /usr/lib{,64}/games /usr/lib{,64}/alsa-lib /usr/lib{,64}/fs/reiserfs \
+ /usr/lib{,64}/krb5 /usr/lib{,64}/hal /usr/lib{,64}/gio \
+ /usr/lib/locale /usr/lib/syslinux"
+blacklist_pango="/usr/lib{,64}/pango /usr/lib{,64}/libpango* \
+ /etc/pango /usr/bin/pango*"
+blacklist_hal="/usr/bin/hal-disable-polling \
+ /usr/bin/hal-is-caller-locked-out /usr/bin/hal-is-caller-privileged \
+ /usr/bin/hal-lock /usr/bin/hal-set-property /usr/bin/hal-setup-keymap"
+blacklist_ssh="/usr/bin/sftp /usr/bin/slogin /usr/bin/ssh /usr/bin/ssh-add
\
+ /usr/bin/ssh-agent /usr/bin/ssh-copy-id /usr/bin/ssh-keyscan"
+blacklist_docs="/usr/share/omf /usr/share/gnome /usr/share/doc \
+ /usr/share/locale /usr/share/libthai /usr/share/man \
+ /usr/share/X11 /usr/share/i18n"
+
+eval $RM $blacklist $blacklist_lib $blacklist_pango $blacklist_hal \
+ $blacklist_ssh $blacklist_docs
+
+echo "Cleanup empty directory structures in /usr/share"
+find /usr/share -type d -exec rmdir {} \; > /dev/null 2>&1
+
+echo "Cleanup excess selinux modules"
+$RM /usr/share/selinux
+
+echo "Removing python source files"
+find / -name '*.py' -exec rm -f {} \;
+find / -name '*.pyo' -exec rm -f {} \;
+
+echo "Running image-minimizer..."
+%end
+
+%post --nochroot --interpreter image-minimizer
+drop /usr/lib/libboost*
+keep /usr/lib/libboost_program_options.so*
+keep /usr/lib/libboost_filesystem.so*
+keep /usr/lib/libboost_thread-mt.so*
+keep /usr/lib/libboost_system.so*
+drop /usr/lib64/libboost*
+keep /usr/lib64/libboost_program_options.so*
+keep /usr/lib64/libboost_filesystem.so*
+keep /usr/lib64/libboost_thread-mt.so*
+keep /usr/lib64/libboost_system.so*
+drop /usr/kerberos
+keep /usr/kerberos/bin/kinit
+keep /usr/kerberos/bin/klist
+drop /lib/firmware
+keep /lib/firmware/3com
+keep /lib/firmware/acenic
+keep /lib/firmware/adaptec
+keep /lib/firmware/advansys
+keep /lib/firmware/bnx2
+keep /lib/firmware/cxgb3
+keep /lib/firmware/e100
+keep /lib/firmware/myricom
+keep /lib/firmware/qlogic
+keep /lib/firmware/sun
+keep /lib/firmware/tehuti
+keep /lib/firmware/tigon
+%end
+
diff --git a/recipe/common-install.ks b/recipe/common-install.ks
new file mode 100644
index 0000000..d6620f7
--- /dev/null
+++ b/recipe/common-install.ks
@@ -0,0 +1,19 @@
+lang C
+keyboard us
+timezone --utc UTC
+auth --useshadow --enablemd5
+selinux --enforcing
+firewall --disabled
+part / --size 650 --fstype ext2
+services
--enabled=auditd,ntpd,ntpdate,collectd,iptables,network,rsyslog,libvirt-qpid,multipathd
+# This requires a new fixed version of livecd-creator to honor the --append
settings.
+bootloader --timeout=30 --append="console=tty0
console=ttyS0,115200n8"
+
+# not included by default in Fedora 10 livecd initramfs
+device virtio_blk
+device virtio_pci
+device scsi_wait_scan
+
+# multipath kmods
+device dm-multipath
+device dm-round-robin
diff --git a/recipe/common-pkgs.ks b/recipe/common-pkgs.ks
new file mode 100644
index 0000000..daff195
--- /dev/null
+++ b/recipe/common-pkgs.ks
@@ -0,0 +1,75 @@
+audit
+bc
+kernel
+hwdata
+passwd
+policycoreutils
+rootfiles
+dhclient
+openssh-clients
+openssh-server
+kvm
+libmlx4
+ovirt-node
+-selinux-policy-targeted
+selinux-policy-minimum
+vim-minimal
+sudo
+python
+python-libs
+python-setuptools
+db4
+vconfig
+python-virtinst
+matahari
+#debugging
+hdparm
+sos
+gdb
+ltrace
+strace
+sysstat
+tcpdump
+pstack
+pciutils
+numactl
+file
+lsof
+newt-python
+/usr/bin/kvmtrace
+#remove
+-audit-libs-python
+-ustr
+-authconfig
+-wireless-tools
+-setserial
+-prelink
+-newt-python
+-newt
+-kudzu
+-libselinux-python
+-rhpl
+-kbd
+-usermode
+-fedora-logos
+-dmraid
+-gzip
+-less
+-which
+-parted
+-nash
+-tar
+-libuser
+-mtools
+-cpio
+-sysklogd
+/usr/sbin/lokkit
+isomd5sum
+irqbalance
+cpuspeed
+acpid
+device-mapper-multipath
+kpartx
+# workaround for gpxe issue with the virt-preview qemu on F11 host kernel
+# https://bugzilla.redhat.com/show_bug.cgi?id=512358
+etherboot-zroms-kvm
diff --git a/recipe/common-post.ks b/recipe/common-post.ks
new file mode 100644
index 0000000..7cebef0
--- /dev/null
+++ b/recipe/common-post.ks
@@ -0,0 +1,170 @@
+# -*-Shell-script-*-
+echo "Starting Kickstart Post"
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+export PATH
+
+# Import SELinux Modules
+echo "Enabling selinux modules"
+SEMODULES="base automount avahi consolekit cyrus dhcp dnsmasq guest hal
ipsec \
+iscsi kerberos kerneloops ldap lockdev logadm mozilla ntp ovirt-node-selinux \
+polkit portmap qemu rpcbind sasl snmp stunnel sysstat tcpd unprivuser \
+unconfined usbmodules userhelper virt"
+
+lokkit -v --selinuxtype=minimum
+tmpdir=$(mktemp -d)
+
+for semodule in $SEMODULES; do
+ found=0
+ pp_file=/usr/share/selinux/minimum/$semodule.pp
+ if [ -f $pp_file.bz2 ]; then
+ bzip2 -dc $pp_file.bz2 > "$tmpdir/$semodule.pp"
+ rm $pp_file.bz2
+ found=1
+ elif [ -f $pp_file ]; then
+ mv $pp_file "$tmpdir"
+ found=1
+ fi
+ # Don't put "base.pp" on the list.
+ test $semodule = base \
+ && continue
+ test $found=1 \
+ && modules="$modules $semodule.pp"
+done
+
+if test -n "$modules"; then
+ (cd "$tmpdir" \
+ && test -f base.pp \
+ && semodule -v -b base.pp -i $modules \
+ && semodule -v -B )
+fi
+rm -rf "$tmpdir"
+
+echo "Running ovirt-install-node-stateless"
+ovirt-install-node-stateless
+
+echo "Creating shadow files"
+# because we aren't installing authconfig, we aren't setting up shadow
+# and gshadow properly. Do it by hand here
+pwconv
+grpconv
+
+echo "Forcing C locale"
+# force logins (via ssh, etc) to use C locale, since we remove locales
+cat >> /etc/profile << \EOF
+# oVirt: force our locale to C since we don't have locale stuff'
+export LC_ALL=C LANG=C
+EOF
+
+echo "Configuring IPTables"
+# here, we need to punch the appropriate holes in the firewall
+cat > /etc/sysconfig/iptables << \EOF
+# oVirt automatically generated firewall configuration
+*filter
+:INPUT ACCEPT [0:0]
+:FORWARD ACCEPT [0:0]
+:OUTPUT ACCEPT [0:0]
+-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
+-A INPUT -p icmp -j ACCEPT
+-A INPUT -i lo -j ACCEPT
+# libvirt
+-A INPUT -p tcp --dport 16509 -j ACCEPT
+# SSH
+-A INPUT -p tcp --dport 22 -j ACCEPT
+# anyterm
+-A INPUT -p tcp --dport 81 -j ACCEPT
+# guest consoles
+-A INPUT -p tcp -m multiport --dports 5800:6000 -j ACCEPT
+# migration
+-A INPUT -p tcp -m multiport --dports 49152:49216 -j ACCEPT
+-A INPUT -j REJECT --reject-with icmp-host-prohibited
+-A FORWARD -m physdev ! --physdev-is-bridged -j REJECT --reject-with
icmp-host-prohibited
+COMMIT
+EOF
+# configure IPv6 firewall, default is all ACCEPT
+cat > /etc/sysconfig/ip6tables << \EOF
+# oVirt automatically generated firewall configuration
+*filter
+:INPUT ACCEPT [0:0]
+:FORWARD ACCEPT [0:0]
+:OUTPUT ACCEPT [0:0]
+-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
+-A INPUT -p ipv6-icmp -j ACCEPT
+-A INPUT -i lo -j ACCEPT
+# libvirt
+-A INPUT -p tcp --dport 16509 -j ACCEPT
+# SSH
+-A INPUT -p tcp --dport 22 -j ACCEPT
+# anyterm
+-A INPUT -p tcp --dport 81 -j ACCEPT
+# guest consoles
+-A INPUT -p tcp -m multiport --dports 5800:6000 -j ACCEPT
+# migration
+-A INPUT -p tcp -m multiport --dports 49152:49216 -j ACCEPT
+-A INPUT -j REJECT --reject-with icmp6-adm-prohibited
+-A FORWARD -m physdev ! --physdev-is-bridged -j REJECT --reject-with
icmp6-adm-prohibited
+COMMIT
+EOF
+
+# remove errors from /sbin/dhclient-script
+DHSCRIPT=/sbin/dhclient-script
+sed -i 's/mv /cp -p /g' $DHSCRIPT
+sed -i '/rm -f.*${interface}/d' $DHSCRIPT
+sed -i '/rm -f \/etc\/localtime/d' $DHSCRIPT
+sed -i '/rm -f \/etc\/ntp.conf/d' $DHSCRIPT
+sed -i '/rm -f \/etc\/yp.conf/d' $DHSCRIPT
+
+if rpm -q --qf '%{release}' ovirt-node | grep -q "^0\." ;
then
+ echo "Building in developer mode, leaving root account unlocked"
+ augtool <<\EOF
+set /files/etc/ssh/sshd_config/PermitEmptyPasswords yes
+save
+EOF
+else
+ echo "Building in production mode, locking root account"
+ passwd -l root
+fi
+
+# directories required in the image with the correct perms
+# config persistance currently handles only regular files
+mkdir -p /root/.ssh
+chmod 700 /root/.ssh
+
+# fix iSCSI/LVM startup issue
+sed -i
's/node\.session\.initial_login_retry_max.*/node.session.initial_login_retry_max
= 60/' /etc/iscsi/iscsid.conf
+
+# root's bash profile
+cat >> /root/.bashrc <<EOF
+# aliases used for the temporary
+function mod_vi() {
+ /bin/vi \$@
+ restorecon -v \$@
+}
+alias vi="mod_vi"
+alias ping='ping -c 3'
+EOF
+
+# copy logos
+cp /usr/share/ovirt-node/grub-splash.xpm.gz /boot/grub/splash.xpm.gz
+cp /usr/share/ovirt-node/syslinux-vesa-splash.jpg
usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg
+
+# Remove the default logrotate daily cron job
+# since we run it every 10 minutes instead.
+rm -f /etc/cron.daily/logrotate
+
+# comment out /etc/* entries in rwtab to prevent overlapping mounts
+touch /var/lib/random-seed
+mkdir /live
+mkdir /boot
+sed -i '/^files \/etc*/ s/^/#/' /etc/rwtab
+cat > /etc/rwtab.d/ovirt <<EOF
+dirs /var/lib/multipath
+files /etc
+files /var/cache/libvirt
+files /var/cache/hald
+files /var/empty/sshd/etc/localtime
+files /var/lib/dbus
+files /var/lib/libvirt
+empty /mnt
+empty /live
+empty /boot
+EOF
diff --git a/recipe/ovirt-node-image.ks b/recipe/ovirt-node-image.ks
new file mode 100644
index 0000000..6b9e2ac
--- /dev/null
+++ b/recipe/ovirt-node-image.ks
@@ -0,0 +1,118 @@
+%include common-install.ks
+
+%include repos.ks
+
+%packages --excludedocs --nobase
+%include common-pkgs.ks
+
+%end
+
+%post
+# cleanup rpmdb to allow non-matching host and chroot RPM versions
+rm -f /var/lib/rpm/__db*
+%include common-post.ks
+
+touch /.autorelabel
+
+# prepare for STATE_MOUNT in rc.sysinit
+augtool <<\EOF
+set /files/etc/sysconfig/readonly-root/TEMPORARY_STATE NOT_OVIRT_FIRSTBOOT
+set /files/etc/sysconfig/readonly-root/STATE_LABEL CONFIG
+set /files/etc/sysconfig/readonly-root/STATE_MOUNT /config
+set /files/etc/sysconfig/readonly-root/READONLY yes
+save
+EOF
+# use persistent state unless firstboot is forced
+# XXX auges shellvars lens does not accept this value
+sed -i 's at NOT_OVIRT_FIRSTBOOT@$(if cat /proc/cmdline|grep -qv
ovirt_firstboot; then printf "yes"; else printf "no";
fi)@' /etc/sysconfig/readonly-root
+# prepare mount points for local storage
+mkdir -p /boot
+mkdir -p /config
+mkdir -p /data
+mkdir -p /liveos
+echo "/dev/HostVG/Config /config ext3 defaults,noauto 0 0" >>
/etc/fstab
+%end
+
+%post
+# Create initial manifests
+manifests=/tmp/manifests
+mkdir -p $manifests
+rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \
+ > $manifests/rpm-manifest.txt
+rpm -qa --qf '%{sourcerpm}\n' | sort -u >
$manifests/srpm-manifest.txt
+du -akx --exclude=/var/cache/yum / > $manifests/file-manifest.txt
+du -x --exclude=/var/cache/yum / > $manifests/dir-manifest.txt
+%end
+
+%include common-blacklist.ks
+
+%post --nochroot
+if [ -f "ovirt-authorized_keys" ]; then
+ echo "Adding authorized_keys to Image"
+ mkdir -p $INSTALL_ROOT/root/.ssh
+ cp -v ovirt-authorized_keys $INSTALL_ROOT/root/.ssh/authorized_keys
+ chown -R root:root $INSTALL_ROOT/root/.ssh
+ chmod 755 $INSTALL_ROOT/root/.ssh
+ chmod 644 $INSTALL_ROOT/root/.ssh/authorized_keys
+fi
+
+echo "Fixing boot menu"
+# remove quiet from Node bootparams, added by livecd-creator
+sed -i -e 's/ quiet//' $LIVE_ROOT/isolinux/isolinux.cfg
+
+# add stand-alone boot entry
+awk '
+BEGIN {
+ # append additional default boot parameters
+ add_boot_params="check"
+}
+/^label linux0/ { linux0=1 }
+linux0==1 && $1=="append" {
+ $0=$0 " " add_boot_params
+ append0=$0
+}
+linux0==1 && $1=="label" && $2!="linux0" {
+ linux0=2
+ print "label stand-alone"
+ print " menu label Boot in stand-alone mode"
+ print " kernel vmlinuz0"
+ gsub("console=tty0", "", append0)
+ print append0" ovirt_standalone console=tty0"
+}
+{ print }
+' $LIVE_ROOT/isolinux/isolinux.cfg >
$LIVE_ROOT/isolinux/isolinux.cfg.standalone
+mv $LIVE_ROOT/isolinux/isolinux.cfg.standalone $LIVE_ROOT/isolinux/isolinux.cfg
+
+%end
+
+%post
+# Create post-image processing manifests
+manifests=/tmp/manifests
+mkdir -p $manifests
+rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | sort \
+ > $manifests/rpm-manifest-post.txt
+rpm -qa --qf '%{sourcerpm}\n' | sort -u >
$manifests/srpm-manifest-post.txt
+du -akx --exclude=/var/cache/yum / > $manifests/file-manifest-post.txt
+du -x --exclude=/var/cache/yum / > $manifests/dir-manifest-post.txt
+
+ver=$(rpm -q --qf '%{version}' ovirt-node)
+rel=$(rpm -q --qf '%{release}' ovirt-node)
+arch=$(rpm -q --qf '%{arch}' ovirt-node)
+echo "oVirt Node release $ver-$rel-$arch" >
$manifests/ovirt-release
+tar -cvf ovirt-node-image-manifests-$ver-$rel.$arch.tar -C /tmp manifests
+ln -nf ovirt-node-image-manifests-$ver-$rel.$arch.tar
ovirt-node-image-manifests.tar
+rm -Rf $manifests
+%end
+
+%post --nochroot
+# Move manifest tar to build directory
+mv $INSTALL_ROOT/ovirt-node-image-manifests*.tar .
+
+# only works on x86, x86_64
+if [ "$(uname -i)" = "i386" -o "$(uname -i)" =
"x86_64" ]; then
+ if [ ! -d $LIVE_ROOT/LiveOS ]; then mkdir -p $LIVE_ROOT/LiveOS ; fi
+ cp /usr/bin/livecd-iso-to-disk $LIVE_ROOT/LiveOS
+ cp /usr/bin/livecd-iso-to-pxeboot $LIVE_ROOT/LiveOS
+fi
+%end
+
--
1.6.2.5
David Huff
2009-Oct-14 20:09 UTC
[Ovirt-devel] [PATCH 03/10] added tools dir and node-image-tools
---
tools/create-ovirt-iso-nodes | 135 ++++++++++++++++++++++++++
tools/edit-livecd | 220 ++++++++++++++++++++++++++++++++++++++++++
tools/livecd-iso-to-iscsi | 201 ++++++++++++++++++++++++++++++++++++++
tools/livecd-rpms | 28 ++++++
tools/livecd-setauth | 50 ++++++++++
5 files changed, 634 insertions(+), 0 deletions(-)
create mode 100755 tools/create-ovirt-iso-nodes
create mode 100755 tools/edit-livecd
create mode 100755 tools/livecd-iso-to-iscsi
create mode 100755 tools/livecd-rpms
create mode 100755 tools/livecd-setauth
diff --git a/tools/create-ovirt-iso-nodes b/tools/create-ovirt-iso-nodes
new file mode 100755
index 0000000..fe2e7ab
--- /dev/null
+++ b/tools/create-ovirt-iso-nodes
@@ -0,0 +1,135 @@
+#!/bin/bash
+#
+# Create fake oVirt Nodes for testing CDROM boot
+# Copyright 2008 Red Hat, Inc.
+# Written by Perry Myers <pmyers at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+PATH=$PATH:/sbin:/usr/sbin
+
+ME=$(basename "$0")
+warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
+try_h() { printf "Try \`$ME -h' for more information.\n"
>&2; }
+die() { warn "$@"; try_h; exit 1; }
+
+NET_DEFAULT=network:default
+IMGDIR_DEFAULT=/var/lib/libvirt/images
+imgdir=$IMGDIR_DEFAULT
+NODEIMG_DEFAULT=/usr/share/ovirt-node-image/ovirt-node-image.iso
+nodeimg=$NODEIMG_DEFAULT
+NUM_DISKS_DEFAULT=1
+RANGE_DEFAULT="6-9"
+RAM_DEFAULT=512
+VCPUS_DEFAULT=1
+
+NODE_DISK_FMT=qcow2
+NODE_DISK_SIZE=6144M
+
+gen_fake_managed_node() {
+ local num=$1
+ local src_nodeimg=$2
+ local last_mac=$(( 54 + $num ))
+
+ local os_variant=fedora10
+ if [ "$no_virtio" = 1 ]; then
+ os_variant=fedora8
+ fi
+
+ echo "Creating fake node$num using $nodeimg..."
+ local dest_nodeimg="$imgdir/node${num}-$(basename $src_nodeimg)"
+ echo "$src_nodeimg -> $dest_nodeimg"
+ rsync -av $src_nodeimg $dest_nodeimg
+
+ virsh destroy node$num > /dev/null 2>&1
+ virsh undefine node$num > /dev/null 2>&1
+
+ local disks+ for ((i=0;i<$num_disks;i+=1)); do
+ qemu-img create -f $NODE_DISK_FMT \
+ $imgdir/node${num}-${i}.$NODE_DISK_FMT $NODE_DISK_SIZE
+ disks="$disks --disk
path=$imgdir/node${num}-${i}.$NODE_DISK_FMT"
+ done
+
+ # FIXME: virt-install should be changed to have a --nostart parameter
+ # that just defines the VM w/o starting it.
+ virt-install --name=node$num --ram=$ram --vcpus=$vcpus $disks \
+ --cdrom=$dest_nodeimg --livecd \
+ --network=$net --mac=00:16:3e:12:34:$last_mac \
+ --vnc --accelerate --hvm --noautoconsole \
+ --os-type=linux --os-variant=$os_variant \
+ --force --noreboot
+ virsh destroy node$num > /dev/null 2>&1
+ echo "node$num created"
+}
+
+usage() {
+ case $# in 1) warn "$1"; try_h; exit 1;; esac
+ cat <<EOF
+Usage: $ME [-d image_dir] [-n node.iso] [-c num_disks] [-s start-stop]
+ [-v vcpus] [-r ram] [-x] [-b network]
+ -n: node.iso to boot (default: $NODEIMG_DEFAULT)
+ -b: network name (default: $NET_DEFAULT)
+ -d: directory to place virtual disk (default: $IMGDIR_DEFAULT)
+ -c: number of disks per fake node (default: $NUM_DISKS_DEFAULT)
+ -s: node range (default: $RANGE_DEFAULT)
+ -v: vcpus per node (default: $VCPUS_DEFAULT)
+ -r: ram in MB per node (default: $RAM_DEFAULT)
+ -x: toggle virtio devices off
+ -h: display this help and exit
+EOF
+}
+
+err=0 help=0
+no_virtio=0
+num_disks=$NUM_DISKS_DEFAULT
+range=$RANGE_DEFAULT
+ram=$RAM_DEFAULT
+vcpus=$VCPUS_DEFAULT
+net=$NET_DEFAULT
+while getopts :d:n:b:s:c:v:r:xh c; do
+ case $c in
+ n) nodeimg=$OPTARG;;
+ d) imgdir=$OPTARG;;
+ b) net=$OPTARG;;
+ c) num_disks=$OPTARG;;
+ s) range=$OPTARG;;
+ v) vcpus=$OPTARG;;
+ r) ram=$OPTARG;;
+ x) no_virtio=1;;
+ h) help=1;;
+ '?') err=1; warn "invalid option: \`-$OPTARG'";;
+ :) err=1; warn "missing argument to \`-$OPTARG' option";;
+ *) err=1; warn "internal error: \`-$OPTARG' not
handled";;
+ esac
+done
+test $err = 1 && { try_h; exit 1; }
+test $help = 1 && { usage; exit 0; }
+
+# first, check to see we are root
+if [ $( id -u ) -ne 0 ]; then
+ die "Must run as root"
+fi
+
+mkdir -p $imgdir
+
+test -f $nodeimg || die "could not find $nodeimg"
+
+# define the fake managed nodes we will use.
+range_start=$(echo $range | cut -d '-' -f 1)
+range_stop=$(echo $range | cut -d '-' -f 2)
+
+for i in `seq $range_start $range_stop` ; do
+ gen_fake_managed_node $i $nodeimg
+done
diff --git a/tools/edit-livecd b/tools/edit-livecd
new file mode 100755
index 0000000..d69ca9d
--- /dev/null
+++ b/tools/edit-livecd
@@ -0,0 +1,220 @@
+#!/bin/bash
+#
+# Edit a livecd to insert files
+# Copyright 2008 Red Hat, Inc.
+# Written by Perry Myers <pmyers at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#!/bin/bash
+
+PATH=$PATH:/sbin:/usr/sbin
+
+ME=$(basename "$0")
+warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
+try_h() { printf "Try \`$ME -h' for more information.\n"
>&2; }
+die() { warn "$@"; try_h; exit 1; }
+
+NODEIMG_DEFAULT=/usr/share/ovirt-node-image/ovirt-node-image.iso
+CD=$NODEIMG_DEFAULT
+
+usage() {
+ case $# in 1) warn "$1"; try_h; exit 1;; esac
+ cat <<EOF
+Usage: $ME -i LiveCD.iso [-b bootparams] [-p program]
+ -b BOOTPARAMS optional parameters appended to the kernel command line
+ -i LIVECD.iso LiveCD ISO to edit (default: $NODEIMG_DEFAULT)
+ -o OUTPUT.iso specify the output file (required)
+ -p CODE Arbitrary CODE that is eval'd while 'cd'd into the
root of
+ the livecd root filesystem. Note; the code is not run in
+ a chroot environment, so it can access the host filesystem.
+ If this option is omitted, this program pauses and allows
+ the user (in another terminal) to modify the filesystem
+ manually. Type <enter> when done, and the script
+ re-packages the ISO.
+ -h display this help and exit
+
+EXAMPLES
+
+ Example Script:
+ #!/bin/sh
+ touch etc/sysconfig/foo
+ Save as foo and make executable:
+ chmod a+x foo
+ Run this to create a file /etc/sysconfig/foo in the livecd filesystem
+ (note the use of "\$PWD/foo", not "./foo", since it will
be run from a
+ different directory):
+
+ $ME -i input.iso -o /tmp/result.iso -p "\$PWD/foo"
+
+ or, equivalently, but without a separate script:
+
+ $ME -i input.iso -o /tmp/result.iso -p 'touch etc/sysconfig/foo'
+
+EOF
+}
+
+# exit after any error:
+set -e
+
+CODE+OUTPUT_FILE+
+err=0 help=0
+while getopts :b:hi:o:p: c; do
+ case $c in
+ i) CD=$OPTARG;;
+ b) PARAMS=$OPTARG;;
+ o) OUTPUT_FILE=$OPTARG;;
+ p) CODE=$OPTARG;;
+ h) help=1;;
+ '?') err=1; warn "invalid option: \`-$OPTARG'";;
+ :) err=1; warn "missing argument to \`-$OPTARG' option";;
+ *) err=1; warn "internal error: \`-$OPTARG' not
handled";;
+ esac
+done
+test $err = 1 && { try_h; exit 1; }
+test $help = 1 && { usage; exit 0; }
+
+# Require "-o OUTPUT_FILE"
+test -z "$OUTPUT_FILE" \
+ && { warn "no output file specified; use -o FILE.iso";
try_h; exit 1; }
+
+# Fail if there are any extra command-line arguments.
+if test $OPTIND -le $#; then
+ bad_arg=$(eval "echo \$$OPTIND")
+ warn "extra argument '$bad_arg'"; try_h; exit 1
+fi
+
+# first, check to see we are root
+if [ $( id -u ) -ne 0 ]; then
+ die "Must run as root"
+fi
+
+# Check for some prerequisites.
+# "type" prints "PROG not found" if it's not in $PATH.
+type mkisofs
+type mksquashfs
+type sed
+type implantisomd5
+
+sane_name()
+{
+ case $1 in
+ *[^a-zA-Z0-9._,+:/@%=-]*) false;;
+ *) true;;
+ esac
+}
+
+# Fail if names we'll use contain white space or shell meta-characters
+sane_name "$PWD" || die "invalid working directory name:
$PWD"
+sane_name "$CD" || die "invalid ISO name: $CD"
+
+WDIR=`mktemp -d $PWD/livecd.XXXXXXXXXX`
+
+addExit() {
+ EXIT="$@ ; $EXIT"
+ trap "$EXIT" EXIT HUP TERM INT QUIT
+}
+
+mnt() {
+ local margs="$1" ; shift
+ local mp="$WDIR/$1"
+ for D in "$@" ; do
+ mkdir -v -p "$WDIR/$D"
+ done
+ eval mount -v $margs "$mp"
+ addExit "df | grep $mp > /dev/null 2>&1 && umount -v
$mp"
+}
+
+addExit "rm -rf $WDIR"
+
+ID_FS_LABEL= # initialize, in case vol_id fails
+eval "$(/lib/udev/vol_id $CD)"
+LABEL=$ID_FS_LABEL
+
+# mount the CD image
+mnt "-t iso9660 $CD -o loop,ro" cd
+
+# mount compressed filesystem
+mnt "-t squashfs $WDIR/cd/LiveOS/squashfs.img -o ro,loop" sq
+
+# create writable copy of the new filesystem for the CD
+cp -pr $WDIR/cd $WDIR/cd-w
+
+# create writable copy of the filesystem for the new compressed
+# squashfs filesystem
+cp -pr $WDIR/sq $WDIR/sq-w
+
+# mount root filesystem
+mnt "-t ext2 $WDIR/sq-w/LiveOS/ext3fs.img -o rw,loop" ex
+
+echo ">>> Updating CD content"
+if [ -n "$CODE" ]; then
+ (
+ cd $WDIR/ex
+ set +e
+ eval "$CODE"
+ set -e
+ )
+else
+ echo "***"
+ echo "*** Pausing to allow manual changes. Press any key to
continue."
+ echo "***"
+ read
+fi
+
+# Try to unmount. But this is likely to fail, so let the user retry,
+# e.g., if he forgot to "cd" out of $WDIR/ex.
+while :; do
+ echo ">>> Unmounting ext3fs"
+ umount $WDIR/ex && break
+ echo ">>> Unmounting the working file system copy failed"
+ echo "***"
+ echo "*** Did you forget to 'cd' out of $WDIR/ex?"
+ echo "***"
+ echo "*** Press any key to repeat the attempt."
+ echo "***"
+ read
+done
+
+echo ">>> Compressing filesystem"
+mksquashfs $WDIR/sq-w/ $WDIR/cd-w/LiveOS/squashfs.img -noappend
+
+echo ">>> Recomputing MD5 sums"
+( cd $WDIR/cd-w && find . -type f -not -name md5sum.txt \
+ -not -path '*/isolinux/*' -print0 | xargs -0 -- md5sum >
md5sum.txt )
+
+if [ -n "$PARAMS" ]; then
+ case $PARAMS in
+ *@*) warn "PARAMS contains the @ sed delimiter, be sure it's
escaped";;
+ esac
+ echo ">>> Appending boot parameters"
+ sed -i 's@^ append .*$@& '"$PARAMS@"
"$WDIR/cd-w/isolinux/isolinux.cfg"
+fi
+
+echo ">>> Creating ISO image $ISO"
+mkisofs \
+ -V "$LABEL" \
+ -r -cache-inodes -J -l \
+ -b isolinux/isolinux.bin \
+ -c isolinux/boot.cat \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ -o "$OUTPUT_FILE" \
+ $WDIR/cd-w
+
+echo ">>> Implanting ISO MD5 Sum"
+implantisomd5 --force "$OUTPUT_FILE"
+
+# The trap ... callbacks will unmount everything.
+set +e
diff --git a/tools/livecd-iso-to-iscsi b/tools/livecd-iso-to-iscsi
new file mode 100755
index 0000000..fd3934d
--- /dev/null
+++ b/tools/livecd-iso-to-iscsi
@@ -0,0 +1,201 @@
+#!/usr/bin/python
+# Convert a live CD iso into iscsi root bootable format
+# iSCSI lun must be accessible via this script
+# Copyright 2009 Red Hat, Inc.
+# Written by Joey boggs <jboggs at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+from optparse import OptionParser
+from tempfile import mkdtemp
+import dbus
+import dbus.glib
+import sys
+import os
+import subprocess
+import shutil
+
+parser = OptionParser()
+parser.add_option("--iso", dest="iso", help="LiveCD
iso filename")
+parser.add_option("--target", dest="target",
help="iSCSI target ip address")
+parser.add_option("--targetname", dest="targetname",
help="iSCSI target lun")
+parser.add_option("--targetport", dest="targetport",
default="3260", help="iSCSI port number, defaults to 3260")
+parser.add_option("--user", dest="user", help="Target
username(optional)")
+parser.add_option("--password", dest="password",
help="Target password")
+parser.add_option("--reverse_user", dest="reverse_user",
help="Reverse CHAP username(optional)")
+parser.add_option("--reverse_password",
dest="reverse_password", help="Reverse CHAP
password(optional)")
+parser.add_option("--disk", dest="disk", help="iSCSI
disk device name")
+parser.add_option("--disk-label", dest="disk_label",
default="ovirt-node-root", help="file system label")
+
+(options, args) = parser.parse_args()
+
+def fail(msg):
+ print(msg)
+ sys.exit(1)
+
+if os.geteuid () != 0:
+ fail("You must run as root")
+
+if options.iso is None:
+ fail("ERROR: iso file must be defined")
+else:
+ options.iso = os.path.abspath(options.iso)
+
+if options.target is None:
+ fail("ERROR: iscsi target must be defined")
+
+if options.targetname is None:
+ fail("ERROR: iscsi targetname must be defined")
+
+if len(options.disk_label.strip()) > 15:
+ fail("ERROR: disk label must be 14 characters or less")
+
+try:
+ file = os.mkdir("tftpboot")
+except OSError, e:
+ tftp_remove = raw_input("tftpboot directory exists, overwrite? (y/N)?
")
+ if tftp_remove.lower() == "y":
+ shutil.rmtree("tftpboot")
+ os.mkdir("tftpboot")
+ else:
+ print "Aborting"
+ sys.exit(1)
+
+if options.disk is None:
+ print "Below are the detected disks, if the iscsi disk is not shown,
please ensure you are logged into the correct target\n"
+ bus = dbus.SystemBus ()
+ hal_obj = bus.get_object ('org.freedesktop.Hal',
'/org/freedesktop/Hal/Manager')
+ hal = dbus.Interface (hal_obj, 'org.freedesktop.Hal.Manager')
+ udis = hal.FindDeviceByCapability ('storage')
+ dev_dict = {}
+ dev_count = 1
+ for udi in udis:
+ dev_obj = bus.get_object ('org.freedesktop.Hal', udi)
+ dev = dbus.Interface (dev_obj, 'org.freedesktop.Hal.Device')
+ dev_bus=dev.GetProperty ('storage.bus')
+ dev_name=dev.GetProperty ('block.device')
+ dev_size=dev.GetProperty ('storage.size')
+ dev_size=(dev_size/1024/1024)
+ basename=os.path.basename(udi)
+ if dev_bus == "scsi":
+ print "%s. %s %sM %s \n" %
(dev_count,dev_name,dev_size,basename)
+ dev_dict[str(dev_count)] = dev_name
+ dev_count = dev_count + 1
+ print "Enter Q to Quit"
+ dev_choice = raw_input("Which device? ")
+ while not dev_dict.has_key(dev_choice):
+ if dev_choice.lower() == "q":
+ print "Aborting"
+ sys.exit(1)
+ else:
+ print "%s is an invalid choice" % dev_choice
+ dev_choice = raw_input("Which device? ")
+ options.disk = dev_dict[dev_choice]
+
+cont = raw_input("Creating file system on %s, do you wish to continue
(y/N) " % options.disk)
+if cont.lower() != "y":
+ print "Aborting"
+ sys.exit(1)
+
+isomount = mkdtemp()
+isomount_ret = subprocess.call(["mount", "-o",
"loop", options.iso, isomount])
+if isomount_ret != 0:
+ fail("Error mounting %s" % options.iso)
+
+kernel="%s/isolinux/vmlinuz0" % isomount
+initrd="%s/isolinux/initrd0.img" % isomount
+squashfs="%s/LiveOS/squashfs.img" % isomount
+ext3fs="tftpboot/squashfs-root/LiveOS/ext3fs.img"
+shutil.copy(kernel,"tftpboot")
+shutil.copy(initrd,"tftpboot")
+
+unsquash = subprocess.call(["unsquashfs", squashfs])
+
+# workaround until bug is fixed with squashfs -d option
+shutil.move("squashfs-root","tftpboot/squashfs-root")
+
+print "Placing embedded file system on %s" % options.disk
+dd_cmd="dd if=%s of=%s" % (ext3fs,options.disk)
+copy_iscsi_ret = subprocess.call(dd_cmd, shell=True)
+if copy_iscsi_ret != 0:
+ fail("Error copying to %s" % options.disk)
+
+umount_ret = subprocess.call(["umount", isomount])
+if umount_ret != 0:
+ fail("Error unmounting %s, continuing" % isomount)
+else:
+ os.rmdir(isomount)
+shutil.rmtree("tftpboot/squashfs-root")
+
+pxe_template = """
+
+# pxelinux configuration.
+DEFAULT pxeboot
+TIMEOUT 20
+PROMPT 0
+LABEL ovirt-node-iscsi
+ KERNEL /vmlinuz0
+ APPEND initrd=/initrd0.img ro root=LABEL=%(disk_label)s
netroot=iscsi:%(user)s%(password)s@%(target)s::%(target_port)s::%(target_name)s
ip=eth0:dhcp
+ ipappend 2
+ONERROR LOCALBOOT 0
+"""
+
+# insert empty values for unneeded variables in the pxe template
+if not options.user is None:
+ options.user = options.user + ":"
+else:
+ options.user = ""
+
+if not options.password is None:
+ options.password = options.password + ":"
+else:
+ options.password = ""
+
+if not options.reverse_user is None:
+ options.reverse_user = options.reverse_user + ":"
+else:
+ options.reverse_user = ""
+
+if not options.reverse_password is None:
+ options.reverse_password = options.reverse_password + ":"
+else:
+ options.reverse_password = ""
+
+os.mkdir("tftpboot/pxelinux.cfg")
+pxe_cfg = pxe_template % {
+ "disk_label": options.disk_label,
+ "target": options.target,
+ "target_port": options.targetport,
+ "target_name": options.targetname,
+ "user": options.user,
+ "password": options.password,
+ "reverse_user": options.reverse_user,
+ "reverse_password": options.reverse_password
+ }
+
+pxe_conf = open("tftpboot/pxelinux.cfg/default", 'w')
+pxe_conf.write(pxe_cfg)
+pxe_conf.close()
+
+if os.path.exists("/usr/share/syslinux/pxelinux.0"):
+
shutil.copy("/usr/share/syslinux/pxelinux.0","tftpboot")
+elif os.path.exists("/usr/lib/syslinux/pxelinux.0"):
+ shutil.copy("/usr/lib/syslinux/pxelinux.0","tftpboot")
+else:
+ print "Warning: You need to add pxelinux.0 to tftpboot/
subdirectory"
+
+print "Your iscsiroot has been setup on %s" % options.disk
+print ""
+print "Copy the tftpboot/ subdirectory to your tftpserver root
directory"
+print "Set up your DHCP, TFTP and PXE server to serve
/tftpboot/.../pxeboot.0"
diff --git a/tools/livecd-rpms b/tools/livecd-rpms
new file mode 100755
index 0000000..0649cba
--- /dev/null
+++ b/tools/livecd-rpms
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# Script to install/update a livecd with a set of RPMS provided in a directory
+# Copyright 2009 Red Hat, Inc.
+# Written by Perry Myers <pmyers at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if [[ $# < 1 ]]; then
+ echo "Usage: $0 rpmdir"
+ exit 1
+fi
+
+RPMDIR=$1
+
+rpm --root $PWD -Uvh $(find $RPMDIR -type f -name "*.rpm" -print)
+
diff --git a/tools/livecd-setauth b/tools/livecd-setauth
new file mode 100755
index 0000000..eb8922f
--- /dev/null
+++ b/tools/livecd-setauth
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# Script to interactively add root password and authorized_keys file
+# to a livecd
+# Copyright 2008 Red Hat, Inc.
+# Written by Perry Myers <pmyers at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+DEFAULT_AUTH=~/.ssh/authorized_keys
+
+printf "Do you want to set a root password? [y/N]: "
+read yesno
+if [ "$yesno" = "y" -o "$yesno" = "Y"
]; then
+ chroot . passwd root
+fi
+
+printf "Do you want to set an authorized_keys file? [y/N]: "
+read yesno
+if [ "$yesno" = "y" -o "$yesno" = "Y"
]; then
+ echo "Enter the location of the authorized_keys file [default:
$DEFAULT_AUTH]: "
+ read -e authkeys
+ if [ -z "$authkeys" ]; then
+ authkeys=$DEFAULT_AUTH
+ fi
+
+ authkeys=$(eval echo $authkeys)
+ if [ -f $authkeys ]; then
+ SSH=root/.ssh
+ AUTH=$SSH/authorized_keys
+
+ mkdir -p $SSH
+ chmod 755 $SSH
+ cp -v $authkeys $AUTH
+ chmod 644 $AUTH
+ else
+ echo "$authkeys not found, skipping"
+ fi
+fi
--
1.6.2.5
David Huff
2009-Oct-14 20:09 UTC
[Ovirt-devel] [PATCH 04/10] added README from ovirt-node-image
--- README | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..9c6b8da --- /dev/null +++ b/README @@ -0,0 +1,45 @@ +Some notes on node image deployment + +Nodes are provided in ISO format. These ISO images can be deployed by either: +1. Writing the image to a CD +2. Writing the image to USB flash using livecd-iso-to-disk utility +3. Creating pxe bootable files using livecd-iso-to-pxeboot utility + +To burn a Node image to a usb stick accessible as /dev/sdb: +livecd-iso-to-disk --format /usr/share/ovirt-node-image/ovirt-node-image.iso /dev/sdb + +To create vmlinuz and initrd images suitable for pxe booting: +livecd-iso-to-pxeboot /usr/share/ovirt-node-image/ovirt-node-image.iso + +The output of livecd-iso-to-pxeboot is a directory called tftpboot that has the +following files in it: +./pxelinux.0 +./pxelinux.cfg/default +./vmlinuz0 +./initrd0.img + +The vmlinuz0/initrd0.img files can be imported into a cobbler server or any +other PXE/tftp server. pxelinux.cfg/default provides a template for +configuring the pxe server to export the Node image: + +DEFAULT pxeboot +TIMEOUT 20 +PROMPT 0 +LABEL pxeboot + KERNEL vmlinuz0 + APPEND rootflags=loop initrd=initrd0.img root=/ovirt-node-image.iso rootfstype=auto ro liveimg check rootfstype=iso9660 elevator=deadline +ONERROR LOCALBOOT 0 + +In addition, PXE booted Nodes rely on the PXE server passing the mac address +of the pxe interface to the kernel. This is provided by using the IPAPPEND 2 +parameter as follows: + +DEFAULT pxeboot +TIMEOUT 20 +PROMPT 0 +LABEL pxeboot + KERNEL vmlinuz0 + IPAPPEND 2 + APPEND rootflags=loop initrd=initrd0.img root=/ovirt-node-image.iso rootfstype=auto ro liveimg check rootfstype=iso9660 elevator=deadline +ONERROR LOCALBOOT 0 + -- 1.6.2.5
---
recipe/Makefile.am | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
create mode 100644 recipe/Makefile.am
diff --git a/recipe/Makefile.am b/recipe/Makefile.am
new file mode 100644
index 0000000..7b64d55
--- /dev/null
+++ b/recipe/Makefile.am
@@ -0,0 +1,46 @@
+OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache
+OVIRT_LOCAL_REPO ?= file://$(OVIRT_CACHE_DIR)/ovirt
+OVIRT_URL ?= http://ovirt.org/repos/ovirt
+
+FEDORA_MIRROR = http://mirrors.fedoraproject.org/mirrorlist
+CUR_RAWHIDE = 12
+
+CUR_PREVIEW = 11
+PREVIEW_URL ?=
http://markmc.fedorapeople.org/virt-preview/f$(CUR_PREVIEW)/$(ARCH)
+
+FEDORA = $(shell rpm --eval '%{fedora}')
+ARCH = $(shell rpm --eval '%{_arch}')
+
+EXTRA_DIST = \
+ repos.ks \
+ ovirt-node-recipe.ks \
+ common-blacklist.ks \
+ common-install.ks \
+ common-pkgs.ks \
+ common-post.ks \
+ ovirt-node-image.ks
+
+repos.ks:
+ ( \
+ if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \
+ FEDORA_REPO=rawhide ;\
+ FEDORA_REPO_LOC="$(if
$(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/$(ARCH)/os,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide&arch=$(ARCH))"
;\
+ OVIRT_DISTRO=development ;\
+ else \
+ FEDORA_REPO=f$(FEDORA) ;\
+ FEDORA_REPO_LOC="$(if
$(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/${ARCH}/os,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-$(FEDORA)&arch=$(ARCH))"
;\
+ OVIRT_DISTRO=$(FEDORA) ;\
+ UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates $(if
$(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/${ARCH},--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-f$(FEDORA)&arch=$(ARCH))\n"
;\
+ if [ 0$(FEDORA) == 0$(CUR_PREVIEW) ]; then \
+ UPDATE_REPO_LINE="$${UPDATE_REPO_LINE}repo --name=preview
--baseurl=$(PREVIEW_URL)\n" ;\
+ fi ;\
+ fi ;\
+ echo "repo --name=$${FEDORA_REPO} $${FEDORA_REPO_LOC}" >
repos.ks ;\
+ echo "repo --name=ovirt-org
--baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> repos.ks ;\
+ printf "$${UPDATE_REPO_LINE}" >> repos.ks ;\
+ echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)"
>> repos.ks ;\
+ )
+
+ovirt-node-recipe.ks:
+# ksflatten ovirt-node-image.ks --output $@
+ cp ovirt-node-image.ks ovirt-node-recipe.ks
\ No newline at end of file
--
1.6.2.5
David Huff
2009-Oct-14 20:09 UTC
[Ovirt-devel] [PATCH 06/10] Modified Makefile for ovirt-node
--- Makefile.am | 10 +++++++++- configure.ac | 1 + 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/Makefile.am b/Makefile.am index abb7c33..314ed8a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,7 +16,10 @@ # also available at http://www.gnu.org/copyleft/gpl.html. OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache -SUBDIRS = gptsync + +SUBDIRS = \ + gptsync \ + recipe EXTRA_DIST = \ .gitignore \ @@ -75,6 +78,11 @@ EXTRA_DIST = \ scripts/ovirt-post \ scripts/ovirt-process-config \ scripts/ovirt-uninstall-node-stateful \ + tools/create-ovirt-iso-nodes \ + tools/edit-livecd \ + tools/livecd-iso-to-iscsi \ + tools/livecd-rpms \ + tools/livecd-setauth \ kinit/ovirt-kinit \ logrotate/ovirt-logrotate \ logrotate/ovirt-logrotate.conf diff --git a/configure.ac b/configure.ac index 780b757..59593ae 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,7 @@ test x"$ac_ct_CC:$CFLAGS" = 'xgcc:-g -O2' \ AC_CONFIG_FILES([Makefile nodeadmin/setup.py gptsync/Makefile + recipe/Makefile ovirt-node.spec ]) AC_OUTPUT -- 1.6.2.5
Removed stateful, and other old subpackages
Added subpackage ovirt-node-tools
Fixed issue with logrotate file name for fedora packaging.
Fixed problem with conflicts between logos, added in approot install in ks post
---
ovirt-node.spec.in | 234 +++++++++++++++++++---------------------------------
1 files changed, 85 insertions(+), 149 deletions(-)
diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index 2a6b7b6..513f095 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -11,12 +11,6 @@ Source0: %{name}-%{version}.tar.gz
License: GPLv2+
Group: Applications/System
-%define selinux_variants mls strict targeted minimum
-%define selinux_policyver %(sed -n
's,.*selinux-policy-\([^/]*\)/.*,\1,p'
/usr/share/selinux/devel/policyhelp)
-%define modulename %{name}-selinux
-Source1: %{modulename}.te
-Source2: %{modulename}.fc
-
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
URL: http://www.ovirt.org/
Requires(post): /sbin/chkconfig
@@ -31,7 +25,8 @@ Requires: libvirt-qpid >= 0.2.14-3
Requires: hal
Requires: collectd-virt
Requires: wget
-Requires: cyrus-sasl-gssapi cyrus-sasl cyrus-sasl-lib
+Requires: cyrus-sasl-gssapi cyrus-sasl
+Requires: cyrus-sasl-lib >= 2.1.22
Requires: iscsi-initiator-utils
Requires: ntp
Requires: nfs-utils
@@ -49,9 +44,8 @@ Requires: grub
Requires: /usr/sbin/crond
Requires: anyterm
Requires: newt-python
-Requires: libuser-python
+Requires: libuser-python >= 0.56.10
Requires: dbus-python
-Requires: python-IPy
ExclusiveArch: %{ix86} x86_64
@@ -59,89 +53,31 @@ ExclusiveArch: %{ix86} x86_64
%description
Provides a series of daemons and support utilities to allow an
-oVirt Node to interact with the oVirt Server.
-
-%package stateless
-Summary: oVirt Node for running as embedded hypervisor
-Group: Applications/System
-Requires: %{name} = %{version}-%{release}
-Conflicts: %{name}-stateful
-ExclusiveArch: %{ix86} x86_64
-
-%description stateless
-Provides the oVirt Node functionality needed as part of the
-ovirt-node-image creation. This provides a stateless oVirt Node
-that runs as a livecd.
+oVirt Node to interact with the oVirt Server. This package
+should only be installed on the oVirt Node machine.
-%package stateful
-Summary: oVirt Node for running on Fedora Hosts
+%package tools
+Summary: oVirt Node tools for building and running an oVirt Node image
Group: Applications/System
-Requires: %{name} = %{version}-%{release}
-Conflicts: %{name}-stateless
-ExclusiveArch: %{ix86} x86_64
+BuildArch: noarch
+BuildRequires: pykickstart >= 1.54
+Requires: livecd-tools >= 020-2
-%description stateful
-Provides the oVirt Node functionality needed to convert an existing
-host into a Node in a stateful manner. Presently intended for use on
-the host running the oVirt Appliance.
+%define tools_root %{_datadir}/ovirt-node-tools
-%package logos
-Summary: oVirt Node Logos
-Group: System Environment/Base
-BuildArch: noarch
-Obsoletes: redhat-logos
-Provides: redhat-logos = 10.0.1-1
-Provides: system-logos = 10.0.1-1
-Conflicts: fedora-logos
-Conflicts: generic-logos
-Conflicts: fedora-logos
-Conflicts: anaconda-images <= 10
-Conflicts: redhat-artwork <= 5.0.5
-
-%description logos
-The ovirt-logos package contains various image files which can be
-used by the bootloader, anaconda, and other related tools.
-
-%package release
-Summary: %{product_family} release file
-Group: System Environment/Base
-Obsoletes: redhat-release
-Provides: redhat-release
-%description release
-%{product_family} release files.
-
-%package selinux
-Summary: SELinux policy module supporting ovirt-node
-Group: System Environment/Base
-BuildRequires: checkpolicy, selinux-policy-devel, hardlink
-%if "%{selinux_policyver}" != ""
-Requires: selinux-policy >= %{selinux_policyver}
-%endif
-Requires: %{name} = %{version}-%{release}
-Requires(post): /usr/sbin/semodule, /sbin/restorecon
-Requires(postun): /usr/sbin/semodule, /sbin/restorecon
-
-%description selinux
-SELinux policy module supporting ovirt-node
+%description tools
+The oVirt-node-tools package provides recipe (ks files), client tools,
+documentation for building and running an oVirt Node image. This package
+is not to be installed on the oVirt-Node, however on a development machine
+to help in deployment on the node.
%prep
%setup -q
-mkdir SELinux
-cp -p %{SOURCE1} %{SOURCE2} SELinux
-
%build
%configure
make
-cd SELinux
-for selinuxvariant in %{selinux_variants}; do
- make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
- mv %{modulename}.pp %{modulename}.pp.${selinuxvariant}
- make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
-done
-cd -
-
%install
%{__rm} -rf %{buildroot}
# FIXME move installs into makefile
@@ -167,9 +103,7 @@ cd -
%{__install} -p -m0755 scripts/ovirt-config-storage %{buildroot}%{_sbindir}
%{__install} -p -m0755 scripts/ovirt-config-uninstall %{buildroot}%{_sbindir}
%{__install} -p -m0755 scripts/ovirt-process-config %{buildroot}%{_sbindir}
-%{__install} -D -m0755 scripts/ovirt-install-node-stateful
%{buildroot}%{_sbindir}
%{__install} -D -m0755 scripts/ovirt-install-node-stateless
%{buildroot}%{_sbindir}
-%{__install} -D -m0755 scripts/ovirt-uninstall-node-stateful
%{buildroot}%{_sbindir}
%{__install} -D -m0755 scripts/ovirt-config-view-logs %{buildroot}%{_sbindir}
%{__install} -p -m0755 scripts/persist %{buildroot}%{_sbindir}
%{__install} -p -m0755 scripts/unpersist %{buildroot}%{_sbindir}
@@ -177,7 +111,7 @@ cd -
%{__install} -p -m0644 nodeadmin/__init__.py
%{buildroot}%{python_sitelib}/nodeadmin
%{__install} -p -m0644 nodeadmin/configscreen.py
%{buildroot}%{python_sitelib}/nodeadmin
%{__install} -p -m0644 nodeadmin/menuscreen.py
%{buildroot}%{python_sitelib}/nodeadmin
-%{__install} -p -m0755 nodeadmin/utils.py
%{buildroot}%{python_sitelib}/nodeadmin
+%{__install} -p -m0644 nodeadmin/utils.py
%{buildroot}%{python_sitelib}/nodeadmin
%{__install} -p -m0755 nodeadmin/nodeadmin.py
%{buildroot}%{python_sitelib}/nodeadmin
%{__install} -p -m0644 nodeadmin/mainmenu.py
%{buildroot}%{python_sitelib}/nodeadmin
@@ -189,10 +123,10 @@ cd -
%{__install} -p -m0755 nodeadmin/undefinedomain.py
%{buildroot}%{python_sitelib}/nodeadmin
%{__install} -p -m0755 nodeadmin/listdomains.py
%{buildroot}%{python_sitelib}/nodeadmin
%{__install} -p -m0644 nodeadmin/domainconfig.py
%{buildroot}%{python_sitelib}/nodeadmin
-
+
%{__install} -p -m0644 nodeadmin/netmenu.py
%{buildroot}%{python_sitelib}/nodeadmin
%{__install} -p -m0644 nodeadmin/networkconfig.py
%{buildroot}%{python_sitelib}/nodeadmin
-%{__install} -p -m0755 nodeadmin/definenet.py
%{buildroot}%{python_sitelib}/nodeadmin
+%{__install} -p -m0644 nodeadmin/definenet.py
%{buildroot}%{python_sitelib}/nodeadmin
%{__install} -p -m0755 nodeadmin/createnetwork.py
%{buildroot}%{python_sitelib}/nodeadmin
%{__install} -p -m0755 nodeadmin/destroynetwork.py
%{buildroot}%{python_sitelib}/nodeadmin
%{__install} -p -m0755 nodeadmin/undefinenetwork.py
%{buildroot}%{python_sitelib}/nodeadmin
@@ -219,7 +153,7 @@ cd -
%{__install} -p -m0755 kinit/ovirt-kinit %{buildroot}%{_sysconfdir}/cron.hourly
%{__install} -p -m0644 logrotate/ovirt-logrotate
%{buildroot}%{_sysconfdir}/cron.d
-%{__install} -p -m0644 logrotate/ovirt-logrotate.conf
%{buildroot}%{_sysconfdir}/logrotate.d
+%{__install} -p -m0644 logrotate/ovirt-logrotate.conf
%{buildroot}%{_sysconfdir}/logrotate.d/ovirt-node
# install the admin tools
python nodeadmin/setup.py install --root %{buildroot}
@@ -227,25 +161,15 @@ python nodeadmin/setup.py install --root %{buildroot}
echo "oVirt Node release %{version}-%{release}" >
%{buildroot}%{_sysconfdir}/ovirt-release
mkdir -p %{buildroot}/%{_sysconfdir}/default
-touch %{buildroot}/%{_sysconfdir}/default/ovirt
-
-cd SELinux
-for selinuxvariant in %{selinux_variants}; do
- install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
- install -p -m 644 %{modulename}.pp.${selinuxvariant} \
- %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp
-done
-cd -
-
-/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
+echo "# File where default partitioning info is kept" >
%{buildroot}/%{_sysconfdir}/default/ovirt
# ovirt-logos
# should be ifarch i386
mkdir -p %{buildroot}/boot/grub
-install -p -m 644 images/grub-splash.xpm.gz
%{buildroot}/boot/grub/splash.xpm.gz
+install -p -m 644 images/grub-splash.xpm.gz %{buildroot}%{app_root}
# end i386 bits
mkdir -p %{buildroot}/usr/lib/anaconda-runtime
-install -p -m 644 images/syslinux-vesa-splash.jpg
%{buildroot}/usr/lib/anaconda-runtime
+install -p -m 644 images/syslinux-vesa-splash.jpg %{buildroot}%{app_root}
# ovirt-logos
# release files
@@ -273,62 +197,78 @@ ln -s ovirt-release %{buildroot}/etc/system-release
%{__ln_s} ../..%{_sbindir}/ovirt-config-uninstall
%{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"99_Uninstall node"
+# ovirt-node-tools
+%{__install} -d -m0755 %{buildroot}%{tools_root}
+%{__install} -p -m0644 recipe/*.ks %{buildroot}%{tools_root}
+%{__install} -p -m0755 tools/create-ovirt-iso-nodes %{buildroot}%{_sbindir}
+%{__install} -p -m0755 tools/edit-livecd %{buildroot}%{_sbindir}
+%{__install} -p -m0755 tools/livecd-setauth %{buildroot}%{_sbindir}
+%{__install} -p -m0755 tools/livecd-rpms %{buildroot}%{_sbindir}
+#%{__install} -p -m0755 tools/get-ovirt-node-image %{buildroot}%{_sbindir}
+#%{__install} -p -m0755 tools/generate-ovirt-node-pxe-tree
%{buildroot}%{_sbindir}
+
+
%clean
%{__rm} -rf %{buildroot}
%post
# Setup basic collectd configuration
sed '/<Plugin network>/,/<\/Plugin>/d'
/etc/collectd.conf.in > /etc/collectd.conf
-
-%post stateless
/sbin/chkconfig --add ovirt-early
/sbin/chkconfig --add ovirt-firstboot
/sbin/chkconfig --add ovirt
/sbin/chkconfig --add ovirt-post
-%preun stateless
-if [ "$1" = 0 ] ; then
- /sbin/chkconfig --del ovirt-early
- /sbin/chkconfig --del ovirt-firstboot
- /sbin/chkconfig --del ovirt
- /sbin/chkconfig --del ovirt-post
+%preun
+if [ $1 = 0 ] ; then
+ /sbin/service ovirt-early stop >/dev/null 2>&1
+ /sbin/service ovirt-firstboor stop >/dev/null 2>&1
+ /sbin/service ovirt stop >/dev/null 2>&1
+ /sbin/service ovirt-post stop >/dev/null 2>&1
+ /sbin/chkconfig --del ovirt-early
+ /sbin/chkconfig --del ovirt-firstboot
+ /sbin/chkconfig --del ovirt
+ /sbin/chkconfig --del ovirt-post
fi
-%post selinux
-for selinuxvariant in %{selinux_variants}; do
- /usr/sbin/semodule -s ${selinuxvariant} -i \
- %{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null
|| :
-done
-
-%postun selinux
-if [ $1 -eq 0 ] ; then
- for selinuxvariant in %{selinux_variants}; do
- /usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &>
/dev/null || :
- done
-fi
-%files release
+%files tools
+%defattr(0644,root,root,0755)
+%doc README COPYING
+%{tools_root}/*.ks
+
+%defattr(0755,root,root,0755)
+%{_sbindir}/create-ovirt-iso-nodes
+%{_sbindir}/edit-livecd
+%{_sbindir}/livecd-setauth
+%{_sbindir}/livecd-rpms
+#%{_sbindir}/get-ovirt-node-image
+#%{_sbindir}/generate-ovirt-node-pxe-tree
+
+
+%files
%defattr(-,root,root)
-%attr(0644,root,root) /etc/ovirt-release
-/etc/redhat-release
-/etc/system-release
+%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/ovirt-release
+%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/default/ovirt
+%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/redhat-release
+%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/system-release
%config(noreplace) %attr(0644,root,root) /etc/issue
%config(noreplace) %attr(0644,root,root) /etc/issue.net
-%files selinux
-%defattr(-,root,root,0755)
-%doc SELinux/*
-%{_datadir}/selinux/*/%{modulename}.pp
+%config(noreplace) %{_sysconfdir}/logrotate.d/ovirt-node
+%config(noreplace) %{_sysconfdir}/cron.d/ovirt-logrotate
+
+%{_sysconfdir}/ovirt-config-boot.d
+%{_sysconfdir}/ovirt-config-setup.d
+%config(noreplace) %{_sysconfdir}/collectd.conf.in
+%{_sysconfdir}/cron.hourly/ovirt-kinit
-%files logos
-%defattr(-, root, root)
%doc COPYING
# should be ifarch i386
-/boot/grub/splash.xpm.gz
+%{app_root}/grub-splash.xpm.gz
# end i386 bits
-/usr/lib/anaconda-runtime/*.jpg
+%{app_root}/syslinux-vesa-splash.jpg
-%files stateless
%defattr(-,root,root,0755)
%{_sbindir}/ovirt-awake
%{_sbindir}/ovirt-config-boot
@@ -348,25 +288,13 @@ fi
%{_sbindir}/showpart
%{_sbindir}/persist
%{_sbindir}/unpersist
+
%{_initrddir}/ovirt-early
%{_initrddir}/ovirt-firstboot
%{_initrddir}/ovirt
%{_initrddir}/ovirt-post
-%config %{_sysconfdir}/cron.hourly/ovirt-kinit
-%config %{_sysconfdir}/logrotate.d/ovirt-logrotate.conf
-%config %{_sysconfdir}/cron.d/ovirt-logrotate
-%{_sysconfdir}/ovirt-config-boot.d
-%{_sysconfdir}/ovirt-config-setup.d
+%attr(0644,root,root) /etc/rc.d/init.d/ovirt-functions
-%files stateful
-%defattr(-,root,root,0755)
-%{_sbindir}/ovirt-install-node-stateful
-%{_sbindir}/ovirt-uninstall-node-stateful
-
-%files
-%defattr(-,root,root,0755)
-%{_sbindir}/ovirt-awake
-%{_initrddir}/ovirt-functions
%defattr(-,root,root,0644)
%{_bindir}/nodeadmin
%{_bindir}/definedom
@@ -378,15 +306,23 @@ fi
%{_bindir}/createnet
%{_bindir}/destroynet
%{_bindir}/undefinenet
+
%{_bindir}/listnets
%{_bindir}/createuser
-%{_sysconfdir}/collectd.conf.in
+
+%defattr(-,root,root,-)
%{python_sitelib}/nodeadmin
%{python_sitelib}/nodeadmin- at VERSION@-py2.6.egg-info
-%config %attr(0644,root,root) %{_sysconfdir}/ovirt-release
-%config %attr(0644,root,root) %{_sysconfdir}/default/ovirt
+
%changelog
+* Wed Oct 07 2009 David huff <dhuff at redhat.com> - 1.0.3-4
+- Added ovirt-node-tools subpackage
+
+* Thu Jun 23 2009 David Huff <dhuff at redhat.com> - 1.0.3
+- Clean up spec for inclusion in Fedora
+- Removed subpackages, stateful, stateless, logos, and selinux
+
* Thu Dec 11 2008 Perry Myers <pmyers at redhat.com> - 0.96
- Subpackage stateful/stateless to separate out functionality for
embedded Node and Node running as part of already installed OS
--
1.6.2.5
David Huff
2009-Oct-14 20:09 UTC
[Ovirt-devel] [PATCH 08/10] remove old selinux modules, ovirt-node-selinux, polkit
--- recipe/common-post.ks | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipe/common-post.ks b/recipe/common-post.ks index 7cebef0..85242c5 100644 --- a/recipe/common-post.ks +++ b/recipe/common-post.ks @@ -6,8 +6,8 @@ export PATH # Import SELinux Modules echo "Enabling selinux modules" SEMODULES="base automount avahi consolekit cyrus dhcp dnsmasq guest hal ipsec \ -iscsi kerberos kerneloops ldap lockdev logadm mozilla ntp ovirt-node-selinux \ -polkit portmap qemu rpcbind sasl snmp stunnel sysstat tcpd unprivuser \ +iscsi kerberos kerneloops ldap lockdev logadm mozilla ntp \ +portmap qemu rpcbind sasl snmp stunnel sysstat tcpd unprivuser \ unconfined usbmodules userhelper virt" lokkit -v --selinuxtype=minimum -- 1.6.2.5