Zhou Zheng Sheng has uploaded a new change for review. Change subject: vdsmd.init.in: simplify system services management by using vdsm-tool ......................................................................
vdsmd.init.in: simplify system services management by using vdsm-tool In vdsm-tool there is a module implemented the service management utilities that covers systemd, upstart and sysv. Change-Id: I57a89d969b8ff4eba57daa893dc29840358c30e7 Signed-off-by: Zhou Zheng Sheng <[email protected]> --- M vdsm/vdsmd.init.in 1 file changed, 9 insertions(+), 50 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/13702/1 diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in index c804ce8..b1ed4ff 100755 --- a/vdsm/vdsmd.init.in +++ b/vdsm/vdsmd.init.in @@ -122,21 +122,17 @@ for srv in $CONFLICTING_SERVICES do - /sbin/chkconfig $srv off - if /sbin/service $srv status > /dev/null 2>&1; + /usr/bin/vdsm-tool service_disable $srv + if /usr/bin/vdsm-tool service_status $srv > /dev/null 2>&1; then if [ "$srv" == "libvirt-guests" ]; then /bin/rm -f /var/lock/subsys/libvirt-guests else - /sbin/service $srv stop + /usr/bin/vdsm-tool service_stop $srv fi fi done return 0 -} - -libvirt_should_use_upstart() { - [[ -x /sbin/initctl ]] } start_needed_srv() { @@ -145,10 +141,10 @@ for srv in $NEEDED_SERVICES do - if ! /sbin/service $srv status > /dev/null 2>&1; + if ! /usr/bin/vdsm-tool service_status $srv > /dev/null 2>&1; then echo "Starting $srv..." - /sbin/service $srv start + /usr/bin/vdsm-tool service_start $srv ret_val=$? if [ $ret_val -ne 0 ] then @@ -157,8 +153,6 @@ fi fi done - - /sbin/service iscsid force-start } test_lo() { @@ -362,11 +356,7 @@ ovirt_store_config "$lconf" "$qconf" "$ldconf" "$llogr" - if libvirt_should_use_upstart; then - /sbin/initctl restart libvirtd 2>/dev/null || : - else - /bin/systemctl restart libvirtd.service - fi + /usr/bin/vdsm-tool service_restart libvirtd # # finished reconfiguration, do not trigger @@ -394,41 +384,10 @@ configure_libvirt $args } -stop_libvirtd_sysv() { - # stop libvirt SysV service if we intend to configure upstart - - if libvirt_should_use_upstart && ! [[ -f /etc/init/libvirtd.conf ]]; then - /sbin/chkconfig libvirtd off - /sbin/service libvirtd stop - fi -} - start_libvirtd() { - local packaged target - local startout - - if ! libvirt_should_use_upstart; then - /sbin/service libvirtd start - return - fi - - packaged=`/bin/rpm -ql libvirt libvirt-daemon | \ - /bin/grep libvirtd.upstart | /usr/bin/tail -1` - target=/etc/init/libvirtd.conf - - if [[ -f "$packaged" ]] && ! diff -q "$packaged" "$target" >/dev/null; + if ! /usr/bin/vdsm-tool service_status libvirtd > /dev/null 2>&1; then - /bin/cp -p "$packaged" "$target" || return 1 - /sbin/initctl reload-configuration - fi - - startout=`/sbin/initctl start libvirtd 2>&1` - if [[ "$?" -eq 0 || "$startout" =~ .*already\ running.* ]]; - then - return 0 - else - echo "$startout" >&2 - return 1 + /usr/bin/vdsm-tool service_start libvirtd fi } @@ -441,7 +400,7 @@ local ret_val python @VDSMDIR@/hooks.pyc before_vdsm_start - shutdown_conflicting_srv && stop_libvirtd_sysv + shutdown_conflicting_srv if ! @LIBEXECDIR@/vdsm-gencerts.sh --check; then echo -n $"Configuring a self-signed VDSM host certificate: " -- To view, visit http://gerrit.ovirt.org/13702 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I57a89d969b8ff4eba57daa893dc29840358c30e7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Zhou Zheng Sheng <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
