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, 11 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, 11 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, 11 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, 11 months
Change in vdsm[master]: sampling: hoststats: switch to SampleWindow
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: sampling: hoststats: switch to SampleWindow
......................................................................
sampling: hoststats: switch to SampleWindow
HostStatsThread has its own sampling storage code,
remniscent of VmStatsThread before the switch
of SampleWindow.
The requirements and the use cases are already almost
completely covered by SampleWindow, so this patch
ports HostStatsThread to it, to reduce duplication.
Change-Id: I5ec5712ee1fb69ed3d8dbc28ca4e6511998270c9
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/sampling.py
1 file changed, 4 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/40428/1
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index d59ce2c..cbe53ef 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -555,7 +555,6 @@
"""
A thread that periodically samples host statistics.
"""
- AVERAGING_WINDOW = 5
_CONNLOG = logging.getLogger('connectivity')
def __init__(self, log):
@@ -565,7 +564,7 @@
self.daemon = True
self._log = log
self._stopEvent = threading.Event()
- self._samples = []
+ self._samples = SampleWindow(size=5)
self._pid = os.getpid()
self._ncpus = max(os.sysconf('SC_NPROCESSORS_ONLN'), 1)
@@ -584,15 +583,13 @@
try:
sample = HostSample(self._pid)
self._samples.append(sample)
- if len(self._samples) == 1:
+ prev, last = self._samples.last_pair()
+ if prev is None:
self._CONNLOG.debug('%s', sample.to_connlog())
else:
- diff = sample.connlog_diff(self._samples[-2])
+ diff = sample.connlog_diff(prev)
if diff:
self._CONNLOG.debug('%s', diff)
-
- if len(self._samples) > self.AVERAGING_WINDOW:
- self._samples.pop(0)
except TimeoutError:
self._log.exception("Timeout while sampling stats")
self._stopEvent.wait(self._sampleInterval)
--
To view, visit https://gerrit.ovirt.org/40428
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ec5712ee1fb69ed3d8dbc28ca4e6511998270c9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: virt: devices: move device creation in a submodule
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: devices: move device creation in a submodule
......................................................................
virt: devices: move device creation in a submodule
In the Vm class, the vm devices are arranged in a
tree-like structure.
This patch moves the related code into a new
hwtree module into the vmdevices subpackages.
Change-Id: If17cce15f653843848eea42b567a0e4454757cd1
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M debian/vdsm.install
M vdsm.spec.in
M vdsm/virt/vm.py
M vdsm/virt/vmdevices/Makefile.am
A vdsm/virt/vmdevices/hwtree.py
5 files changed, 63 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/77/38077/1
diff --git a/debian/vdsm.install b/debian/vdsm.install
index cd71517..38bc299 100644
--- a/debian/vdsm.install
+++ b/debian/vdsm.install
@@ -162,6 +162,7 @@
./usr/share/vdsm/virt/vmdevices/core.py
./usr/share/vdsm/virt/vmdevices/graphics.py
./usr/share/vdsm/virt/vmdevices/hwclass.py
+./usr/share/vdsm/virt/vmdevices/hwtree.py
./usr/share/vdsm/virt/vmdevices/network.py
./usr/share/vdsm/virt/vmdevices/storage.py
./var/lib/polkit-1/localauthority/10-vendor.d/10-vdsm-libvirt-access.pkla
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 0740530..824dd31 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1073,6 +1073,7 @@
%{_datadir}/%{vdsm_name}/virt/vmdevices/core.py*
%{_datadir}/%{vdsm_name}/virt/vmdevices/graphics.py*
%{_datadir}/%{vdsm_name}/virt/vmdevices/hwclass.py*
+%{_datadir}/%{vdsm_name}/virt/vmdevices/hwtree.py*
%{_datadir}/%{vdsm_name}/virt/vmdevices/network.py*
%{_datadir}/%{vdsm_name}/virt/vmdevices/storage.py*
%{_datadir}/%{vdsm_name}/tool
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index c9ba79b..19be5f2 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -63,6 +63,7 @@
from . import vmexitreason
from . import vmstatus
from .vmdevices import hwclass
+from .vmdevices import hwtree
from .vmtune import update_io_tune_dom, collect_inner_elements
from .vmtune import io_tune_values_to_dom, io_tune_dom_to_values
from . import vmxml
@@ -767,23 +768,6 @@
log = logging.getLogger("vm.Vm")
# limit threads number until the libvirt lock will be fixed
_ongoingCreations = threading.BoundedSemaphore(4)
- DeviceMapping = ((hwclass.DISK, vmdevices.storage.Drive),
- (hwclass.NIC, vmdevices.network.Interface),
- (hwclass.SOUND, vmdevices.core.Sound),
- (hwclass.VIDEO, vmdevices.core.Video),
- (hwclass.GRAPHICS, vmdevices.graphics.Graphics),
- (hwclass.CONTROLLER, vmdevices.core.Controller),
- (hwclass.GENERAL, vmdevices.core.Generic),
- (hwclass.BALLOON, vmdevices.core.Balloon),
- (hwclass.WATCHDOG, vmdevices.core.Watchdog),
- (hwclass.CONSOLE, vmdevices.core.Console),
- (hwclass.REDIR, vmdevices.core.Redir),
- (hwclass.RNG, vmdevices.core.Rng),
- (hwclass.SMARTCARD, vmdevices.core.Smartcard),
- (hwclass.TPM, vmdevices.core.Tpm))
-
- def _makeDeviceDict(self):
- return dict((dev, []) for dev, _ in self.DeviceMapping)
def _makeChannelPath(self, deviceName):
return constants.P_LIBVIRT_VMCHANNELS + self.id + '.' + deviceName
@@ -852,7 +836,7 @@
self.stopDisksStatsCollection()
self._vmCreationEvent = threading.Event()
self._pathsPreparedEvent = threading.Event()
- self._devices = self._makeDeviceDict()
+ self._devices = hwtree.empty()
self._connection = libvirtconnection.get(cif)
if 'vmName' not in self.conf:
@@ -968,7 +952,7 @@
Return the "devices" section of this Vm's conf.
If missing, create it according to old API.
"""
- devices = self._makeDeviceDict()
+ devices = hwtree.empty()
# For BC we need to save previous behaviour for old type parameters.
# The new/old type parameter will be distinguished
@@ -2189,10 +2173,7 @@
# rebooting it. Evident on, but not limited to, the HE case.
self._fixLegacyConf()
- for devType, devClass in self.DeviceMapping:
- for dev in devices[devType]:
- self._devices[devType].append(devClass(self.conf, self.log,
- **dev))
+ self._devices = hwtree.build(devices, self.conf, self.log)
# We should set this event as a last part of drives initialization
self._pathsPreparedEvent.set()
diff --git a/vdsm/virt/vmdevices/Makefile.am b/vdsm/virt/vmdevices/Makefile.am
index 71b0573..3678ccd 100644
--- a/vdsm/virt/vmdevices/Makefile.am
+++ b/vdsm/virt/vmdevices/Makefile.am
@@ -24,6 +24,7 @@
core.py \
graphics.py \
hwclass.py \
+ hwtree.py \
network.py \
storage.py \
$(NULL)
diff --git a/vdsm/virt/vmdevices/hwtree.py b/vdsm/virt/vmdevices/hwtree.py
new file mode 100644
index 0000000..309db22
--- /dev/null
+++ b/vdsm/virt/vmdevices/hwtree.py
@@ -0,0 +1,56 @@
+#
+# Copyright 2014 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
+#
+
+from . import core
+from . import hwclass
+from . import graphics
+from . import network
+from . import storage
+
+
+_DEVICE_MAPPING = (
+ (hwclass.DISK, storage.Drive),
+ (hwclass.NIC, network.Interface),
+ (hwclass.SOUND, core.Sound),
+ (hwclass.VIDEO, core.Video),
+ (hwclass.GRAPHICS, graphics.Graphics),
+ (hwclass.CONTROLLER, core.Controller),
+ (hwclass.GENERAL, core.Generic),
+ (hwclass.BALLOON, core.Balloon),
+ (hwclass.WATCHDOG, core.Watchdog),
+ (hwclass.CONSOLE, core.Console),
+ (hwclass.REDIR, core.Redir),
+ (hwclass.RNG, core.Rng),
+ (hwclass.SMARTCARD, core.Smartcard),
+ (hwclass.TPM, core.Tpm))
+
+
+def empty():
+ return dict((dev, []) for dev, _ in _DEVICE_MAPPING)
+
+
+def build(dev_conf, vm_conf, log):
+ devices = empty()
+
+ for devType, devClass in _DEVICE_MAPPING:
+ for dev in dev_conf[devType]:
+ devices[devType].append(devClass(vm_conf, log, **dev))
+
+ return devices
--
To view, visit http://gerrit.ovirt.org/38077
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If17cce15f653843848eea42b567a0e4454757cd1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: virt: dev: implement from_xml for ControllerDevice
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: dev: implement from_xml for ControllerDevice
......................................................................
virt: dev: implement from_xml for ControllerDevice
Change-Id: I4cf7df0495a58c81207e680732fe0e72b8b5b04c
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 27 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/33754/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index a6e68ae..05f0a2f 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -709,6 +709,17 @@
return ctrl
+ @classmethod
+ def from_xml(cls, conf, log, dev_xml):
+ alias = dev_xml.getElementsByTagName('alias')[0].getAttribute('name')
+ return cls(
+ conf, log,
+ alias=alias,
+ device=dev_xml.getAttribute('type'),
+ model=dev_xml.getAttribute('model'),
+ index=dev_xml.getAttribute('index'),
+ address=vmxml.device_address(dev_xml))
+
class SoundDevice(vmdevices.Base):
__slots__ = ('address', 'alias')
@@ -4726,41 +4737,37 @@
# Ignore controller devices without address
if not x.getElementsByTagName('address'):
continue
- alias = x.getElementsByTagName('alias')[0].getAttribute('name')
- device = x.getAttribute('type')
- # Get model and index. Relevant for USB controllers.
- model = x.getAttribute('model')
- index = x.getAttribute('index')
- # Get controller address
- address = vmxml.device_address(x)
+ dev = ControllerDevice.from_xml(x)
# In case the controller has index and/or model, they
# are compared. Currently relevant for USB controllers.
for ctrl in self._devices[CONTROLLER_DEVICES]:
- if ((ctrl.device == device) and
- (not hasattr(ctrl, 'index') or ctrl.index == index) and
- (not hasattr(ctrl, 'model') or ctrl.model == model)):
- ctrl.alias = alias
- ctrl.address = address
+ if ((ctrl.device == dev.device) and
+ (not hasattr(ctrl, 'index')
+ or ctrl.index == dev.index) and
+ (not hasattr(ctrl, 'model')
+ or ctrl.model == dev.model)):
+ ctrl.alias = dev.alias
+ ctrl.address = dev.address
# Update vm's conf with address for known controller devices
# In case the controller has index and/or model, they
# are compared. Currently relevant for USB controllers.
knownDev = False
for dev in self.conf['devices']:
if ((dev['type'] == CONTROLLER_DEVICES) and
- (dev['device'] == device) and
- ('index' not in dev or dev['index'] == index) and
- ('model' not in dev or dev['model'] == model)):
- dev['address'] = address
- dev['alias'] = alias
+ (dev['device'] == dev.device) and
+ ('index' not in dev or dev['index'] == dev.index) and
+ ('model' not in dev or dev['model'] == dev.model)):
+ dev['address'] = dev.address
+ dev['alias'] = dev.alias
knownDev = True
# Add unknown controller device to vm's conf
if not knownDev:
self.conf['devices'].append({'type': CONTROLLER_DEVICES,
- 'device': device,
- 'address': address,
- 'alias': alias})
+ 'device': dev.device,
+ 'address': dev.address,
+ 'alias': dev.alias})
def _getUnderlyingBalloonDeviceInfo(self):
"""
--
To view, visit http://gerrit.ovirt.org/33754
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4cf7df0495a58c81207e680732fe0e72b8b5b04c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: virt: dev: implement from_xml for SmartcardDevice
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: dev: implement from_xml for SmartcardDevice
......................................................................
virt: dev: implement from_xml for SmartcardDevice
Change-Id: I395c49d1cd9af04527840a7d5aaf853d35aa122d
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 5 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/33753/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index e340ed0..a6e68ae 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4820,19 +4820,18 @@
if not x.getElementsByTagName('address'):
continue
- address = vmxml.device_address(x)
- alias = x.getElementsByTagName('alias')[0].getAttribute('name')
+ dev = SmartCardDevice.from_xml(x)
for dev in self._devices[SMARTCARD_DEVICES]:
if not hasattr(dev, 'address'):
- dev.address = address
- dev.alias = alias
+ dev.address = dev.address
+ dev.alias = dev.alias
for dev in self.conf['devices']:
if dev['device'] == SMARTCARD_DEVICES and \
not dev.get('address'):
- dev['address'] = address
- dev['alias'] = alias
+ dev['address'] = dev.address
+ dev['alias'] = dev.alias
def _getUnderlyingWatchdogDeviceInfo(self):
"""
--
To view, visit http://gerrit.ovirt.org/33753
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I395c49d1cd9af04527840a7d5aaf853d35aa122d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: virt: dev: implement from_xml for WatchdogDevice
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: dev: implement from_xml for WatchdogDevice
......................................................................
virt: dev: implement from_xml for WatchdogDevice
Change-Id: I8ceb0f85908c99454f0c981fa4318cc1989f0f7c
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 5 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/33752/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index a63c932..e340ed0 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4845,19 +4845,18 @@
# PCI watchdog has "address" different from ISA watchdog
if x.getElementsByTagName('address'):
- address = vmxml.device_address(x)
- alias = x.getElementsByTagName('alias')[0].getAttribute('name')
+ dev = WatchdogDevice.from_xml(x)
for wd in self._devices[WATCHDOG_DEVICES]:
if not hasattr(wd, 'address') or not hasattr(wd, 'alias'):
- wd.address = address
- wd.alias = alias
+ wd.address = dev.address
+ wd.alias = dev.alias
for dev in self.conf['devices']:
if ((dev['type'] == WATCHDOG_DEVICES) and
(not dev.get('address') or not dev.get('alias'))):
- dev['address'] = address
- dev['alias'] = alias
+ dev['address'] = dev.address
+ dev['alias'] = dev.alias
def _getUnderlyingVideoDeviceInfo(self):
"""
--
To view, visit http://gerrit.ovirt.org/33752
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ceb0f85908c99454f0c981fa4318cc1989f0f7c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: virt: dev: implement from_xml for SoundDevice
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: dev: implement from_xml for SoundDevice
......................................................................
virt: dev: implement from_xml for SoundDevice
Change-Id: I04ffbb857557e9f438634465c3f13ca6446393e5
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 5 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/33751/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index d356da8..a63c932 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4892,9 +4892,7 @@
soundsxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
getElementsByTagName('devices')[0].getElementsByTagName('sound')
for x in soundsxml:
- alias = x.getElementsByTagName('alias')[0].getAttribute('name')
- # Get sound card address
- address = vmxml.device_address(x)
+ dev = SoundDevice.from_xml(x)
# FIXME. We have an identification problem here.
# Sound device has not unique identifier, except the alias
@@ -4902,15 +4900,15 @@
# we can only assign the address according to devices order.
for sc in self._devices[SOUND_DEVICES]:
if not hasattr(sc, 'address') or not hasattr(sc, 'alias'):
- sc.alias = alias
- sc.address = address
+ sc.alias = dev.alias
+ sc.address = dev.address
break
# Update vm's conf with address
for dev in self.conf['devices']:
if ((dev['type'] == SOUND_DEVICES) and
(not dev.get('address') or not dev.get('alias'))):
- dev['address'] = address
- dev['alias'] = alias
+ dev['address'] = dev.address
+ dev['alias'] = dev.alias
break
def _getDriveIdentification(self, dom):
--
To view, visit http://gerrit.ovirt.org/33751
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I04ffbb857557e9f438634465c3f13ca6446393e5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months