Change in vdsm[master]: net: maintain legacy addNetwork/delNetwork APIs
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: net: maintain legacy addNetwork/delNetwork APIs
......................................................................
net: maintain legacy addNetwork/delNetwork APIs
commits 43a6b9 and 167b02 changed the signature of addNetwork and
delNetwork respectively. This must not happen, as Engine 3.5 uses
argument names in its API.
With http://www.ovirt.org/Features/HostNetworkingApi implemented in
engine-3.6, no one is going to call Vdsm's addNetwork/delNetwork any
more. However, we must keep backward compatibility as long as engine-3.5
is supported.
Bug-Url: https://bugzilla.redhat.com/1229632
Change-Id: I2eaf2b41e3e1c88721d855af0ccc3abd6c200034
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/API.py
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/43187/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 89f35ac..eafceb7 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1453,13 +1453,14 @@
finally:
self._cif._networkSemaphore.release()
- def addNetwork(self, network, vlan=None, bond=None, nics=None,
+ def addNetwork(self, bridge, vlan=None, bond=None, nics=None,
options=None):
"""Add a new network to this vds.
Network topology is network--[vlan--][bond--]nics.
vlan(number) and bond are optional - pass the empty string to discard
them. """
+ network = bridge
if options is None:
options = {}
@@ -1501,9 +1502,10 @@
finally:
self._cif._networkSemaphore.release()
- def delNetwork(self, network, vlan=None, bond=None, nics=None,
+ def delNetwork(self, bridge, vlan=None, bond=None, nics=None,
options=None):
"""Delete a network from this vds."""
+ network = bridge
if options is None:
options = {}
self.translateNetOptionsToNew(options)
--
To view, visit https://gerrit.ovirt.org/43187
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2eaf2b41e3e1c88721d855af0ccc3abd6c200034
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
8 years, 2 months
Change in vdsm[master]: net: contrib: add veth cleanup to emergency_net_cleanup
by ibarkan@redhat.com
Ido Barkan has uploaded a new change for review.
Change subject: net: contrib: add veth cleanup to emergency_net_cleanup
......................................................................
net: contrib: add veth cleanup to emergency_net_cleanup
Change-Id: I8947588e178ffbe6392d06be536149260d08f5b7
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M contrib/shell_helper
1 file changed, 8 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/43213/1
diff --git a/contrib/shell_helper b/contrib/shell_helper
index 07a82c1..7dc2984 100755
--- a/contrib/shell_helper
+++ b/contrib/shell_helper
@@ -112,6 +112,13 @@
sudo rm /etc/sysconfig/network-scripts/ifcfg-dummy*
}
+del_veths() {
+ for nic in `ip l | awk '{print $2;}' | egrep "^veth"`; do
+ sudo ip link del dev ${nic%:*}
+ done
+ sudo rm /etc/sysconfig/network-scripts/ifcfg-veth*
+}
+
del_bonds() {
for nic in `ip l | awk '{print $2;}' | egrep "^bond"`; do
echo "-${nic%:*}" | sudo tee /sys/class/net/bonding_masters
@@ -173,6 +180,7 @@
emergency_net_cleanup() {
del_dummies
+ del_veths
del_bonds
del_bridges
del_test_nets
--
To view, visit https://gerrit.ovirt.org/43213
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8947588e178ffbe6392d06be536149260d08f5b7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
8 years, 2 months
Change in vdsm[master]: migration: avoid stacktrace on known errors
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: migration: avoid stacktrace on known errors
......................................................................
migration: avoid stacktrace on known errors
In migration code, if VM.migrationCreate() fails on destination host,
we raise RuntimeError to abort the normal flow.
However, in the recovery flow, we inconditionally log the stacktrace
of the exception we catched.
This is good for troubleshooiting, but it is a little pointless in
this specific use case: we know already and precisely what failed.
This patch adds a special-purpose exception for this specific, yet
important, failure scenario, and avoids the stacktrace only when
catching this exception.
Change-Id: Ib35cf08a305018912991a47d0de645395a177e9e
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/migration.py
1 file changed, 12 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/43063/1
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index b8e155f..7ea8753 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -52,6 +52,12 @@
VIR_MIGRATE_PARAM_GRAPHICS_URI = 'graphics_uri'
+class MigrationDestinationSetupError(RuntimeError):
+ """
+ Failed to create migration destination VM.
+ """
+
+
class SourceThread(threading.Thread):
"""
A thread that takes care of migration on the source vdsm.
@@ -295,6 +301,9 @@
if '_migrationParams' in self._vm.conf:
del self._vm.conf['_migrationParams']
SourceThread._ongoingMigrations.release()
+ except MigrationDestinationSetupError as e:
+ self._recover(str(e))
+ # we know what happened, no need to dump hollow stack trace
except Exception as e:
self._recover(str(e))
self.log.exception("Failed to migrate")
@@ -326,8 +335,9 @@
if result['status']['code']:
self.status = result
- raise RuntimeError('migration destination error: ' +
- result['status']['message'])
+ raise MigrationDestinationSetupError(
+ 'migration destination error: ' +
+ result['status']['message'])
if config.getboolean('vars', 'ssl'):
transport = 'tls'
else:
--
To view, visit https://gerrit.ovirt.org/43063
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib35cf08a305018912991a47d0de645395a177e9e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 2 months
Change in vdsm[master]: Removing support in sysv and upstart
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Removing support in sysv and upstart
......................................................................
Removing support in sysv and upstart
sysvinit scripts used to support rhel >=6.6. upstart scripts used to
support debian. Both not required in later versions. systemd scripts
become the standard in fedora rhel and debian.
Change-Id: Ib9af14b3d78badc5250042508d25f294dc514a2d
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M configure.ac
M init/Makefile.am
D init/sysvinit/Makefile.am
D init/sysvinit/respawn
D init/sysvinit/supervdsmd.init.in
D init/sysvinit/vdsmd.init.in
D init/upstart/Makefile.am
D init/upstart/supervdsmd.upstart.in
D init/upstart/vdsm-tmpfiles.upstart.in
D init/upstart/vdsmd.upstart.in
10 files changed, 1 insertion(+), 659 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/40726/1
diff --git a/configure.ac b/configure.ac
index 4e6943a..e1d2544 100644
--- a/configure.ac
+++ b/configure.ac
@@ -341,8 +341,6 @@
debian/Makefile
init/Makefile
init/systemd/Makefile
- init/sysvinit/Makefile
- init/upstart/Makefile
lib/Makefile
lib/vdsm/Makefile
lib/vdsm/netlink/Makefile
diff --git a/init/Makefile.am b/init/Makefile.am
index 15a5c03..62a226b 100644
--- a/init/Makefile.am
+++ b/init/Makefile.am
@@ -18,7 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
-SUBDIRS = systemd sysvinit upstart
+SUBDIRS = systemd
include $(top_srcdir)/build-aux/Makefile.subs
diff --git a/init/sysvinit/Makefile.am b/init/sysvinit/Makefile.am
deleted file mode 100644
index 7beba50..0000000
--- a/init/sysvinit/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Copyright 2008-2012 Red Hat, Inc.
-#
-# 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; either version 2 of the License, or
-# (at your option) any later version.
-#
-# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Refer to the README and COPYING files for full details of the license
-#
-
-include $(top_srcdir)/build-aux/Makefile.subs
-
-nodist_noinst_DATA = \
- supervdsmd.init \
- vdsmd.init \
- $(NULL)
-
-dist_vdsm_SCRIPTS = \
- respawn \
- $(NULL)
-
-CLEANFILES = \
- config.log \
- $(nodist_noinst_DATA) \
- $(NULL)
-
-EXTRA_DIST = \
- supervdsmd.init.in \
- vdsmd.init.in \
- $(NULL)
-
-all-local: \
- $(nodist_noinst_DATA) \
- $(NULL)
diff --git a/init/sysvinit/respawn b/init/sysvinit/respawn
deleted file mode 100755
index d13effc..0000000
--- a/init/sysvinit/respawn
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/bin/bash -e
-
-# Copyright 2010 Red Hat, Inc. and/or its affiliates.
-# Released under GPL v2
-#
-# Author: Dan Kenigsberg <danken(a)redhat.com>
-#
-# Please contact me if something similar, but more standard, is available.
-
-MINLIFETIME=2
-MAX_THRASH_INTERVAL=30
-POST_FAIL_INTERVAL=900
-
-usage() {
- echo usage:
- echo "$0 [options] <slave> [args]"
- echo " --masterpid pidfile"
- echo " --slavepid pidfile"
- echo " --daemon"
- echo " --minlifetime seconds"
- echo " --thrash seconds"
- echo
- echo "make <slave> run, and respawn it on exit"
- exit 1
-}
-
-while [ "$1" != "${1##-}" ];
-do
- case "$1" in
- --minlifetime)
- MINLIFETIME="$2"
- shift 2
- ;;
- --thrash)
- MAX_THRASH_INTERVAL="$2"
- shift 2
- ;;
- --masterpid)
- masterpidfile="$2"
- shift 2
- ;;
- --slavepid)
- slavepidfile="$2"
- shift 2
- ;;
- --daemon)
- daemonize=1
- shift
- ;;
- --)
- shift
- break
- ;;
- *) usage
- ;;
- esac
-done
-
-if [ -z "$*" ];
-then
- usage
-fi
-
-loop() {
- local d0 d1
- local thrash_start
-
- # must use BASHPID since $$ is not updated by &
- [ ! -z "$masterpidfile" ] && echo $BASHPID > "$masterpidfile"
- d0=`date +%s`
- while true
- do
- "$@" &
- [ ! -z "$slavepidfile" ] && echo $! > "$slavepidfile"
- wait $! || :
- d1=`date +%s`
- if [ $[d1-d0] -lt "$MINLIFETIME" ];
- then
- if [[ -n "$thrash_start" ]] && \
- [[ $[d1-thrash_start] -gt "$MAX_THRASH_INTERVAL" ]]; then
- logger -t respawn -- "slave '$*' died too quickly for more than $MAX_THRASH_INTERVAL seconds, master sleeping for $POST_FAIL_INTERVAL seconds"
- thrash_start=
- sleep "$POST_FAIL_INTERVAL"
- else
- logger -t respawn -- "slave '$*' died too quickly, respawning slave"
- [[ -z "$thrash_start" ]] && thrash_start=$d1
- fi
- else
- logger -t respawn -- "slave '$*' died, respawning slave"
- thrash_start=
- fi
- d0=$d1
- done
-}
-
-if [ -z "$daemonize" ];
-then
- loop "$@"
-else
- loop "$@" >/dev/null 2>/dev/null &
-fi
diff --git a/init/sysvinit/supervdsmd.init.in b/init/sysvinit/supervdsmd.init.in
deleted file mode 100755
index f3369c2..0000000
--- a/init/sysvinit/supervdsmd.init.in
+++ /dev/null
@@ -1,116 +0,0 @@
-#! /bin/sh
-#
-# Copyright 2006-2013 Red Hat, Inc. and/or its affiliates.
-#
-# Licensed to you under the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version. See the files README and
-# LICENSE_GPL_v2 which accompany this distribution.
-#
-
-# chkconfig: 2345 99 00
-#
-### BEGIN INIT INFO
-# Provides: supervdsmd
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Description: init script for the Super VDS management server
-# Short-Description: init script for the Super VDS management server
-### END INIT INFO
-
-SUPERVDSM_BIN=@VDSMDIR@/supervdsmServer
-PIDFILE=@VDSMRUNDIR(a)/supervdsmd.pid
-RESPAWNPIDFILE=@VDSMRUNDIR(a)/supervdsm_respawn.pid
-SOCKFILE=@VDSMRUNDIR(a)/svdsm.sock
-prog=supervdsm
-
-[ -f /etc/sysconfig/supervdsmd ] && . /etc/sysconfig/supervdsmd
-. /etc/init.d/functions
-
-log_failure_msg() { echo -n "$@"; failure "$@"; echo; }
-log_success_msg() { echo -n "$@"; success "$@"; echo; }
-
-RETVAL=0
-
-start(){
- test_already_running && return 0
-
- DAEMON_COREFILE_LIMIT=unlimited daemon \
- "@VDSMDIR@/daemonAdapter" -0 /dev/null -1 /dev/null -2 /dev/null \
- "@VDSMDIR@/respawn" --minlifetime 10 --daemon \
- --masterpid "${RESPAWNPIDFILE}" "${SUPERVDSM_BIN}" \
- --sockfile "${SOCKFILE}" --pidfile "${PIDFILE}"
- RETVAL=$?
- [ "$RETVAL" -eq 0 ] && log_success_msg "$prog start" || log_failure_msg "$prog start"
-}
-
-test_already_running()
-{
- if pidofproc -p $RESPAWNPIDFILE >/dev/null || \
- pidofproc -p $PIDFILE $SUPERVDSM_BIN >/dev/null; then
- log_success_msg "$prog: already running"
- return 0
- fi
- return 1
-}
-
-stop(){
- echo "Shutting down supervdsm daemon: "
- if killproc -p "$RESPAWNPIDFILE"; then
- log_success_msg "$prog watchdog stop"
- fi
- if ! pidofproc -p "$PIDFILE" >/dev/null; then
- log_failure_msg "$prog: not running"
- RETVAL=0
- else
- killproc -p "$PIDFILE" -d 2
- RETVAL=$?
- [ "$RETVAL" -eq 0 ] && log_success_msg "$prog stop" || log_failure_msg "$prog stop"
- fi
- return "$RETVAL"
-}
-
-case "$1" in
- start)
- start
- RETVAL=$?
- ;;
- stop)
- stop
- RETVAL=$?
- ;;
- status)
- pidofproc -p "$PIDFILE" "$SUPERVDSM_BIN" >/dev/null
- RETVAL=$?
- if [ "$RETVAL" -eq 0 ]; then
- echo "Super VDSM daemon server is running"
- else
- echo -n "Super VDSM daemon is not running"
- if pidofproc -p "$RESPAWNPIDFILE" >/dev/null; then
- echo ", but its watchdog is"
- else
- echo
- fi
- fi
- ;;
- condrestart)
- pidofproc -p "$PIDFILE" "$SUPERVDSM_BIN" >/dev/null
- RETVAL=$?
- if [ "$RETVAL" -eq 0 ]; then
- $0 stop && $0 start;
- RETVAL=$?;
- fi;
- ;;
- try-restart|restart|force-reload)
- $0 stop && $0 start
- RETVAL=$?
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart|condrestart|force-reload|try-restart}"
- RETVAL=2
-esac
-
-exit "$RETVAL"
-
-
-
diff --git a/init/sysvinit/vdsmd.init.in b/init/sysvinit/vdsmd.init.in
deleted file mode 100755
index 6edd89f..0000000
--- a/init/sysvinit/vdsmd.init.in
+++ /dev/null
@@ -1,270 +0,0 @@
-#! /bin/sh
-#
-# Copyright 2006-2010 Red Hat, Inc. and/or its affiliates.
-#
-# Licensed to you under the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version. See the files README and
-# LICENSE_GPL_v2 which accompany this distribution.
-#
-
-# chkconfig: 2345 99 00
-#
-### BEGIN INIT INFO
-# Provides: vdsmd
-# Required-Start: $syslog $network
-# Should-Start: $time
-# Required-Stop: $syslog
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Description: init script for the VDS management server
-# Short-Description: init script for the VDS management server
-### END INIT INFO
-
-VDSM_BIN="@VDSMDIR@/vdsm"
-prog=vdsm
-PIDFILE=@VDSMRUNDIR(a)/vdsmd.pid
-RESPAWNPIDFILE=@VDSMRUNDIR(a)/respawn.pid
-NEEDED_SERVICES="multipathd rpcbind ntpd wdmd sanlock libvirtd supervdsmd"
-CONFLICTING_SERVICES="libvirt-guests ksmtuned"
-LOCK_FILE="/var/lock/subsys/vdsmd"
-VDSM_TOOL="@BINDIR@/vdsm-tool"
-NICE_LOWEST=-20
-VDSMD_INIT_COMMON="@LIBEXECDIR(a)/vdsmd_init_common.sh"
-RETVAL=0
-
-SYSTEMCTL_SKIP_REDIRECT=true
-
-[ -f /etc/sysconfig/vdsm ] && . /etc/sysconfig/vdsm
-. /etc/init.d/functions
-
-log_failure_msg() { printf "$@"; failure "$@"; echo; }
-log_success_msg() { printf "$@"; success "$@"; echo; }
-
-shutdown_conflicting_srv() {
- local srv
- local ret_val
- local conflicting_services="$1"
-
- for srv in ${conflicting_services}; do
- if initctl status "${srv}" >/dev/null 2>&1; then
- # When srv is Upstart service, status srv always returns 0
- initctl stop "${srv}" || : # stop fails when already down
- initctl status "${srv}" | grep -q stop/waiting
- elif [ -x "/etc/init.d/${srv}" ]; then
- if service "${srv}" status >/dev/null 2>&1; then
- service "${srv}" stop
- fi
- else
- true
- fi
- ret_val=$?
- if [ "${ret_val}" -ne 0 ]; then
- log_failure_msg "${prog}: Stop conflicting ${srv}"
- return "${ret_val}"
- fi
- done
- return 0
-}
-
-start_needed_srv() {
- local srv
- local ret_val
- local needed_services="$1"
-
- for srv in ${needed_services}; do
- if initctl status "${srv}" >/dev/null 2>&1; then
- # When srv is Upstart service, status srv always returns 0
- initctl start "${srv}" || : # start fails when already running
- initctl status "${srv}" | grep -q start/running
- else
- service "${srv}" status >/dev/null 2>&1 || service "${srv}" start
- fi
- ret_val=$?
- if [ "${ret_val}" -ne 0 ]; then
- log_failure_msg "${prog}: Start dependent ${srv}"
- return "${ret_val}"
- fi
- done
-}
-
-start_network() {
- # Check if there are unactivated VDSM devices
- local interfaces dev static_devs activated_devs
-
- pushd /etc/sysconfig/network-scripts/ > /dev/null
-
- # copied from /etc/init.d/network
- interfaces=$(ls ifcfg-* | \
- LC_ALL=C sed -e "$__sed_discard_ignored_files" \
- -e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \
- -e '{ s/^ifcfg-//g;s/[0-9]/ &/}' | \
- LC_ALL=C sort -k 1,1 -k 2n | \
- LC_ALL=C sed 's/ //')
-
- for dev in $interfaces; do
- ifcfg="ifcfg-$dev"
- grep -q '# Generated by VDSM version' "$ifcfg" || continue
- grep -q 'ONBOOT=yes' "$ifcfg" || continue
- static_devs="$static_devs $dev"
- done
- popd > /dev/null
-
- activated_devs="`service network status | tail -1`"
-
- for static_dev in $static_devs; do
- if [[ $activated_devs != *"$static_dev"* ]]; then
- service network start
- ret_val=$?
- if [ "${ret_val}" -ne 0 ]; then
- log_failure_msg "${prog}: Start dependent network"
- return "${ret_val}"
- fi
- break
- fi
- done
-}
-
-test_already_running()
-{
- if pidofproc -p "$RESPAWNPIDFILE" >/dev/null || \
- pidofproc -p "$PIDFILE" "$VDSM_BIN" >/dev/null; then
- log_success_msg "$prog: already running"
- return 0
- fi
- return 1
-}
-
-reconfigure() {
- if [ "${1}" = "force" ] || ! "$VDSM_TOOL" is-configured; then
- "$VDSM_TOOL" configure "--force"
- fi
-}
-
-restore_nets(){
- "$VDSM_TOOL" restore-nets
- return 0
-}
-
-unified_network_persistence_upgrade(){
- echo 'Upgrading to unified persistence if needed'
- "$VDSM_TOOL" ${UPGRADE_LOGGING_PARAMS} upgrade-unified-persistence
-}
-
-upgrade_300_nets(){
- echo 'Upgrading to v3.x networking if needed'
- "$VDSM_TOOL" ${UPGRADE_LOGGING_PARAMS} upgrade-3.0.0-networks
-}
-
-start() {
- test_already_running && return 0
-
- start_network || return 1
- shutdown_conflicting_srv "${CONFLICTING_SERVICES}" || return 1
- start_needed_srv "${NEEDED_SERVICES}" || return 1
-
- # "service iscsid start" may not start becasue we configure node.startup to
- # manual. See /etc/init.d/iscsid.
- service iscsid status >/dev/null 2>&1 || service iscsid force-start \
- || return 1
-
- "${VDSMD_INIT_COMMON}" --pre-start || return 1
-
- unified_network_persistence_upgrade || return 1
- restore_nets || return 1
- upgrade_300_nets || return 1
-
-
- echo $"Starting up vdsm daemon: "
- DAEMON_COREFILE_LIMIT=unlimited NICELEVEL="${NICE_LOWEST}" daemon \
- --user=vdsm "@VDSMDIR@/daemonAdapter" -0 /dev/null -1 /dev/null \
- -2 /dev/null --syslog "@VDSMDIR@/respawn" --minlifetime 10 \
- --daemon --masterpid "${RESPAWNPIDFILE}" "${VDSM_BIN}" \
- --pidfile "${PIDFILE}" || return 1
- touch "${LOCK_FILE}"
- return 0
-}
-
-stop() {
- echo $"Shutting down vdsm daemon: "
- if killproc -p "$RESPAWNPIDFILE"; then
- log_success_msg $"$prog watchdog stop"
- fi
- if ! pidofproc -p "$PIDFILE" >/dev/null; then
- log_failure_msg "$prog: not running"
- RETVAL=0
- else
- killproc -p "$PIDFILE" -d @SERVICE_STOP_TIMEOUT@
- RETVAL=$?
- [ "$RETVAL" = 0 ] && "@RM_PATH@" -f "$LOCK_FILE" > /dev/null 2>&1
- fi
- "${VDSMD_INIT_COMMON}" --post-stop
- return "$RETVAL"
-}
-
-lock_op() {
- {
- if ! flock -n 9; then
- log_failure_msg $"cannot ${1} ${prog}, operation is locked"
- false
- elif ( "${1}" 9<&- ); then
- log_success_msg $"${prog} ${1}"
- else
- log_failure_msg $"${prog} ${1}"
- false
- fi
- } 9<$0
-}
-
-case "$1" in
- start)
- lock_op start
- RETVAL=$?
- ;;
- stop)
- lock_op stop
- RETVAL=$?
- ;;
- status)
- pidofproc -p "$PIDFILE" "$VDSM_BIN" >/dev/null
- RETVAL=$?
- if [ "$RETVAL" -eq 0 ]; then
- echo "VDS daemon server is running"
- else
- printf "VDS daemon is not running"
- if pidofproc -p "$RESPAWNPIDFILE" >/dev/null; then
- echo ", and its watchdog is running"
- else
- echo
- fi
- fi
- ;;
- condrestart)
- pidofproc -p "$PIDFILE" "$VDSM_BIN" >/dev/null
- RETVAL=$?
- if [ "$RETVAL" -eq 0 ]; then
- "$0" stop && "$0" start;
- RETVAL=$?;
- fi;
- ;;
- try-restart)
- "$0" stop && "$0" start
- RETVAL=$?
- ;;
- restart|force-reload)
- "$0" stop
- "$0" start
- RETVAL=$?
- ;;
- reconfigure)
- # Jump over 'reconfigure'
- shift 1
- reconfigure "$@"
- RETVAL=$?
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart|force-reload|try-restart|condrestart}"
- RETVAL=2
-esac
-
-exit "$RETVAL"
diff --git a/init/upstart/Makefile.am b/init/upstart/Makefile.am
deleted file mode 100644
index e689fdf..0000000
--- a/init/upstart/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright 2013 IBM, Inc.
-#
-# 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; either version 2 of the License, or
-# (at your option) any later version.
-#
-# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Refer to the README and COPYING files for full details of the license
-#
-
-include $(top_srcdir)/build-aux/Makefile.subs
-
-nodist_noinst_DATA = \
- supervdsmd.upstart \
- vdsm-tmpfiles.upstart \
- vdsmd.upstart \
- $(NULL)
-
-CLEANFILES = \
- config.log \
- $(nodist_noinst_DATA) \
- $(NULL)
-
-EXTRA_DIST = \
- supervdsmd.upstart.in \
- vdsm-tmpfiles.upstart.in \
- vdsmd.upstart.in \
- $(NULL)
-
-all-local: \
- $(nodist_noinst_DATA) \
- $(NULL)
diff --git a/init/upstart/supervdsmd.upstart.in b/init/upstart/supervdsmd.upstart.in
deleted file mode 100644
index bc55702..0000000
--- a/init/upstart/supervdsmd.upstart.in
+++ /dev/null
@@ -1,20 +0,0 @@
-# supervdsmd - Auxiliary vdsm service for running helper functions as root
-#
-
-description "Auxiliary vdsm service for running helper functions as root"
-
-start on runlevel [2345] and started libvirt-bin
-stop on runlevel [!2345]
-chdir "@VDSMDIR@"
-console log
-respawn
-
-# All commands called inside this script section except the daemon itself
-# should not fork, otherwise Upstart traces the wrong pid.
-# ".", "[", "&&" are built-in command or key-word, no fork.
-# bash exec does not fork, just execve the target binary.
-# So no "expect" stanza is needed.
-script
- [ -f "/etc/default/supervdsmd" ] && . "/etc/default/supervdsmd"
- exec "@VDSMDIR@/daemonAdapter" "@VDSMDIR@/supervdsmServer" --sockfile "@VDSMRUNDIR(a)/svdsm.sock"
-end script
diff --git a/init/upstart/vdsm-tmpfiles.upstart.in b/init/upstart/vdsm-tmpfiles.upstart.in
deleted file mode 100644
index a0b6b73..0000000
--- a/init/upstart/vdsm-tmpfiles.upstart.in
+++ /dev/null
@@ -1,24 +0,0 @@
-# vdsm-tmpfiles - Automatically create tempfiles under /var/run for vdsm
-#
-
-description "Automatically create tempfiles under /var/run for vdsm"
-
-start on startup
-console log
-
-task
-
-script
-while read fileType filePath fileMode fileUser fileGroup ; do
- if [ ! -e "$filePath" ]; then
- if [ "$fileType" = "d" ]; then
- @MKDIR_P@ "$filePath"
- else
- echo "Type $fileType handling is not implemented"
- exit 1
- fi
- fi
- "@CHOWN_PATH@" $fileUser:$fileGroup "$filePath"
- "@CHMOD_PATH@" $fileMode "$filePath"
-done < "@CONFDIR(a)/vdsm-tmpfiles.conf"
-end script
diff --git a/init/upstart/vdsmd.upstart.in b/init/upstart/vdsmd.upstart.in
deleted file mode 100644
index 1eab48b..0000000
--- a/init/upstart/vdsmd.upstart.in
+++ /dev/null
@@ -1,39 +0,0 @@
-# vdsmd - Virtual Desktop Server Manager
-#
-
-description "Virtual Desktop Server Manager"
-
-start on runlevel [2345] and started networking and started portmap and started libvirt-bin and started supervdsmd
-stop on runlevel [!2345]
-kill timeout @SERVICE_STOP_TIMEOUT@
-chdir "@VDSMDIR@"
-console log
-nice -20
-respawn
-
-pre-start script
- "@BINDIR@/vdsm-tool" load-needed-modules
- service wdmd restart
- for srv in networking ntp open-iscsi multipath-tools wdmd sanlock portmap libvirt-bin supervdsmd; do
- if status "${srv}" >/dev/null 2>&1; then
- # When srv is Upstart service, status srv always returns 0
- start "${srv}" || true
- status "${srv}" | grep -q start/running
- else
- service "${srv}" status >/dev/null 2>&1 || service "${srv}" start
- fi
- done
- "@LIBEXECDIR(a)/vdsmd_init_common.sh" --pre-start
-end script
-
-# All commands called inside this script section except the daemon itself
-# should not fork, otherwise Upstart traces the wrong pid.
-# ".", "[", "&&" are built-in command or key-word, no fork.
-# bash exec does not fork, just execve the target binary.
-# So no "expect" stanza is needed.
-script
- [ -f "/etc/default/vdsmd" ] && . "/etc/default/vdsmd"
- exec start-stop-daemon --chuid @VDSMUSER@:@VDSMGROUP@ --start --exec "@VDSMDIR@/daemonAdapter" -- -0 /dev/null -1 /dev/null -2 /dev/null "@VDSMDIR@/vdsm"
-end script
-
-post-stop exec "@LIBEXECDIR(a)/vdsmd_init_common.sh" --post-stop
--
To view, visit https://gerrit.ovirt.org/40726
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9af14b3d78badc5250042508d25f294dc514a2d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
8 years, 2 months
Change in vdsm[master]: supervdsm: Add zombiereaper to supervdsm
by dkuznets@redhat.com
Hello Dan Kenigsberg,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/39780
to review the following change.
Change subject: supervdsm: Add zombiereaper to supervdsm
......................................................................
supervdsm: Add zombiereaper to supervdsm
Supervdsm uses multiprocessing.Process to impersonate other users and
check access. To avoid waiting on the subprocesses, we add all
subprocesses that were not waited upon to zombiereaper.
Change-Id: I938a1f2bc70fceab2c69bc8b3d8c0724a9da7720
Bug-url: https://bugzilla.redhat.com/show_bug.cgi?id=841486
Signed-off-by: Dima Kuznetsov <dkuznets(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/28915
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
Signed-off-by: Dima Kuznetsov <dkuznets(a)redhat.com>
---
M vdsm/supervdsmServer
1 file changed, 27 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/80/39780/1
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index 3cdbf71..b8b6ff7 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -32,6 +32,7 @@
import logging
import logging.config
from vdsm.infra import sigutils
+from vdsm.infra import zombiereaper
import numaUtils
@@ -236,23 +237,34 @@
proc = Process(target=child, args=(hisPipe,))
proc.start()
- if not pipe.poll(RUN_AS_TIMEOUT):
- try:
- os.kill(proc.pid, signal.SIGKILL)
- except OSError as e:
- # If it didn't fail because process is already dead
- if e.errno != errno.ESRCH:
- raise
+ needReaping = True
+ try:
+ if not pipe.poll(RUN_AS_TIMEOUT):
+ try:
- raise Timeout()
+ os.kill(proc.pid, signal.SIGKILL)
+ except OSError as e:
+ # Don't add to zombiereaper of PID no longer exists
+ if e.errno == errno.ESRCH:
+ needReaping = False
+ else:
+ raise
- res, err = pipe.recv()
- pipe.send("Bye")
- proc.terminate()
- if err is not None:
- raise err
+ raise Timeout()
- return res
+ res, err = pipe.recv()
+ pipe.send("Bye")
+ proc.terminate()
+
+ if err is not None:
+ raise err
+
+ return res
+
+ finally:
+ # Add to zombiereaper if process has not been waited upon
+ if proc.exitcode is None and needReaping:
+ zombiereaper.autoReapPID(proc.pid)
@logDecorator
def validateAccess(self, user, groups, *args, **kwargs):
@@ -465,6 +477,7 @@
if not config.getboolean('vars', 'core_dump_enable'):
resource.setrlimit(resource.RLIMIT_CORE, (0, 0))
sigutils.register()
+ zombiereaper.registerSignalHandler()
def bind(func):
def wrapper(_SuperVdsm, *args, **kwargs):
--
To view, visit https://gerrit.ovirt.org/39780
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I938a1f2bc70fceab2c69bc8b3d8c0724a9da7720
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <dkuznets(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
8 years, 2 months
Change in vdsm[master]: tool: Remove upstart handling in libvirt configurator
by dkuznets@redhat.com
Dima Kuznetsov has uploaded a new change for review.
Change subject: tool: Remove upstart handling in libvirt configurator
......................................................................
tool: Remove upstart handling in libvirt configurator
libvirt configurator used to check if upstart is available and configure
libvirtd using initctl.
Since systemd is now the system manager on Debian Jessie, RHEL7 and
Ubuntu Vivid, we no longer have to support sysvinit/upstart.
Change-Id: Ic71430103cb04a5636b4b41371852cbf68495db7
Signed-off-by: Dima Kuznetsov <dkuznets(a)redhat.com>
---
M lib/vdsm/tool/configurators/libvirt.py
1 file changed, 0 insertions(+), 61 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/40420/1
diff --git a/lib/vdsm/tool/configurators/libvirt.py b/lib/vdsm/tool/configurators/libvirt.py
index e182231..5b14cea 100644
--- a/lib/vdsm/tool/configurators/libvirt.py
+++ b/lib/vdsm/tool/configurators/libvirt.py
@@ -17,11 +17,8 @@
# Refer to the README and COPYING files for full details of the license
#
import errno
-import filecmp
import os
import uuid
-import rpm
-import shutil
import sys
from vdsm.config import config
@@ -39,7 +36,6 @@
ConfigFile,
ParserWrapper,
)
-from .. import service
from .. validate_ovirt_certs import validate_ovirt_certs
from ... import utils
from ... import constants
@@ -58,8 +54,6 @@
def configure():
- _sysvToUpstart()
-
if utils.isOvirtNode():
if not os.path.exists(constants.P_VDSM_CERT):
raise InvalidRun(
@@ -117,61 +111,6 @@
cfile['path'] for cfile in FILES.values()
if cfile['persisted']
]
-
-
-def _sysvToUpstart():
- """
- On RHEL 6, libvirtd can be started by either SysV init or Upstart.
- We prefer upstart because it respawns libvirtd if libvirtd
- crashed.
- """
- def iterateLibvirtFiles():
- ts = rpm.TransactionSet()
- for name in ['libvirt', 'libvirt-daemon']:
- for matches in ts.dbMatch('name', name):
- for filename in matches[rpm.RPMTAG_FILENAMES]:
- yield filename
-
- def reloadConfiguration():
- rc, out, err = utils.execCmd((INITCTL,
- "reload-configuration"))
- if rc != 0:
- sys.stdout.write(out)
- sys.stderr.write(err)
- raise InvalidRun(
- "Failed to reload upstart configuration.")
-
- INITCTL = '/sbin/initctl'
- LIBVIRTD_UPSTART = 'libvirtd.upstart'
- TARGET = os.path.join(constants.SYSCONF_PATH, "init/libvirtd.conf")
-
- if os.path.isfile(INITCTL) and os.access(INITCTL, os.X_OK):
- # libvirtd package does not provide libvirtd.upstart,
- # this could happen in Ubuntu or other distro,
- # so continue to use system default init mechanism
- packaged = ''
- for fname in iterateLibvirtFiles():
- if os.path.basename(fname) == LIBVIRTD_UPSTART:
- packaged = fname
- break
-
- if os.path.isfile(packaged):
- if not os.path.isfile(TARGET):
- service.service_stop('libvirtd')
- if (not os.path.isfile(TARGET) or
- not filecmp.cmp(packaged, TARGET)):
- oldmod = None
- if os.path.isfile(TARGET):
- oldmod = os.stat(TARGET).st_mode
-
- utils.unpersist(TARGET)
- shutil.copyfile(packaged, TARGET)
- utils.persist(TARGET)
-
- if (oldmod is not None and
- oldmod != os.stat(TARGET).st_mode):
- os.chmod(TARGET, oldmod)
- reloadConfiguration()
def _isSslConflict():
--
To view, visit https://gerrit.ovirt.org/40420
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic71430103cb04a5636b4b41371852cbf68495db7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <dkuznets(a)redhat.com>
8 years, 2 months
Change in vdsm[master]: spec: Drop el6 support
by dkuznets@redhat.com
Dima Kuznetsov has uploaded a new change for review.
Change subject: spec: Drop el6 support
......................................................................
spec: Drop el6 support
Since we no longer need to package for el6, we can significantly reduce
the size of our spec file. This patch removes all the conditionals
dealing with el6, and drops all of the code dealing with sysvinit
as systemd is now available in both el7 and the supported fedoras.
Change-Id: I52bf73f539d9036fbc3468b4faf8a8d6556c9560
Signed-off-by: Dima Kuznetsov <dkuznets(a)redhat.com>
---
D init/sysvinit/Makefile.am
D init/sysvinit/respawn
D init/sysvinit/supervdsmd.init.in
D init/sysvinit/vdsmd.init.in
D init/upstart/Makefile.am
D init/upstart/supervdsmd.upstart.in
D init/upstart/vdsm-tmpfiles.upstart.in
D init/upstart/vdsmd.upstart.in
M vdsm.spec.in
9 files changed, 4 insertions(+), 862 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/40419/1
diff --git a/init/sysvinit/Makefile.am b/init/sysvinit/Makefile.am
deleted file mode 100644
index 7beba50..0000000
--- a/init/sysvinit/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Copyright 2008-2012 Red Hat, Inc.
-#
-# 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; either version 2 of the License, or
-# (at your option) any later version.
-#
-# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Refer to the README and COPYING files for full details of the license
-#
-
-include $(top_srcdir)/build-aux/Makefile.subs
-
-nodist_noinst_DATA = \
- supervdsmd.init \
- vdsmd.init \
- $(NULL)
-
-dist_vdsm_SCRIPTS = \
- respawn \
- $(NULL)
-
-CLEANFILES = \
- config.log \
- $(nodist_noinst_DATA) \
- $(NULL)
-
-EXTRA_DIST = \
- supervdsmd.init.in \
- vdsmd.init.in \
- $(NULL)
-
-all-local: \
- $(nodist_noinst_DATA) \
- $(NULL)
diff --git a/init/sysvinit/respawn b/init/sysvinit/respawn
deleted file mode 100755
index d13effc..0000000
--- a/init/sysvinit/respawn
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/bin/bash -e
-
-# Copyright 2010 Red Hat, Inc. and/or its affiliates.
-# Released under GPL v2
-#
-# Author: Dan Kenigsberg <danken(a)redhat.com>
-#
-# Please contact me if something similar, but more standard, is available.
-
-MINLIFETIME=2
-MAX_THRASH_INTERVAL=30
-POST_FAIL_INTERVAL=900
-
-usage() {
- echo usage:
- echo "$0 [options] <slave> [args]"
- echo " --masterpid pidfile"
- echo " --slavepid pidfile"
- echo " --daemon"
- echo " --minlifetime seconds"
- echo " --thrash seconds"
- echo
- echo "make <slave> run, and respawn it on exit"
- exit 1
-}
-
-while [ "$1" != "${1##-}" ];
-do
- case "$1" in
- --minlifetime)
- MINLIFETIME="$2"
- shift 2
- ;;
- --thrash)
- MAX_THRASH_INTERVAL="$2"
- shift 2
- ;;
- --masterpid)
- masterpidfile="$2"
- shift 2
- ;;
- --slavepid)
- slavepidfile="$2"
- shift 2
- ;;
- --daemon)
- daemonize=1
- shift
- ;;
- --)
- shift
- break
- ;;
- *) usage
- ;;
- esac
-done
-
-if [ -z "$*" ];
-then
- usage
-fi
-
-loop() {
- local d0 d1
- local thrash_start
-
- # must use BASHPID since $$ is not updated by &
- [ ! -z "$masterpidfile" ] && echo $BASHPID > "$masterpidfile"
- d0=`date +%s`
- while true
- do
- "$@" &
- [ ! -z "$slavepidfile" ] && echo $! > "$slavepidfile"
- wait $! || :
- d1=`date +%s`
- if [ $[d1-d0] -lt "$MINLIFETIME" ];
- then
- if [[ -n "$thrash_start" ]] && \
- [[ $[d1-thrash_start] -gt "$MAX_THRASH_INTERVAL" ]]; then
- logger -t respawn -- "slave '$*' died too quickly for more than $MAX_THRASH_INTERVAL seconds, master sleeping for $POST_FAIL_INTERVAL seconds"
- thrash_start=
- sleep "$POST_FAIL_INTERVAL"
- else
- logger -t respawn -- "slave '$*' died too quickly, respawning slave"
- [[ -z "$thrash_start" ]] && thrash_start=$d1
- fi
- else
- logger -t respawn -- "slave '$*' died, respawning slave"
- thrash_start=
- fi
- d0=$d1
- done
-}
-
-if [ -z "$daemonize" ];
-then
- loop "$@"
-else
- loop "$@" >/dev/null 2>/dev/null &
-fi
diff --git a/init/sysvinit/supervdsmd.init.in b/init/sysvinit/supervdsmd.init.in
deleted file mode 100755
index f3369c2..0000000
--- a/init/sysvinit/supervdsmd.init.in
+++ /dev/null
@@ -1,116 +0,0 @@
-#! /bin/sh
-#
-# Copyright 2006-2013 Red Hat, Inc. and/or its affiliates.
-#
-# Licensed to you under the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version. See the files README and
-# LICENSE_GPL_v2 which accompany this distribution.
-#
-
-# chkconfig: 2345 99 00
-#
-### BEGIN INIT INFO
-# Provides: supervdsmd
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Description: init script for the Super VDS management server
-# Short-Description: init script for the Super VDS management server
-### END INIT INFO
-
-SUPERVDSM_BIN=@VDSMDIR@/supervdsmServer
-PIDFILE=@VDSMRUNDIR(a)/supervdsmd.pid
-RESPAWNPIDFILE=@VDSMRUNDIR(a)/supervdsm_respawn.pid
-SOCKFILE=@VDSMRUNDIR(a)/svdsm.sock
-prog=supervdsm
-
-[ -f /etc/sysconfig/supervdsmd ] && . /etc/sysconfig/supervdsmd
-. /etc/init.d/functions
-
-log_failure_msg() { echo -n "$@"; failure "$@"; echo; }
-log_success_msg() { echo -n "$@"; success "$@"; echo; }
-
-RETVAL=0
-
-start(){
- test_already_running && return 0
-
- DAEMON_COREFILE_LIMIT=unlimited daemon \
- "@VDSMDIR@/daemonAdapter" -0 /dev/null -1 /dev/null -2 /dev/null \
- "@VDSMDIR@/respawn" --minlifetime 10 --daemon \
- --masterpid "${RESPAWNPIDFILE}" "${SUPERVDSM_BIN}" \
- --sockfile "${SOCKFILE}" --pidfile "${PIDFILE}"
- RETVAL=$?
- [ "$RETVAL" -eq 0 ] && log_success_msg "$prog start" || log_failure_msg "$prog start"
-}
-
-test_already_running()
-{
- if pidofproc -p $RESPAWNPIDFILE >/dev/null || \
- pidofproc -p $PIDFILE $SUPERVDSM_BIN >/dev/null; then
- log_success_msg "$prog: already running"
- return 0
- fi
- return 1
-}
-
-stop(){
- echo "Shutting down supervdsm daemon: "
- if killproc -p "$RESPAWNPIDFILE"; then
- log_success_msg "$prog watchdog stop"
- fi
- if ! pidofproc -p "$PIDFILE" >/dev/null; then
- log_failure_msg "$prog: not running"
- RETVAL=0
- else
- killproc -p "$PIDFILE" -d 2
- RETVAL=$?
- [ "$RETVAL" -eq 0 ] && log_success_msg "$prog stop" || log_failure_msg "$prog stop"
- fi
- return "$RETVAL"
-}
-
-case "$1" in
- start)
- start
- RETVAL=$?
- ;;
- stop)
- stop
- RETVAL=$?
- ;;
- status)
- pidofproc -p "$PIDFILE" "$SUPERVDSM_BIN" >/dev/null
- RETVAL=$?
- if [ "$RETVAL" -eq 0 ]; then
- echo "Super VDSM daemon server is running"
- else
- echo -n "Super VDSM daemon is not running"
- if pidofproc -p "$RESPAWNPIDFILE" >/dev/null; then
- echo ", but its watchdog is"
- else
- echo
- fi
- fi
- ;;
- condrestart)
- pidofproc -p "$PIDFILE" "$SUPERVDSM_BIN" >/dev/null
- RETVAL=$?
- if [ "$RETVAL" -eq 0 ]; then
- $0 stop && $0 start;
- RETVAL=$?;
- fi;
- ;;
- try-restart|restart|force-reload)
- $0 stop && $0 start
- RETVAL=$?
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart|condrestart|force-reload|try-restart}"
- RETVAL=2
-esac
-
-exit "$RETVAL"
-
-
-
diff --git a/init/sysvinit/vdsmd.init.in b/init/sysvinit/vdsmd.init.in
deleted file mode 100755
index 6edd89f..0000000
--- a/init/sysvinit/vdsmd.init.in
+++ /dev/null
@@ -1,270 +0,0 @@
-#! /bin/sh
-#
-# Copyright 2006-2010 Red Hat, Inc. and/or its affiliates.
-#
-# Licensed to you under the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version. See the files README and
-# LICENSE_GPL_v2 which accompany this distribution.
-#
-
-# chkconfig: 2345 99 00
-#
-### BEGIN INIT INFO
-# Provides: vdsmd
-# Required-Start: $syslog $network
-# Should-Start: $time
-# Required-Stop: $syslog
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Description: init script for the VDS management server
-# Short-Description: init script for the VDS management server
-### END INIT INFO
-
-VDSM_BIN="@VDSMDIR@/vdsm"
-prog=vdsm
-PIDFILE=@VDSMRUNDIR(a)/vdsmd.pid
-RESPAWNPIDFILE=@VDSMRUNDIR(a)/respawn.pid
-NEEDED_SERVICES="multipathd rpcbind ntpd wdmd sanlock libvirtd supervdsmd"
-CONFLICTING_SERVICES="libvirt-guests ksmtuned"
-LOCK_FILE="/var/lock/subsys/vdsmd"
-VDSM_TOOL="@BINDIR@/vdsm-tool"
-NICE_LOWEST=-20
-VDSMD_INIT_COMMON="@LIBEXECDIR(a)/vdsmd_init_common.sh"
-RETVAL=0
-
-SYSTEMCTL_SKIP_REDIRECT=true
-
-[ -f /etc/sysconfig/vdsm ] && . /etc/sysconfig/vdsm
-. /etc/init.d/functions
-
-log_failure_msg() { printf "$@"; failure "$@"; echo; }
-log_success_msg() { printf "$@"; success "$@"; echo; }
-
-shutdown_conflicting_srv() {
- local srv
- local ret_val
- local conflicting_services="$1"
-
- for srv in ${conflicting_services}; do
- if initctl status "${srv}" >/dev/null 2>&1; then
- # When srv is Upstart service, status srv always returns 0
- initctl stop "${srv}" || : # stop fails when already down
- initctl status "${srv}" | grep -q stop/waiting
- elif [ -x "/etc/init.d/${srv}" ]; then
- if service "${srv}" status >/dev/null 2>&1; then
- service "${srv}" stop
- fi
- else
- true
- fi
- ret_val=$?
- if [ "${ret_val}" -ne 0 ]; then
- log_failure_msg "${prog}: Stop conflicting ${srv}"
- return "${ret_val}"
- fi
- done
- return 0
-}
-
-start_needed_srv() {
- local srv
- local ret_val
- local needed_services="$1"
-
- for srv in ${needed_services}; do
- if initctl status "${srv}" >/dev/null 2>&1; then
- # When srv is Upstart service, status srv always returns 0
- initctl start "${srv}" || : # start fails when already running
- initctl status "${srv}" | grep -q start/running
- else
- service "${srv}" status >/dev/null 2>&1 || service "${srv}" start
- fi
- ret_val=$?
- if [ "${ret_val}" -ne 0 ]; then
- log_failure_msg "${prog}: Start dependent ${srv}"
- return "${ret_val}"
- fi
- done
-}
-
-start_network() {
- # Check if there are unactivated VDSM devices
- local interfaces dev static_devs activated_devs
-
- pushd /etc/sysconfig/network-scripts/ > /dev/null
-
- # copied from /etc/init.d/network
- interfaces=$(ls ifcfg-* | \
- LC_ALL=C sed -e "$__sed_discard_ignored_files" \
- -e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \
- -e '{ s/^ifcfg-//g;s/[0-9]/ &/}' | \
- LC_ALL=C sort -k 1,1 -k 2n | \
- LC_ALL=C sed 's/ //')
-
- for dev in $interfaces; do
- ifcfg="ifcfg-$dev"
- grep -q '# Generated by VDSM version' "$ifcfg" || continue
- grep -q 'ONBOOT=yes' "$ifcfg" || continue
- static_devs="$static_devs $dev"
- done
- popd > /dev/null
-
- activated_devs="`service network status | tail -1`"
-
- for static_dev in $static_devs; do
- if [[ $activated_devs != *"$static_dev"* ]]; then
- service network start
- ret_val=$?
- if [ "${ret_val}" -ne 0 ]; then
- log_failure_msg "${prog}: Start dependent network"
- return "${ret_val}"
- fi
- break
- fi
- done
-}
-
-test_already_running()
-{
- if pidofproc -p "$RESPAWNPIDFILE" >/dev/null || \
- pidofproc -p "$PIDFILE" "$VDSM_BIN" >/dev/null; then
- log_success_msg "$prog: already running"
- return 0
- fi
- return 1
-}
-
-reconfigure() {
- if [ "${1}" = "force" ] || ! "$VDSM_TOOL" is-configured; then
- "$VDSM_TOOL" configure "--force"
- fi
-}
-
-restore_nets(){
- "$VDSM_TOOL" restore-nets
- return 0
-}
-
-unified_network_persistence_upgrade(){
- echo 'Upgrading to unified persistence if needed'
- "$VDSM_TOOL" ${UPGRADE_LOGGING_PARAMS} upgrade-unified-persistence
-}
-
-upgrade_300_nets(){
- echo 'Upgrading to v3.x networking if needed'
- "$VDSM_TOOL" ${UPGRADE_LOGGING_PARAMS} upgrade-3.0.0-networks
-}
-
-start() {
- test_already_running && return 0
-
- start_network || return 1
- shutdown_conflicting_srv "${CONFLICTING_SERVICES}" || return 1
- start_needed_srv "${NEEDED_SERVICES}" || return 1
-
- # "service iscsid start" may not start becasue we configure node.startup to
- # manual. See /etc/init.d/iscsid.
- service iscsid status >/dev/null 2>&1 || service iscsid force-start \
- || return 1
-
- "${VDSMD_INIT_COMMON}" --pre-start || return 1
-
- unified_network_persistence_upgrade || return 1
- restore_nets || return 1
- upgrade_300_nets || return 1
-
-
- echo $"Starting up vdsm daemon: "
- DAEMON_COREFILE_LIMIT=unlimited NICELEVEL="${NICE_LOWEST}" daemon \
- --user=vdsm "@VDSMDIR@/daemonAdapter" -0 /dev/null -1 /dev/null \
- -2 /dev/null --syslog "@VDSMDIR@/respawn" --minlifetime 10 \
- --daemon --masterpid "${RESPAWNPIDFILE}" "${VDSM_BIN}" \
- --pidfile "${PIDFILE}" || return 1
- touch "${LOCK_FILE}"
- return 0
-}
-
-stop() {
- echo $"Shutting down vdsm daemon: "
- if killproc -p "$RESPAWNPIDFILE"; then
- log_success_msg $"$prog watchdog stop"
- fi
- if ! pidofproc -p "$PIDFILE" >/dev/null; then
- log_failure_msg "$prog: not running"
- RETVAL=0
- else
- killproc -p "$PIDFILE" -d @SERVICE_STOP_TIMEOUT@
- RETVAL=$?
- [ "$RETVAL" = 0 ] && "@RM_PATH@" -f "$LOCK_FILE" > /dev/null 2>&1
- fi
- "${VDSMD_INIT_COMMON}" --post-stop
- return "$RETVAL"
-}
-
-lock_op() {
- {
- if ! flock -n 9; then
- log_failure_msg $"cannot ${1} ${prog}, operation is locked"
- false
- elif ( "${1}" 9<&- ); then
- log_success_msg $"${prog} ${1}"
- else
- log_failure_msg $"${prog} ${1}"
- false
- fi
- } 9<$0
-}
-
-case "$1" in
- start)
- lock_op start
- RETVAL=$?
- ;;
- stop)
- lock_op stop
- RETVAL=$?
- ;;
- status)
- pidofproc -p "$PIDFILE" "$VDSM_BIN" >/dev/null
- RETVAL=$?
- if [ "$RETVAL" -eq 0 ]; then
- echo "VDS daemon server is running"
- else
- printf "VDS daemon is not running"
- if pidofproc -p "$RESPAWNPIDFILE" >/dev/null; then
- echo ", and its watchdog is running"
- else
- echo
- fi
- fi
- ;;
- condrestart)
- pidofproc -p "$PIDFILE" "$VDSM_BIN" >/dev/null
- RETVAL=$?
- if [ "$RETVAL" -eq 0 ]; then
- "$0" stop && "$0" start;
- RETVAL=$?;
- fi;
- ;;
- try-restart)
- "$0" stop && "$0" start
- RETVAL=$?
- ;;
- restart|force-reload)
- "$0" stop
- "$0" start
- RETVAL=$?
- ;;
- reconfigure)
- # Jump over 'reconfigure'
- shift 1
- reconfigure "$@"
- RETVAL=$?
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart|force-reload|try-restart|condrestart}"
- RETVAL=2
-esac
-
-exit "$RETVAL"
diff --git a/init/upstart/Makefile.am b/init/upstart/Makefile.am
deleted file mode 100644
index e689fdf..0000000
--- a/init/upstart/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright 2013 IBM, Inc.
-#
-# 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; either version 2 of the License, or
-# (at your option) any later version.
-#
-# 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Refer to the README and COPYING files for full details of the license
-#
-
-include $(top_srcdir)/build-aux/Makefile.subs
-
-nodist_noinst_DATA = \
- supervdsmd.upstart \
- vdsm-tmpfiles.upstart \
- vdsmd.upstart \
- $(NULL)
-
-CLEANFILES = \
- config.log \
- $(nodist_noinst_DATA) \
- $(NULL)
-
-EXTRA_DIST = \
- supervdsmd.upstart.in \
- vdsm-tmpfiles.upstart.in \
- vdsmd.upstart.in \
- $(NULL)
-
-all-local: \
- $(nodist_noinst_DATA) \
- $(NULL)
diff --git a/init/upstart/supervdsmd.upstart.in b/init/upstart/supervdsmd.upstart.in
deleted file mode 100644
index bc55702..0000000
--- a/init/upstart/supervdsmd.upstart.in
+++ /dev/null
@@ -1,20 +0,0 @@
-# supervdsmd - Auxiliary vdsm service for running helper functions as root
-#
-
-description "Auxiliary vdsm service for running helper functions as root"
-
-start on runlevel [2345] and started libvirt-bin
-stop on runlevel [!2345]
-chdir "@VDSMDIR@"
-console log
-respawn
-
-# All commands called inside this script section except the daemon itself
-# should not fork, otherwise Upstart traces the wrong pid.
-# ".", "[", "&&" are built-in command or key-word, no fork.
-# bash exec does not fork, just execve the target binary.
-# So no "expect" stanza is needed.
-script
- [ -f "/etc/default/supervdsmd" ] && . "/etc/default/supervdsmd"
- exec "@VDSMDIR@/daemonAdapter" "@VDSMDIR@/supervdsmServer" --sockfile "@VDSMRUNDIR(a)/svdsm.sock"
-end script
diff --git a/init/upstart/vdsm-tmpfiles.upstart.in b/init/upstart/vdsm-tmpfiles.upstart.in
deleted file mode 100644
index a0b6b73..0000000
--- a/init/upstart/vdsm-tmpfiles.upstart.in
+++ /dev/null
@@ -1,24 +0,0 @@
-# vdsm-tmpfiles - Automatically create tempfiles under /var/run for vdsm
-#
-
-description "Automatically create tempfiles under /var/run for vdsm"
-
-start on startup
-console log
-
-task
-
-script
-while read fileType filePath fileMode fileUser fileGroup ; do
- if [ ! -e "$filePath" ]; then
- if [ "$fileType" = "d" ]; then
- @MKDIR_P@ "$filePath"
- else
- echo "Type $fileType handling is not implemented"
- exit 1
- fi
- fi
- "@CHOWN_PATH@" $fileUser:$fileGroup "$filePath"
- "@CHMOD_PATH@" $fileMode "$filePath"
-done < "@CONFDIR(a)/vdsm-tmpfiles.conf"
-end script
diff --git a/init/upstart/vdsmd.upstart.in b/init/upstart/vdsmd.upstart.in
deleted file mode 100644
index 1eab48b..0000000
--- a/init/upstart/vdsmd.upstart.in
+++ /dev/null
@@ -1,39 +0,0 @@
-# vdsmd - Virtual Desktop Server Manager
-#
-
-description "Virtual Desktop Server Manager"
-
-start on runlevel [2345] and started networking and started portmap and started libvirt-bin and started supervdsmd
-stop on runlevel [!2345]
-kill timeout @SERVICE_STOP_TIMEOUT@
-chdir "@VDSMDIR@"
-console log
-nice -20
-respawn
-
-pre-start script
- "@BINDIR@/vdsm-tool" load-needed-modules
- service wdmd restart
- for srv in networking ntp open-iscsi multipath-tools wdmd sanlock portmap libvirt-bin supervdsmd; do
- if status "${srv}" >/dev/null 2>&1; then
- # When srv is Upstart service, status srv always returns 0
- start "${srv}" || true
- status "${srv}" | grep -q start/running
- else
- service "${srv}" status >/dev/null 2>&1 || service "${srv}" start
- fi
- done
- "@LIBEXECDIR(a)/vdsmd_init_common.sh" --pre-start
-end script
-
-# All commands called inside this script section except the daemon itself
-# should not fork, otherwise Upstart traces the wrong pid.
-# ".", "[", "&&" are built-in command or key-word, no fork.
-# bash exec does not fork, just execve the target binary.
-# So no "expect" stanza is needed.
-script
- [ -f "/etc/default/vdsmd" ] && . "/etc/default/vdsmd"
- exec start-stop-daemon --chuid @VDSMUSER@:@VDSMGROUP@ --start --exec "@VDSMDIR@/daemonAdapter" -- -0 /dev/null -1 /dev/null -2 /dev/null "@VDSMDIR@/vdsm"
-end script
-
-post-stop exec "@LIBEXECDIR(a)/vdsmd_init_common.sh" --post-stop
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 76ed135..38eb2b4 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -54,21 +54,10 @@
%global with_vhostmd 1
%endif
-%if 0%{?fedora} || 0%{?rhel} >= 7
-%global with_systemd 1
-%endif
-
-%if 0%{?fedora} || 0%{?rhel} >= 7
%global with_chown_hack 1
-%endif
-%if 0%{?rhel} == 6
-%global _udevrulesdir /lib/udev/rules.d/
-%global _udevexecdir /lib/udev/
-%else
%global _udevrulesdir /usr/lib/udev/rules.d/
%global _udevexecdir /usr/lib/udev/
-%endif
Name: %{vdsm_name}
Version: @PACKAGE_VERSION@
@@ -83,11 +72,6 @@
%if !%{fedora_koji_build}
ExclusiveArch: x86_64 ppc64 ppc64le
-%endif
-
-%if 0%{?rhel} <= 6
-# qemu-img is x86_64 only on RHEL6
-ExclusiveArch: x86_64
%endif
BuildRequires: cyrus-sasl-lib
@@ -115,15 +99,7 @@
BuildRequires: python-pthreading
BuildRequires: qemu-img
BuildRequires: rpm-python
-%if 0%{?rhel} == 6
-BuildRequires: python-simplejson >= 2.0.9
-BuildRequires: policycoreutils-python > 2.0.83-19.47
-BuildRequires: python-argparse
-BuildRequires: python-ordereddict
-%endif
-%if 0%{?rhel} > 6 || 0%{?fedora}
BuildRequires: python-blivet
-%endif
# Autotools BuildRequires
%if 0%{?enable_autotools}
@@ -138,9 +114,7 @@
BuildRequires: python-pep8
%endif
-%if 0%{?with_systemd}
BuildRequires: systemd-units
-%endif
Requires: ethtool
Requires: which
@@ -185,15 +159,12 @@
%else # fedora
Requires: libguestfs-tools-c >= 1:1.26.7-2
%endif
-
-%if 0%{?rhel} >= 7 || 0%{?fedora}
Requires: libvirt-daemon-config-nwfilter
Requires: libvirt-daemon-driver-network
Requires: libvirt-daemon-driver-nwfilter
Requires: libvirt-daemon-driver-qemu
-%endif
-%if 0%{?rhel} >= 7
+%if 0%{?rhel}
%if 0%{?rhev_build}
Requires: libvirt-daemon >= 1.2.8-16.el7_1.2
Requires: libvirt-python >= 1.2.8-7.el7_1.1
@@ -202,11 +173,6 @@
Requires: libvirt-python
%endif # rhev_build
%endif # rhel 7
-
-%if 0%{?rhel} == 6
-Requires: libvirt >= 0.10.2-29.el6_5.4
-Requires: libvirt-python
-%endif
%if 0%{?fedora} >= 22
Requires: libvirt-daemon >= 1.2.14
@@ -222,11 +188,7 @@
# iscsi-intiator versions
%if 0%{?rhel}
-%if 0%{?rhel} >= 7
Requires: iscsi-initiator-utils
-%else
-Requires: iscsi-initiator-utils >= 6.2.0.872-15
-%endif # rhel 7
%else # fedora
Requires: iscsi-initiator-utils >= 6.2.0.873-21
%endif
@@ -234,7 +196,6 @@
Requires: sanlock >= 2.8, sanlock-python
%if 0%{?rhel}
-%if 0%{?rhel} >= 7
Requires: device-mapper-multipath >= 0.4.9-68
Requires: e2fsprogs
Requires: fence-agents-all
@@ -242,19 +203,6 @@
Requires: python
Requires: policycoreutils-python
Requires: selinux-policy-targeted >= 3.13.1-16.el7
-%else
-Requires: python
-Requires: device-mapper-multipath >= 0.4.9-75
-Requires: e2fsprogs >= 1.41.12-11
-Requires: fence-agents
-Requires: kernel >= 2.6.32-465
-Requires: initscripts >= 9.03.31-2.el6_3.1
-Requires: policycoreutils >= 2.0.83-19.30
-Requires: policycoreutils-python >= 2.0.83-19.47.el6_6.1
-Requires: selinux-policy-targeted >= 3.7.19-260.el6_6.2
-Requires: lvm2 >= 2.02.100-5
-Requires: logrotate < 3.8.0
-%endif
%else
Requires: fence-agents-all
Requires: kernel >= 3.11.3-201
@@ -279,13 +227,8 @@
%endif
%if 0%{?rhel}
-%if 0%{?rhel} >= 7
Requires: qemu-kvm%{?rhev_suffix} >= 10:1.5.3-60.el7
Requires: qemu-img%{?rhev_suffix} >= 10:1.5.3-60.el7
-%else
-Requires: qemu-kvm%{?rhev_suffix} >= 2:0.12.1.2-2.422
-Requires: qemu-img%{?rhev_suffix} >= 2:0.12.1.2-2.422
-%endif # rhel > = 7
%else
Requires: qemu-kvm >= 2:2.0.0-1
Requires: qemu-img >= 2:2.0.0-1
@@ -361,10 +304,6 @@
Requires: %{name}-python = %{version}-%{release}
Requires: %{name}-yajsonrpc = %{version}-%{release}
Obsoletes: vdsm-api < 4.16
-%if 0%{?rhel} == 6
-Requires: python-ordereddict
-Requires: python-simplejson >= 2.0.9
-%endif
%description jsonrpc
A Json-based RPC interface that serves as the protocol for libvdsm.
@@ -391,11 +330,7 @@
%package bootstrap
Summary: VDSM bootstrapping package
BuildArch: noarch
-%if 0%{?rhel} < 7
-Requires: python-ethtool >= 0.6-3
-%else
Requires: python-ethtool >= 0.8-1
-%endif
%description bootstrap
VDSM bootstrapping package. Used for delivering the bootstrap code onto the
@@ -730,9 +665,6 @@
%prep
%setup -q
-%if 0%{?rhel} == 6
-sed -i '/ su /d' vdsm/vdsm-logrotate.conf.in
-%endif
%build
%if 0%{?enable_autotools}
@@ -769,10 +701,6 @@
install -dDm 0755 %{buildroot}@VDSMLOGDIR@
touch %{buildroot}@VDSMLOGDIR(a)/{connectivity.log,mom.log,supervdsm.log,vdsm.log}
-# Install the respawn utility
-install -Dm 0755 init/sysvinit/respawn \
- %{buildroot}%{_datadir}/%{vdsm_name}/respawn
-
# Install the lvm rules
install -Dm 0644 vdsm/storage/vdsm-lvm.rules \
%{buildroot}%{_udevrulesdir}/12-vdsm-lvm.rules
@@ -780,7 +708,6 @@
install -Dm 0644 vdsm/limits.conf \
%{buildroot}/etc/security/limits.d/99-vdsm.conf
-%if 0%{?with_systemd}
install -Dm 0755 init/systemd/systemd-vdsmd %{buildroot}/usr/lib/systemd/systemd-vdsmd
install -Dm 0644 init/systemd/vdsmd.service %{buildroot}%{_unitdir}/vdsmd.service
install -Dm 0644 init/systemd/vdsm-network.service %{buildroot}%{_unitdir}/vdsm-network.service
@@ -792,18 +719,8 @@
%{buildroot}%{_unitdir}/vdsm-reg.service
install -Dm 0644 vdsm/vdsm-modules-load.d.conf \
%{buildroot}%{_sysconfdir}/modules-load.d/vdsm.conf
-%else
-# Install the SysV init scripts
-install -Dm 0755 init/sysvinit/vdsmd.init %{buildroot}%{_initrddir}/vdsmd
-install -Dm 0755 init/sysvinit/supervdsmd.init %{buildroot}%{_initrddir}/supervdsmd
-
-install -Dm 0755 vdsm_reg/vdsm-reg.init %{buildroot}%{_initrddir}/vdsm-reg
-%endif
-
-%if 0%{?with_systemd}
install -Dm 0644 init/systemd/vdsm-tmpfiles.d.conf \
%{buildroot}%{_tmpfilesdir}/%{vdsm_name}.conf
-%endif
%if 0%{?rhel}
# This is not commonplace, but we want /var/log/core to be a world-writable
@@ -812,19 +729,12 @@
%endif
# Install the polkit for libvirt
-%if 0%{?fedora} || 0%{?rhel} >= 7
install -Dm 0644 vdsm/vdsm-libvirt-access.rules \
%{buildroot}%{_polkitdir}/10-vdsm-libvirt-access.rules
-%else
-install -Dm 0644 vdsm/vdsm-libvirt-access.pkla \
- %{buildroot}%{_polkitdir}/10-vdsm-libvirt-access.pkla
-%endif
# Install the libvirt hook for cleaning up the XML
-%if 0%{?fedora} || 0%{?rhel} >= 7
install -Dm 0755 vdsm/virt/libvirt-hook.sh \
%{buildroot}%{_sysconfdir}/libvirt/hooks/qemu
-%endif
%check
%if 0%{?with_check}
@@ -879,13 +789,6 @@
fi
/sbin/restorecon -R /var/log/core >/dev/null 2>&1
# hack until we replace core dump with abrt
-
-%if ! 0%{?with_systemd}
-if [ "$1" -eq 1 ] ; then
- /sbin/chkconfig --add vdsmd
- /sbin/chkconfig --add supervdsmd
-fi
-%else
/bin/systemctl restart systemd-modules-load.service >/dev/null 2>&1 || :
if [ "$1" -eq 1 ] ; then
/bin/systemctl enable vdsmd.service >/dev/null 2>&1 || :
@@ -894,50 +797,15 @@
fi
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
exit 0
-%endif
%preun
if [ "$1" -eq 0 ]; then
%{_bindir}/vdsm-tool remove-config
fi
-%if ! 0%{?with_systemd}
-if [ "$1" -eq 0 ]
-then
- /sbin/service vdsmd stop > /dev/null 2>&1 || :
- /sbin/chkconfig --del vdsmd
- /sbin/service supervdsmd stop > /dev/null 2>&1 || :
- /sbin/chkconfig --del supervdsmd
-
- /bin/sed -i '/# VDSM section begin/,/# VDSM section end/d' \
- /etc/sysctl.conf
-
- %{_bindir}/vdsm-tool remove-saslpasswd
-
- if /sbin/initctl status libvirtd >/dev/null 2>/dev/null ; then
- /sbin/initctl stop libvirtd >/dev/null 2>/dev/null
- rm -f /etc/init/libvirtd.conf
-
- /sbin/chkconfig libvirtd on
- /sbin/service libvirtd start >/dev/null
- fi
-fi
-%else
-%if 0%{?with_systemd}
%systemd_preun vdsmd.service
%systemd_preun vdsm-network.service
%systemd_preun supervdsmd.service
-%else
-if [ "$1" -eq 0 ]; then
- /bin/systemctl --no-reload disable vdsmd.service > /dev/null 2>&1 || :
- /bin/systemctl --no-reload disable supervdsmd.service > /dev/null 2>&1 || :
- /bin/systemctl stop vdsmd.service > /dev/null 2>&1 || :
- /bin/systemctl stop vdsm-network.service > /dev/null 2>&1 || :
- /bin/systemctl stop supervdsmd.service > /dev/null 2>&1 || :
-fi
-exit 0
-%endif
-%endif
%postun
if [ "$1" -ge 1 ]; then
@@ -968,11 +836,9 @@
# fallback to vdsmd reconfigure api - This change may be removed
# when vdsm won't support any downgrade\upgrade to versions that
# don't include vdsm-tool configure api (vdsm <= 3.3)
- for f in '/usr/lib/systemd/systemd-vdsmd' '/etc/init.d/vdsmd'; do
- if [ -f "${f}" ]; then
- "${f}" reconfigure >/dev/null 2>&1 || :
- fi
- done
+ if [ -f "/usr/lib/systemd/systemd-vdsmd" ]; then
+ "/usr/lib/systemd/systemd-vdsmd" reconfigure >/dev/null 2>&1 || :
+ fi
fi
fi
@@ -985,69 +851,19 @@
fi
exit 0
-%if 0%{?rhel} == 6
-# In el6, We configure libvirt to use upstart without the libvirt.rpm's
-# awareness. Thus, we must stop/restart libvirt ourselves when the
-# libvirt.rpm is removed/upgraded.
-%triggerun -- libvirt
-if [ "$2" -eq "0" ]; then
- /sbin/initctl stop libvirtd > /dev/null 2>&1 || :
-fi
-
-%triggerpostun -- libvirt
-if [ "$2" -ge "1" ]; then
- /sbin/initctl restart libvirtd > /dev/null 2>&1 || :
-fi
-%endif
-
%post reg
-%if ! 0%{?with_systemd}
-if [ "$1" -eq 1 ] ; then
- /sbin/chkconfig --add vdsm-reg
-fi
-%else
-%if 0%{?with_systemd}
%systemd_post vdsm-reg.service
-%else
-if [ "$1" -eq 1 ] ; then
- /bin/systemctl enable vdsm-reg.service >/dev/null 2>&1 || :
- /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
-exit 0
-%endif
-%endif
%preun reg
-%if ! 0%{?with_systemd}
-if [ "$1" -eq 0 ]
-then
- /sbin/service vdsm-reg stop > /dev/null 2>&1 || :
- /sbin/chkconfig --del vdsm-reg
-fi
-%else
-%if 0%{?with_systemd}
%systemd_preun vdsm-reg.service
-%else
-if [ "$1" -eq 0 ]; then
- /bin/systemctl --no-reload disable vdsm-reg.service > /dev/null 2>&1 || :
- /bin/systemctl stop vdsm-reg.service > /dev/null 2>&1 || :
-fi
-exit 0
-%endif
-%endif
%files
%defattr(-, root, root, -)
%doc COPYING README lib/vdsm/vdsm.conf.sample
-%if 0%{?with_systemd}
/usr/lib/systemd/systemd-vdsmd
%{_unitdir}/vdsmd.service
%{_unitdir}/vdsm-network.service
%{_unitdir}/supervdsmd.service
-%else
-%{_initrddir}/vdsmd
-%{_initrddir}/supervdsmd
-%endif
%dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@
%ghost %config %attr(0644, %{vdsm_user}, %{vdsm_group}) @VDSMLOGDIR(a)/connectivity.log
@@ -1119,18 +935,12 @@
%config(noreplace) %{_sysconfdir}/%{vdsm_name}/logrotate/vdsm
%config(noreplace) %{_sysconfdir}/rwtab.d/vdsm
%config(noreplace) %{_sysconfdir}/sysctl.d/vdsm.conf
-%if 0%{?with_systemd}
%config(noreplace) %{_sysconfdir}/modules-load.d/vdsm.conf
-%endif
-%if 0%{?with_systemd}
%config(noreplace) %{_tmpfilesdir}/%{vdsm_name}.conf
-%endif
%{_sysconfdir}/dhcp/dhclient.d/sourceRoute.sh
%{_sysconfdir}/sudoers.d/50_vdsm
%{_sysconfdir}/cron.hourly/vdsm-logrotate
-%if 0%{?fedora} || 0%{?rhel} >= 7
%{_sysconfdir}/libvirt/hooks/qemu
-%endif
%{_datadir}/%{vdsm_name}/logUtils.py*
%{_datadir}/%{vdsm_name}/dsaversion.py*
%{_libexecdir}/%{vdsm_name}/curl-img-wrap
@@ -1289,11 +1099,7 @@
%if 0%{?rhel}
%dir %{_localstatedir}/log/core
%endif
-%if 0%{?fedora} || 0%{?rhel} >= 7
%{_polkitdir}/10-vdsm-libvirt-access.rules
-%else
-%{_polkitdir}/10-vdsm-libvirt-access.pkla
-%endif
%defattr(-, %{vdsm_user}, %{qemu_group}, -)
%dir %{_localstatedir}/lib/libvirt/qemu/channels
@@ -1362,11 +1168,7 @@
%{_datadir}/%{vdsm_name}/config.py*
%{_datadir}/%{vdsm_name}/netinfo.py*
%endif
-%if 0%{?with_systemd}
%exclude %{python_sitelib}/%{vdsm_name}/tool/load_needed_modules.py*
-%else
-%{python_sitelib}/%{vdsm_name}/tool/load_needed_modules.py*
-%endif
%{python_sitelib}/%{vdsm_name}/tool/configfile.py*
%{python_sitelib}/%{vdsm_name}/tool/dummybr.py*
%{python_sitelib}/%{vdsm_name}/tool/dump_bonding_defaults.py*
@@ -1675,12 +1477,8 @@
%config(noreplace) %{_sysconfdir}/%{vdsm_reg}/logger.conf
%ghost %dir /data
%ghost %dir %attr(0775, root, root) /data/updates
-%if 0%{?with_systemd}
/usr/lib/systemd/systemd-vdsm-reg
%{_unitdir}/vdsm-reg.service
-%else
-%{_initrddir}/vdsm-reg
-%endif
%{_datadir}/%{vdsm_reg}/vdsm-reg-setup
%{_datadir}/%{vdsm_reg}/vdsm-complete
%{_datadir}/%{vdsm_reg}/vdsm-gen-cert
--
To view, visit https://gerrit.ovirt.org/40419
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I52bf73f539d9036fbc3468b4faf8a8d6556c9560
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <dkuznets(a)redhat.com>
8 years, 2 months
Change in vdsm[master]: xmlrpc: Improve logging during shutdown
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: xmlrpc: Improve logging during shutdown
......................................................................
xmlrpc: Improve logging during shutdown
We did not have proper logging when stopping the server, making it hard
to debug. Starting and stopping subsystems should have info level log
messages in the caller thread and in the server thread.
Change-Id: I7cc269213fe89d5033eae173c033970042fc2bce
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/rpc/bindingxmlrpc.py
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/43194/1
diff --git a/vdsm/rpc/bindingxmlrpc.py b/vdsm/rpc/bindingxmlrpc.py
index e81315a..05110c4 100644
--- a/vdsm/rpc/bindingxmlrpc.py
+++ b/vdsm/rpc/bindingxmlrpc.py
@@ -59,6 +59,7 @@
"""
@utils.traceback(on=self.log.name)
def threaded_start():
+ self.log.info("XMLRPC server running")
self._registerFunctions()
self.server.timeout = 1
self._enabled = True
@@ -70,6 +71,8 @@
if e[0] != EINTR:
self.log.error("xml-rpc handler exception",
exc_info=True)
+ self.log.info("XMLRPC server stopped")
+
self._thread = threading.Thread(target=threaded_start,
name='BindingXMLRPC')
self._thread.daemon = True
@@ -79,6 +82,7 @@
self.server.add(connected_socket, socket_address)
def stop(self):
+ self.log.info("Stopping XMLRPC server")
self._enabled = False
self.server.server_close()
self._thread.join()
--
To view, visit https://gerrit.ovirt.org/43194
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7cc269213fe89d5033eae173c033970042fc2bce
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
8 years, 2 months
Change in vdsm[master]: fc-scan: Replace timing code with utils.stopwatch
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: fc-scan: Replace timing code with utils.stopwatch
......................................................................
fc-scan: Replace timing code with utils.stopwatch
Replace explicit timing code and monotonic_time re-implementation with
new stopwatch contextmanager.
Change-Id: I47d99a21282f605492e4edfef5573efd7ce3779f
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/storage/fc-scan
1 file changed, 8 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/42567/1
diff --git a/vdsm/storage/fc-scan b/vdsm/storage/fc-scan
index 344345d..fe107e8 100755
--- a/vdsm/storage/fc-scan
+++ b/vdsm/storage/fc-scan
@@ -40,6 +40,8 @@
import sys
import threading
+from vdsm import utils
+
log = logging.getLogger("fc-scan")
@@ -62,15 +64,13 @@
try:
path = "/sys/class/scsi_host/%s/scan" % self.host
log.debug("Scanning %s", path)
- start = monotonic_time()
- fd = os.open(path, os.O_WRONLY)
- try:
- os.write(fd, "- - -")
- finally:
- os.close(fd)
+ with utils.stopwatch("Scanned %s" % path, log=log):
+ fd = os.open(path, os.O_WRONLY)
+ try:
+ os.write(fd, "- - -")
+ finally:
+ os.close(fd)
self.succeeded = True
- elapsed = monotonic_time() - start
- log.debug("Scanned %s in %.2f seconds", path, elapsed)
except OSError as e:
log.error("Scanning %s failed: %s", path, e)
except Exception:
@@ -105,10 +105,6 @@
if not all(s.succeeded for s in scans):
return 1
-
-
-def monotonic_time():
- return os.times()[4]
if __name__ == '__main__':
--
To view, visit https://gerrit.ovirt.org/42567
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I47d99a21282f605492e4edfef5573efd7ce3779f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
8 years, 2 months
Change in vdsm[master]: utils: Add stopwatch for timing operations
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: utils: Add stopwatch for timing operations
......................................................................
utils: Add stopwatch for timing operations
stopwatch is a context manager that make it easy to time block of code:
with stopwatch("foo.bar"):
foo.bar("baz")
Will log debug message:
foo.bar: 0.123 seconds
The log can be disabled by disabling the vds.stopwatch logger.
Change-Id: Ie0a60538936dbb4596243abe9d731779fd9efb47
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/29685/1
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 2ba5762..1ae5cc7 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -26,6 +26,7 @@
Contains a reverse dictionary pointing from error string to its error code.
"""
+from contextlib import contextmanager
from collections import namedtuple, deque
from fnmatch import fnmatch
from StringIO import StringIO
@@ -669,6 +670,16 @@
return decorator
+@contextmanager
+def stopwatch(message, log=logging.getLogger('vds.stopwatch')):
+ start = time.time()
+ try:
+ yield
+ finally:
+ elapsed = time.time() - start
+ log.debug("%s: %.3f seconds", message, elapsed)
+
+
def tobool(s):
try:
if s is None:
--
To view, visit http://gerrit.ovirt.org/29685
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie0a60538936dbb4596243abe9d731779fd9efb47
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
8 years, 2 months