Dan Kenigsberg has uploaded a new change for review. Change subject: split restore-net-conf away of vdsmd.init service ......................................................................
split restore-net-conf away of vdsmd.init service There is no need to revert network configuration when vdsmd is restarted, only when the host is rebooted after being fenced. This becomes painfully visisble if vdsm is restarted due to spm failover, and while at it - rolls back an unrelated network configuration. Change-Id: Iabe00320d090b9055c3d619260ed57ee953702f1 Signed-off-by: Dan Kenigsberg <[email protected]> --- M .gitignore M vdsm.spec.in M vdsm/Makefile.am A vdsm/vdsm-restore-net-config.init.in A vdsm/vdsm-restore-net-config.service M vdsm/vdsmd.init.in 6 files changed, 86 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/10334/1 diff --git a/.gitignore b/.gitignore index d36ed82..08b17c1 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ vdsm/vdsm.rwtab vdsm/vdsmd.8 vdsm/vdsmd.init +vdsm/vdsm-restore-net-config.init vdsm_api/vdsm-api.html vdsm-tool/load_needed_modules.py vdsm-tool/validate_ovirt_certs.py diff --git a/vdsm.spec.in b/vdsm.spec.in index b942b7a..cd11b90 100644 --- a/vdsm.spec.in +++ b/vdsm.spec.in @@ -446,6 +446,8 @@ # Install the SysV init scripts install -Dm 0755 vdsm/vdsmd.init %{buildroot}%{_initrddir}/vdsmd install -Dm 0755 vdsm_reg/vdsm-reg.init %{buildroot}%{_initrddir}/vdsm-reg +install -Dm 0755 vdsm/vdsm-restore-net-config.init \ + %{buildroot}%{_initrddir}/vdsm-restore-net-config # This is not commonplace, but we want /var/log/core to be a world-writable # dropbox for core dumps @@ -458,6 +460,8 @@ # Install the systemd scripts install -Dm 0755 vdsm/vdsmd.init %{buildroot}/lib/systemd/systemd-vdsmd install -Dm 0644 vdsm/vdsmd.service %{buildroot}%{_unitdir}/vdsmd.service +install -Dm 0644 vdsm/vdsm-restore-net-config.service \ + %{buildroot}%{_unitdir}/vdsm-restore-net-config.service install -Dm 0755 vdsm_reg/vdsm-reg.init \ %{buildroot}/lib/systemd/systemd-vdsm-reg install -Dm 0644 vdsm_reg/vdsm-reg.service \ @@ -507,10 +511,12 @@ %if 0%{?rhel} if [ "$1" -eq 1 ] ; then /sbin/chkconfig --add vdsmd + /sbin/chkconfig --add vdsm-resotre-net-config fi %else if [ "$1" -eq 1 ] ; then /bin/systemctl enable vdsmd.service >/dev/null 2>&1 || : + /bin/systemctl enable vdsm-restore-net-config.service >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi exit 0 @@ -522,6 +528,7 @@ then /sbin/service vdsmd stop > /dev/null 2>&1 || : /sbin/chkconfig --del vdsmd + /sbin/chkconfig --del vdsm-resotre-net-config /bin/sed -i '/# by vdsm$/d' \ /etc/libvirt/libvirtd.conf \ @@ -547,6 +554,7 @@ %else if [ "$1" -eq 0 ]; then /bin/systemctl --no-reload disable vdsmd.service > /dev/null 2>&1 || : + /bin/systemctl --no-reload disable vdsm-restore-net-config.service > /dev/null 2>&1 || : /bin/systemctl stop vdsmd.service > /dev/null 2>&1 || : fi exit 0 @@ -610,9 +618,11 @@ %doc COPYING README vdsm/vdsm.conf.sample vdsm_api/vdsm-api.html %if 0%{?rhel} %{_initrddir}/vdsmd +%{_initrddir}/vdsm-restore-net-config %else /lib/systemd/systemd-vdsmd %{_unitdir}/vdsmd.service +%{_unitdir}/vdsm-restore-net-config.service %endif %dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@ %ghost %dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@/hsm-tasks diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am index dc0590e..7ac5dc1 100644 --- a/vdsm/Makefile.am +++ b/vdsm/Makefile.am @@ -88,9 +88,11 @@ mom.conf \ sudoers.vdsm \ vdsm-logrotate.conf \ + vdsm-restore-net-config.init \ vdsm.conf.sample \ vdsm.rwtab \ - vdsmd.init + vdsmd.init \ + $(NULL) dist_vdsm_SCRIPTS = \ addNetwork \ @@ -136,6 +138,8 @@ vdsm-libvirt-logrotate \ vdsm-logrotate \ vdsm-logrotate.conf.in \ + vdsm-restore-net-config.init.in \ + vdsm-restore-net-config.service \ vdsm.rwtab.in \ vdsm-store-net-config.in \ vdsm-sysctl.conf diff --git a/vdsm/vdsm-restore-net-config.init.in b/vdsm/vdsm-restore-net-config.init.in new file mode 100644 index 0000000..83a437a --- /dev/null +++ b/vdsm/vdsm-restore-net-config.init.in @@ -0,0 +1,58 @@ +#!/bin/sh +# +# vdsm-restore-net-config: restore network interface configuration +# +# chkconfig: 2345 98 01 +# description: roll back the host network configuration to the last \ +# known-good one. + +### BEGIN INIT INFO +# Provides: vdsm-restore-net-config +# Required-Start: $network +# Short-Description: restore network configuration files +# Description: roll back the host network configuration to the last \ +# known-good one. +# +### END INIT INFO + +sysconfdir="/etc" + +# Source function library. +test ! -r "$sysconfdir"/rc.d/init.d/functions || + . "$sysconfdir"/rc.d/init.d/functions + +# usage [val] +# Display usage string, then exit with VAL (defaults to 2). +usage() { + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit ${1-2} +} + +retval=0 +case "$1" in + # commands required in all Fedora initscripts + start|restart|reload|force-reload|condrestart|try-restart) + echo -n $"Running $prog $1: " + @VDSMDIR@/vdsm-restore-net-config + retval=$? + echo + ;; + stop|status) + snapshotdir=`python -c 'from vdsm.netinfo import NET_LOGICALNET_CONF_BACK_DIR as d;print d'` + if test -d "$snapshotdir" + then + echo $"There are uncommitted network configuration changes" + else + echo $"No pending network configuration changes" + fi + ;; + + --help) + usage 0 + ;; + *) + usage + ;; +esac + +exit $retval diff --git a/vdsm/vdsm-restore-net-config.service b/vdsm/vdsm-restore-net-config.service new file mode 100644 index 0000000..a43da99 --- /dev/null +++ b/vdsm/vdsm-restore-net-config.service @@ -0,0 +1,12 @@ +[Unit] +Description=Restore failed Vdsm network configuration on boot +Requires=libvirtd.service +Before=vdsmd.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/share/vdsm/vdsm-restore-net-config + +[Install] +WantedBy=multi-user.target diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in index c8223d3..873b585 100755 --- a/vdsm/vdsmd.init.in +++ b/vdsm/vdsmd.init.in @@ -475,7 +475,6 @@ return $ret_val fi - @VDSMDIR@/vdsm-restore-net-config /usr/bin/vdsm-tool load-needed-modules mk_data_center mk_core_path -- To view, visit http://gerrit.ovirt.org/10334 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iabe00320d090b9055c3d619260ed57ee953702f1 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
