David Huff
2009-Oct-14 20:13 UTC
[Ovirt-devel] Refactor ovirt-node-image code base for inclusion in Fedora
Main reason for refactor is no ovirt-node-image binary image allowed in fedora. Removed ks files, now in ovirt-node-recipe, which is subpackage of ovirt-node. Removed tools, these are now in ovirt-node-recipe which is subpackage of ovirt-node.
--- Makefile.am | 61 ++++------------------------------------------------------ 1 files changed, 5 insertions(+), 56 deletions(-) diff --git a/Makefile.am b/Makefile.am index 306f49f..41741d2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,6 +18,7 @@ OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache OVIRT_LOCAL_REPO ?= file://$(OVIRT_CACHE_DIR)/ovirt OVIRT_URL ?= ovirt.org/repos/ovirt +OVIRT_NODE_RECIPE ?= /usr/share/ovirt-node-tools/ovirt-node-recipe.ks SUM ?= sha1sum PKG_FMT = iso SRC_FMT ?= tar @@ -37,17 +38,7 @@ NVR = $(PACKAGE)-$(VERSION)-$(ARCH) EXTRA_DIST = \ .gitignore \ $(PACKAGE).spec \ - $(PACKAGE).spec.in \ - common-blacklist.ks \ - common-install.ks \ - common-pkgs.ks \ - common-post.ks \ - $(PACKAGE).ks \ - create-ovirt-iso-nodes \ - edit-livecd \ - livecd-iso-to-iscsi \ - livecd-setauth \ - livecd-rpms \ + $(PACKAGE).spec.in \ README DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \ @@ -70,48 +61,6 @@ RPM_FLAGS += $(if $(_ovirt_dev),--define "extra_release .$(GIT_RELEASE)") NODE_TMP = $(OVIRT_CACHE_DIR)/$(PACKAGE)-$(ARCH)-tmp SRC_KS = $(NODE_TMP)/src.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}" > $@ ;\ - echo "repo --name=ovirt-org --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/$(ARCH)" >> $@ ;\ - printf "$${UPDATE_REPO_LINE}" >> $@ ;\ - echo "repo --name=ovirt-local --baseurl=$(OVIRT_LOCAL_REPO)" >> $@ \ - ) - -src.ks: repos.ks - mkdir -p $(NODE_TMP) - ( \ - cat repos.ks ;\ - if [ 0$(FEDORA) == 0$(CUR_RAWHIDE) ]; then \ - FEDORA_REPO=rawhide ;\ - FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/development/source/SRPMS,--mirrorlist=$(FEDORA_MIRROR)?repo=rawhide-source&arch=source)" ;\ - OVIRT_DISTRO=development ;\ - else \ - FEDORA_REPO=f$(FEDORA) ;\ - FEDORA_REPO_LOC="$(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/releases/$(FEDORA)/Everything/source/SRPMS,--mirrorlist=$(FEDORA_MIRROR)?repo=fedora-source-$(FEDORA)&arch=source)" ;\ - OVIRT_DISTRO=$(FEDORA) ;\ - UPDATE_REPO_LINE="repo --name=$${FEDORA_REPO}-updates-source $(if $(FEDORA_URL),--baseurl=$(FEDORA_URL)/updates/$(FEDORA)/SRPMS,--mirrorlist=$(FEDORA_MIRROR)?repo=updates-released-source-f$(FEDORA)&arch=source)" ;\ - fi ;\ - echo "repo --name=$${FEDORA_REPO}-source $${FEDORA_REPO_LOC}" ;\ - echo "repo --name=ovirt-org-source --baseurl=$(OVIRT_URL)/$${OVIRT_DISTRO}/src" ;\ - echo "$${UPDATE_REPO_LINE}" ;\ - echo "%packages --nobase" ;\ - grep -v '^-' common-pkgs.ks ;\ - echo "%end" ;\ - ) > $(SRC_KS) keys: if [ "$(_ovirt_dev)" = 1 -a -f $(AUTH_KEYS) ]; then \ @@ -126,7 +75,7 @@ $(NVR).$(PKG_FMT): no_nscd repos.ks keys case $(SELINUX_ENFORCING) in \ Enforcing) sudo /usr/sbin/setenforce Permissive ;; \ Permissive) ;; \ - *) if ksflatten $(PACKAGE).ks 2>/dev/null \ + *) if cat $(OVIRT_NODE_RECIPE) \ | grep -q '^selinux --disabled'; then \ echo WARNING: SELinux disabled in kickstart ;\ else \ @@ -136,7 +85,7 @@ $(NVR).$(PKG_FMT): no_nscd repos.ks keys fi ;; \ esac ;\ ) - sudo livecd-creator --skip-minimize -c $(PACKAGE).ks \ + sudo livecd-creator --skip-minimize -c $(OVIRT_NODE_RECIPE) \ -f $(PACKAGE) \ --tmpdir='$(NODE_TMP)' \ --cache='$(OVIRT_CACHE_DIR)/yum-$(ARCH)' @@ -155,7 +104,7 @@ $(NVR).$(PKG_FMT).$(SUM): $(NVR).$(PKG_FMT) $(PACKAGE).$(PKG_FMT) node: $(NVR).$(PKG_FMT).$(SUM) PUNGI = $(NODE_TMP)/tree/pungi -source: src.ks +source: @sudo rm -Rf $(PUNGI) @mkdir -p $(PUNGI) -- 1.6.2.5
David Huff
2009-Oct-14 20:13 UTC
[Ovirt-devel] [PATCH 2/4] modified spec file for inclusion in Fedora
--- ovirt-node-image.spec.in | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ovirt-node-image.spec.in b/ovirt-node-image.spec.in index 1f8c31b..e5ef318 100644 --- a/ovirt-node-image.spec.in +++ b/ovirt-node-image.spec.in @@ -23,6 +23,7 @@ URL: ovirt.org BuildRequires: livecd-tools >= 020-2 BuildRequires: appliance-tools >= 003.9 %endif +BuildRequires: ovirt-node-tools Requires: livecd-tools >= 020-2 %define app_root %{_datadir}/%{name} @@ -63,11 +64,11 @@ mkdir %{buildroot} %{__install} -d -m0755 %{buildroot}%{app_root} %{__install} -p -m0644 %{image_iso} %{buildroot}%{app_root} %{__install} -d -m0755 %{buildroot}%{_sbindir} -%{__install} -p -m0755 create-ovirt-iso-nodes %{buildroot}%{_sbindir} -%{__install} -p -m0755 edit-livecd %{buildroot}%{_sbindir} -%{__install} -p -m0755 livecd-iso-to-iscsi %{buildroot}%{_sbindir} -%{__install} -p -m0755 livecd-setauth %{buildroot}%{_sbindir} -%{__install} -p -m0755 livecd-rpms %{buildroot}%{_sbindir} +#%{__install} -p -m0755 create-ovirt-iso-nodes %{buildroot}%{_sbindir} +#%{__install} -p -m0755 edit-livecd %{buildroot}%{_sbindir} +#%{__install} -p -m0755 livecd-iso-to-iscsi %{buildroot}%{_sbindir} +#%{__install} -p -m0755 livecd-setauth %{buildroot}%{_sbindir} +#%{__install} -p -m0755 livecd-rpms %{buildroot}%{_sbindir} %{__tar} -xf %{image_manifests} -C %{buildroot}%{app_root} %clean @@ -93,11 +94,11 @@ cobbler sync > /dev/null 2>&1 || : %doc %{app_root}/manifests/ovirt-release %defattr(0755,root,root,0755) -%{_sbindir}/create-ovirt-iso-nodes -%{_sbindir}/edit-livecd -%{_sbindir}/livecd-iso-to-iscsi -%{_sbindir}/livecd-setauth -%{_sbindir}/livecd-rpms +#%{_sbindir}/create-ovirt-iso-nodes +#%{_sbindir}/edit-livecd +#%{_sbindir}/livecd-iso-to-iscsi +#%{_sbindir}/livecd-setauth +#%{_sbindir}/livecd-rpms %files pxe %defattr(0644,root,root,0755) -- 1.6.2.5
David Huff
2009-Oct-14 20:13 UTC
[Ovirt-devel] [PATCH 3/4] removed tools, these are now in ovirt-node-recipe which is subpackage of ovirt-node
--- common-blacklist.ks | 161 ------------------------------------------------- common-install.ks | 19 ------ common-pkgs.ks | 78 ------------------------ common-post.ks | 167 --------------------------------------------------- ovirt-node-image.ks | 118 ------------------------------------ 5 files changed, 0 insertions(+), 543 deletions(-) delete mode 100644 common-blacklist.ks delete mode 100644 common-install.ks delete mode 100644 common-pkgs.ks delete mode 100644 common-post.ks delete mode 100644 ovirt-node-image.ks diff --git a/common-blacklist.ks b/common-blacklist.ks deleted file mode 100644 index 3499ccf..0000000 --- a/common-blacklist.ks +++ /dev/null @@ -1,161 +0,0 @@ -# -*-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 -# 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/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/common-install.ks b/common-install.ks deleted file mode 100644 index d6620f7..0000000 --- a/common-install.ks +++ /dev/null @@ -1,19 +0,0 @@ -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/common-pkgs.ks b/common-pkgs.ks deleted file mode 100644 index d0d5170..0000000 --- a/common-pkgs.ks +++ /dev/null @@ -1,78 +0,0 @@ -audit -bc -kernel -hwdata -passwd -policycoreutils -rootfiles -dhclient -openssh-clients -openssh-server -kvm -libmlx4 -ovirt-node-stateless -ovirt-node-selinux -ovirt-node-logos -ovirt-node-release --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 -# bugzilla.redhat.com/show_bug.cgi?id=512358 -etherboot-zroms-kvm diff --git a/common-post.ks b/common-post.ks deleted file mode 100644 index f8e4a54..0000000 --- a/common-post.ks +++ /dev/null @@ -1,167 +0,0 @@ -# -*-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 - -# 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 -dirs /var/lib/dnsmasq -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/ovirt-node-image.ks b/ovirt-node-image.ks deleted file mode 100644 index 6b9e2ac..0000000 --- a/ovirt-node-image.ks +++ /dev/null @@ -1,118 +0,0 @@ -%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:13 UTC
[Ovirt-devel] [PATCH 4/4] removed ks files now in ovirt-node-recipe, which is subpackage of ovirt-node
--- create-ovirt-iso-nodes | 135 ----------------------------- edit-livecd | 220 ------------------------------------------------ livecd-iso-to-iscsi | 201 ------------------------------------------- livecd-rpms | 28 ------ livecd-setauth | 50 ----------- 5 files changed, 0 insertions(+), 634 deletions(-) delete mode 100755 create-ovirt-iso-nodes delete mode 100755 edit-livecd delete mode 100755 livecd-iso-to-iscsi delete mode 100755 livecd-rpms delete mode 100755 livecd-setauth diff --git a/create-ovirt-iso-nodes b/create-ovirt-iso-nodes deleted file mode 100755 index fe2e7ab..0000000 --- a/create-ovirt-iso-nodes +++ /dev/null @@ -1,135 +0,0 @@ -#!/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/edit-livecd b/edit-livecd deleted file mode 100755 index d69ca9d..0000000 --- a/edit-livecd +++ /dev/null @@ -1,220 +0,0 @@ -#!/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/livecd-iso-to-iscsi b/livecd-iso-to-iscsi deleted file mode 100755 index fd3934d..0000000 --- a/livecd-iso-to-iscsi +++ /dev/null @@ -1,201 +0,0 @@ -#!/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/livecd-rpms b/livecd-rpms deleted file mode 100755 index 0649cba..0000000 --- a/livecd-rpms +++ /dev/null @@ -1,28 +0,0 @@ -#!/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/livecd-setauth b/livecd-setauth deleted file mode 100755 index eb8922f..0000000 --- a/livecd-setauth +++ /dev/null @@ -1,50 +0,0 @@ -#!/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
Possibly Parallel Threads
- Refactor ovirt-node code base for inclusion in Fedora
- [PATCH node-image] add livecd-iso-to-iscsi script to support iscsi root booting setup
- ovirt-node-image patchset Fedora
- oVirt Appliance / Single Machine Install
- [PATCH ovirt-node-image] fixes for edit-livecd