New patch submitted by Sanjay Mehrotra (smehrotr@redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/675
commit af9ee33d5c26113c4a09af45a865fecc268ece95 Author: Sanjay Mehrotra smehrotr@redhat.com Date: Thu Jul 7 16:09:39 2011 +0300
BZ#694026 initctl libvirtd as part of its configuration vdsm use to control libvirtd using System V init script. The changes have been made so that vdsm start uses initctl to start libvirtd. If libvirtd is already using initctl, then it will start libvirtd if it is not running. If initctl fails, it will default to sysv initscript. This is patch 1 of the changes. The second patch will change the libvirtd to its default sys v during uninstall of vdsm.
Change-Id: I0ea7b64a710b6e2c48fb96da82ebea64fd0482a4
diff --git a/vdsm.spec.in b/vdsm.spec.in index 8f01acc..85a11ed 100644 --- a/vdsm.spec.in +++ b/vdsm.spec.in @@ -151,6 +151,12 @@ then /usr/sbin/saslpasswd2 -p -a libvirt vdsm@rhevh < "$pfile" fi
+# copy the libvirtd upstart job control. +upstart=`rpm -ql libvirt | grep libvirtd.upstart | head --lines=1` +if [ -f "$upstart" ]; then + cp -f $upstart /etc/vdsm/libvirtd.upstart +fi + %preun if [ "$1" -eq 0 ] then @@ -180,6 +186,14 @@ _EOF if selinuxenabled; then setsebool virt_use_nfs off fi + + if initctl list | grep -q libvirtd; then + initctl stop libvirtd + rm -f /etc/init/libvirtd.conf + chkconfig libvirtd on + service libvirtd condrestart + rm -f /etc/vdsm/libvirtd.upstart + fi fi
%postun diff --git a/vdsm/vdsmd b/vdsm/vdsmd index 6b35e23..53705b3 100755 --- a/vdsm/vdsmd +++ b/vdsm/vdsmd @@ -30,7 +30,7 @@ RESPAWNPIDFILE=@P_VDSM_RUN@/respawn.pid CORE_DUMP_PATH=/var/log/core/core.%p.%t.dump DOM_METADATA_BACKUP_DIR=/var/log/vdsm/backup CORE_PATTERN=/proc/sys/kernel/core_pattern -NEEDED_SERVICES="iscsid multipathd libvirtd" +NEEDED_SERVICES="iscsid multipathd" CONFLICTING_SERVICES="libvirt-guests" # TODO: Remove cpu cgroup disabling when BZ#623712 is resolved (kernel on # massively multicore platforms failing to scale with cgroups turned on) @@ -323,8 +323,6 @@ configure_libvirt() virt_use_nfs=1 _EOF /usr/sbin/setsebool virt_use_nfs on - - service libvirtd condrestart }
RETVAL=0 @@ -343,26 +341,47 @@ reconfigure() { configure_libvirt $args }
+start_libvirtd() { + if ! initctl list | grep -q libvirtd + then + chkconfig libvirtd off && service libvirtd stop >/dev/null 2>&1 + cp -f /etc/vdsm/libvirtd.upstart /etc/init/libvirtd.conf + initctl reload-configuration && initctl start libvirtd + fi + + initctl status libvirtd | grep -q "libvirtd start" && return 0; + + if initctl status libvirtd | grep -q "libvirtd stop" + then + initctl start libvirtd + else + service libvirtd condrestart + chkconfig libvirtd on + fi +} + start() { local ret_val python @P_VDSM@/hooks.pyc before_vdsm_start
- reconfigure noforce + start_needed_srv ret_val=$? if [ $ret_val -ne 0 ] then - log_failure_msg "$prog: failed to reconfigure libvirt" - return $ret_val + log_failure_msg "$prog: one of the dependent services did not start, error code $ret_val" + return $ret_val fi
- start_needed_srv + reconfigure noforce ret_val=$? if [ $ret_val -ne 0 ] then - log_failure_msg "$prog: one of the dependent services did not start, error code $ret_val" - return $ret_val + log_failure_msg "$prog: failed to reconfigure libvirt" + return $ret_val fi
+ start_libvirtd + shutdown_conflicting_srv @P_VDSM@/vdsm-restore-net-config load_needed_modules
vdsm-patches@lists.fedorahosted.org