Perry Myers
2008-Jul-29 18:13 UTC
[Ovirt-devel] [PATCH] Merge ovirt-setup script into spec file for ovirt-managed-node
Since ovirt-managed-node is not meant to be installed or setup standalone, there is no need to have a separate ovirt-setup script. So the contents of this script are merged into the spec file in %install and %post as appropriate. In addition, also added /etc/ovirt-release and changed the /etc/issue to have the version/release in it. Signed-off-by: Perry Myers <pmyers at redhat.com> --- ovirt-managed-node/ovirt-managed-node.spec | 59 +++++++++++++++++++++-- ovirt-managed-node/src/scripts/ovirt | 4 ++ ovirt-managed-node/src/scripts/ovirt-setup | 71 ---------------------------- 3 files changed, 59 insertions(+), 75 deletions(-) delete mode 100755 ovirt-managed-node/src/scripts/ovirt-setup diff --git a/ovirt-managed-node/ovirt-managed-node.spec b/ovirt-managed-node/ovirt-managed-node.spec index 0cd3aa8..d1887b5 100644 --- a/ovirt-managed-node/ovirt-managed-node.spec +++ b/ovirt-managed-node/ovirt-managed-node.spec @@ -54,11 +54,30 @@ make %{__install} -p -m0755 scripts/kvm-ifup %{buildroot}%{_sysconfdir} %{__install} -p -m0755 scripts/dhclient-exit-hooks %{buildroot}%{_sysconfdir} -%{__install} -p -m0755 scripts/ovirt-setup %{buildroot}%{app_root} - %{__install} -p -m0755 logrotate/ovirt-logrotate %{buildroot}%{_sysconfdir}/cron.hourly %{__install} -p -m0644 logrotate/ovirt-logrotate.conf %{buildroot}%{_sysconfdir}/logrotate.d +echo "oVirt Managed Node release %{version}-%{release}" > %{buildroot}%{_sysconfdir}/ovirt-release +g=$(printf '\33[1m\33[32m') # similar to g=$(tput bold; tput setaf 2) +n=$(printf '\33[m') # similar to n=$(tput sgr0) +cat <<EOF > %{buildroot}%{_sysconfdir}/issue + + 888 888 ${g}d8b$n 888 + 888 888 ${g}Y8P$n 888 + 888 888 888 + .d88b. Y88b d88P 888 888d888 888888 + d88''88b Y88b d88P 888 888P' 888 + 888 888 Y88o88P 888 888 888 + Y88..88P Y888P 888 888 Y88b. + 'Y88P' Y8P 888 888 'Y888 + + Managed Node release %{version}-%{release} + + Virtualization just got the ${g}Green Light$n + +EOF +cp -p %{buildroot}%{_sysconfdir}/issue %{buildroot}%{_sysconfdir}/issue.net + %clean %{__rm} -rf %{buildroot} @@ -69,8 +88,35 @@ make /sbin/chkconfig ovirt on /sbin/chkconfig --add ovirt-post /sbin/chkconfig ovirt-post on +/sbin/chkconfig --add collectd +/sbin/chkconfig collectd on + +# just to get a boot warning to shut up +touch /etc/resolv.conf -%{app_root}/ovirt-setup +# make libvirtd listen on the external interfaces +sed -i -e "s/^#\(LIBVIRTD_ARGS=\"--listen\"\).*/\1/" /etc/sysconfig/libvirtd + +# set up qemu daemon to allow outside VNC connections +sed -i -e "s/^[[:space:]]*#[[:space:]]*\(vnc_listen = \"0.0.0.0\"\).*/\1/" \ + /etc/libvirt/qemu.conf + +# set up libvirtd to listen on TCP (for kerberos) +sed -i -e "s/^[[:space:]]*#[[:space:]]*\(listen_tcp\)\>.*/\1 = 1/" \ + -e "s/^[[:space:]]*#[[:space:]]*\(listen_tls\)\>.*/\1 = 0/" \ + /etc/libvirt/libvirtd.conf + +# make sure we don't autostart virbr0 on libvirtd startup +rm -f /etc/libvirt/qemu/networks/autostart/default.xml + +# with the new libvirt (0.4.0), make sure we we setup gssapi in the mech_list +if [ `egrep -c "^mech_list: gssapi" /etc/sasl2/libvirt.conf` -eq 0 ]; then + sed -i -e "s/^\([[:space:]]*mech_list.*\)/#\1/" /etc/sasl2/libvirt.conf + echo "mech_list: gssapi" >> /etc/sasl2/libvirt.conf +fi + +# remove the /etc/krb5.conf file; it will be fetched on bootup +rm -f /etc/krb5.conf %preun if [ "$1" = 0 ] ; then @@ -90,14 +136,19 @@ fi %{_sysconfdir}/dhclient-exit-hooks %config %{_sysconfdir}/logrotate.d/ovirt-logrotate.conf %config %{_sysconfdir}/cron.hourly/ovirt-logrotate -%{app_root}/ovirt-setup %defattr(-,root,root,0644) %{_initrddir}/ovirt-functions %{_sysconfdir}/collectd.conf.in %{_sysconfdir}/chkconfig.d/collectd +%config %attr(0644,root,root) %{_sysconfdir}/ovirt-release +%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/issue +%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/issue.net %doc README NEWS AUTHOR ChangeLog %changelog +* Tue Jul 29 2008 Perry Myers <pmyers at redhat.com> - 0.92 0.2 +- Added /etc/ovirt-release and merged ovirt-setup into spec file + * Wed Jul 02 2008 Darryl Pierce <dpierce at redhat.com> - 0.92 0.2 - Added log rotation to limit file system writes. diff --git a/ovirt-managed-node/src/scripts/ovirt b/ovirt-managed-node/src/scripts/ovirt index f1891f2..157f678 100755 --- a/ovirt-managed-node/src/scripts/ovirt +++ b/ovirt-managed-node/src/scripts/ovirt @@ -11,6 +11,10 @@ . /etc/init.d/ovirt-functions start() { + # Regardless of how iptables is configured, we always need the physdev bridge, + # and it needs to be at the front of the forward chain + iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT + find_srv ipa tcp krb5_conf=/etc/krb5.conf if [ ! -s $krb5_conf ]; then diff --git a/ovirt-managed-node/src/scripts/ovirt-setup b/ovirt-managed-node/src/scripts/ovirt-setup deleted file mode 100755 index 87f8b7a..0000000 --- a/ovirt-managed-node/src/scripts/ovirt-setup +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -# just to get a boot warning to shut up -touch /etc/resolv.conf - -echo "Setting up Networking" -cat > /etc/sysconfig/iptables <<EOF -*filter -:INPUT ACCEPT [0:0] -:FORWARD ACCEPT [0:0] -:OUTPUT ACCEPT [0:0] --A FORWARD -m physdev --physdev-is-bridged -j ACCEPT -COMMIT -EOF - -echo "Setting up libvirt interfaces" -# make libvirtd listen on the external interfaces -sed -i -e 's/^#\(LIBVIRTD_ARGS="--listen"\).*/\1/' /etc/sysconfig/libvirtd - -echo "Setting up libvirt VNC and networking" -# set up qemu daemon to allow outside VNC connections -sed -i -e 's/^[[:space:]]*#[[:space:]]*\(vnc_listen = "0.0.0.0"\).*/\1/' \ - /etc/libvirt/qemu.conf - -# set up libvirtd to listen on TCP (for kerberos) -sed -i -e 's/^[[:space:]]*#[[:space:]]*\(listen_tcp\)\>.*/\1 = 1/' \ - -e 's/^[[:space:]]*#[[:space:]]*\(listen_tls\)\>.*/\1 = 0/' \ - /etc/libvirt/libvirtd.conf - -# make sure we don't autostart virbr0 on libvirtd startup -rm -f /etc/libvirt/qemu/networks/autostart/default.xml - -# with the new libvirt (0.4.0), make sure we we setup gssapi in the mech_list -if [ `egrep -c '^mech_list: gssapi' /etc/sasl2/libvirt.conf` -eq 0 ]; then - sed -i -e 's/^\([[:space:]]*mech_list.*\)/#\1/' /etc/sasl2/libvirt.conf - echo "mech_list: gssapi" >> /etc/sasl2/libvirt.conf -fi - -echo "Clearing kerberos config" -# remove the /etc/krb5.conf file; it will be fetched on bootup -rm -f /etc/krb5.conf - -echo "Turing on ovirt services" -chkconfig ovirt-early on -chkconfig ovirt on -chkconfig ovirt-post on -chkconfig collectd on - -echo "Setting up login screen" -# pretty login screen.. - -g=$(printf '\33[1m\33[32m') # similar to g=$(tput bold; tput setaf 2) -n=$(printf '\33[m') # similar to n=$(tput sgr0) -cat <<EOF > /etc/issue - - 888 888 ${g}d8b$n 888 - 888 888 ${g}Y8P$n 888 - 888 888 888 - .d88b. Y88b d88P 888 888d888 888888 - d88''88b Y88b d88P 888 888P' 888 - 888 888 Y88o88P 888 888 888 - Y88..88P Y888P 888 888 Y88b. - 'Y88P' Y8P 888 888 'Y888 - - Managed node - - Virtualization just got the ${g}Green Light$n - -EOF - -cp /etc/issue /etc/issue.net -- 1.5.5.1