From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id C27E2138247 for ; Sat, 7 Dec 2013 06:49:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E70E7E0ABE; Sat, 7 Dec 2013 06:49:44 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3B2D9E0ABE for ; Sat, 7 Dec 2013 06:49:44 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 331C033F218 for ; Sat, 7 Dec 2013 06:49:43 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 2332) id C84642004E; Sat, 7 Dec 2013 06:49:41 +0000 (UTC) From: "Ian Delaney (idella4)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, idella4@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in app-emulation/xen-tools/files: xencommons.confd xenqemudev.initd xenstored.initd xenstored.confd xenconsoled.initd X-VCS-Repository: gentoo-x86 X-VCS-Files: xencommons.confd xenqemudev.initd xenstored.initd xenstored.confd xenconsoled.initd X-VCS-Directories: app-emulation/xen-tools/files X-VCS-Committer: idella4 X-VCS-Committer-Name: Ian Delaney Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Message-Id: <20131207064941.C84642004E@flycatcher.gentoo.org> Date: Sat, 7 Dec 2013 06:49:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 145ba2e8-9049-4b32-8f3b-64b34947db42 X-Archives-Hash: 5bff52e3d906032db8ea842c7023b1b3 idella4 13/12/07 06:49:41 Modified: xencommons.confd xenqemudev.initd xenstored.initd xenstored.confd xenconsoled.initd Log: corrections to previous patch by dlan, tested by him (Portage version: 2.2.0/cvs/Linux x86_64, signed Manifest commit with key 0xB8072B0D) Revision Changes Path 1.2 app-emulation/xen-tools/files/xencommons.confd file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xencommons.confd?rev=1.2&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xencommons.confd?rev=1.2&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xencommons.confd?r1=1.1&r2=1.2 Index: xencommons.confd =================================================================== RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xencommons.confd,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- xencommons.confd 6 Dec 2013 23:34:11 -0000 1.1 +++ xencommons.confd 7 Dec 2013 06:49:41 -0000 1.2 @@ -1,7 +1,4 @@ -# /etc/conf.d/xenqemudev +# /etc/conf.d/xencommons -# To enable QEMU file backend, set to 'yes' -XENQEMUDEV_FILE_BACKEND_ENABLE="" - -# Common options for xenqemudev -XENQEMUDEV_OPTS="" +# Load xen's kernel modules, and this will override defaults +XEN_KERNEL_MODULES="" 1.2 app-emulation/xen-tools/files/xenqemudev.initd file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd?rev=1.2&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd?rev=1.2&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd?r1=1.1&r2=1.2 Index: xenqemudev.initd =================================================================== RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- xenqemudev.initd 6 Dec 2013 23:34:11 -0000 1.1 +++ xenqemudev.initd 7 Dec 2013 06:49:41 -0000 1.2 @@ -1,117 +1,81 @@ #!/sbin/runscript # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd,v 1.1 2013/12/06 23:34:11 idella4 Exp $ - -extra_commands="status" +# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenqemudev.initd,v 1.2 2013/12/07 06:49:41 idella4 Exp $ depend() { - need xend - after dhcp + need xencommons xenstored xenconsoled } -get_domname() { - local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1) - - if [ -z ${name_from_file} ] ; then - basename "${1}" - else - echo ${name_from_file} - fi +is_privileged_domain() { + grep -qsE '^control_d$' /proc/xen/capabilities + return $? } -is_running() { - /usr/sbin/xm list "${1}" >/dev/null 2>&1 -} +xen_setvars() { + . /etc/xen/scripts/hotplugpath.sh -using_screen() { - [ "${SCREEN}" = "yes" -o "${SCREEN}" = "YES" ] + XENQEMUDEV_PIDFILE=/run/xenqemudev.pid + XEN_QEMU="${LIBEXEC}/qemu-system-i386" } -set_screen_cmd() { - screen_cmd="screen -c ${SCREENRC:-/dev/null} -q -r ${SCREEN_NAME:=xen} -X" +xen_qemu_start() { + if [ -z "${XENQEMUDEV_FILE_BACKEND_ENABLE}" ]; then + ewarn " QEMU disk backend not enabled" + ewarn " enable XENQEMUDEV_FILE_BACKEND_ENABLE in /etc/conf.d/xenqemudev" + return 1 + fi + + xen_setvars + + if [ ! -c /dev/xen/gntdev ]; then + einfo " Xen gntdev driver not loaded" + return 1 + fi + + if [ -e "${XEN_QEMU}" ]; then + einfo " Starting QEMU as disk backend for dom0" + + XENQEMUDEV_DEFAULT_OPTS="-xen-domid 0 -xen-attach -name dom0 \ + -nographic -M xenpv -daemonize \ + -monitor /dev/null -serial /dev/null -parallel /dev/null" + + XENQEMUDEV_OPTS=${XENQEMUDEV_OPTS:-${XENQEMUDEV_DEFAULT_OPTS}} + + start-stop-daemon --start --exec ${XEN_QEMU} \ + --pidfile ${XENQEMUDEV_PIDFILE} \ + -- -pidfile ${XENQEMUDEV_PIDFILE} \ + ${XENQEMUDEV_OPTS} + return $? + fi } start() { - set_screen_cmd + ebegin "Starting xenqemudev daemon" - einfo "Starting Xen domains from ${AUTODIR:=/etc/xen/auto}" - if using_screen ; then - ebegin "Creating screen session to hold domain consoles" - ( screen -c ${SCREENRC:-/dev/null} -d -m -S ${SCREEN_NAME} -t dom0 && sleep 3 \ - && ${screen_cmd} zombie dr \ - && logrotate -f /etc/xen/xen-consoles.logrotate \ - && ${screen_cmd} logfile /var/log/xen-consoles/%t.log \ - && ${screen_cmd} logfile flush ${SCREEN_LOG_INTERVAL:-1} \ - && ${screen_cmd} log on \ - && ${screen_cmd} deflog on ) >/dev/null - if [ $? -ne 0 ] ; then - eend 1 - return 1 - else - eend - fi - fi - # Create all domains with config files in AUTODIR. - for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do - name=$(get_domname ${dom}) - if ! is_running ${name} ; then - ebegin " Starting domain ${name}" - if using_screen ; then - ${screen_cmd} screen -t ${name} xm create ${dom} -c - else - xm create --quiet ${dom} - fi - eend $? - else - einfo " Not starting domain ${name} - already running" - fi - done -} - -stop() { - set_screen_cmd - - einfo "Shutting down Xen domains from ${AUTODIR:=/etc/xen/auto}" - # Stop all domains with config files in AUTODIR. - DOMAINS="$(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort -r)" - - if [[ "$PARALLEL_SHUTDOWN" == "yes" ]] ; then - for dom in $DOMAINS ; do - name=$(get_domname ${dom}) - if is_running ${name} ; then - ebegin " Asking domain ${name} to shutdown in the background..." - xm shutdown --wait ${name} >/dev/null & - else - einfo " Not stopping domain ${name} - not running" - fi - done - einfo " Waiting for shutdown of domains that are still running" - wait - eend $? - else - for dom in $DOMAINS ; do - name=$(get_domname ${dom}) - if is_running ${name} ; then - ebegin " Waiting for domain ${name} to shutdown" - xm shutdown --wait ${name} >/dev/null - eend $? - else - einfo " Not stopping domain ${name} - not running" - fi - done + # not running in Xen dom0 or domU + if [ ! -d /proc/xen ]; then + eend 1 "Not running in Xen mode" + return 1 fi - if using_screen ; then - if ${screen_cmd} sleep 0 >/dev/null 2>&1 ; then - ebegin "Closing screen session ${SCREEN_NAME}" - ${screen_cmd} quit - eend $? - else - eend 0 - fi + + if ! is_privileged_domain; then + eend 1 "Not running on a privileged domain. xenqemudev not started" + return 1 fi + + xen_qemu_start + + eend $? "Failed to start xenqemudev" } -status() { - /usr/sbin/xm list -} \ No newline at end of file +stop () { + ebegin "Stopping xenqemudev" + + xen_setvars + + start-stop-daemon --stop --exec ${XEN_QEMU} \ + --pidfile ${XENQEMUDEV_PIDFILE} + + eend $? "Stopping xenqemudev, as it cannot be restarted." +} 1.12 app-emulation/xen-tools/files/xenstored.initd file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd?rev=1.12&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd?rev=1.12&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd?r1=1.11&r2=1.12 Index: xenstored.initd =================================================================== RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- xenstored.initd 6 Dec 2013 23:34:11 -0000 1.11 +++ xenstored.initd 7 Dec 2013 06:49:41 -0000 1.12 @@ -1,7 +1,6 @@ #!/sbin/runscript # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd,v 1.11 2013/12/06 23:34:11 idella4 Exp $ depend() { before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp @@ -9,7 +8,7 @@ } start() { - ! [ -x /run/xen ] && mkdir -p /run/xen + [ -x /run/xen ] || mkdir -p /run/xen ebegin "Starting xenstored daemon" start-stop-daemon --start --exec /usr/sbin/xenstored \ --pidfile /run/xenstored.pid \ @@ -31,3 +30,4 @@ --pidfile /run/xenstored.pid eend $? } + 1.3 app-emulation/xen-tools/files/xenstored.confd file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.confd?rev=1.3&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.confd?rev=1.3&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenstored.confd?r1=1.2&r2=1.3 Index: xenstored.confd =================================================================== RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenstored.confd,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- xenstored.confd 4 Aug 2013 12:22:18 -0000 1.2 +++ xenstored.confd 7 Dec 2013 06:49:41 -0000 1.3 @@ -1,52 +1,2 @@ -#!/sbin/runscript -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -is_privileged_domain() { - # [ -e /proc/xen/capabilities ] - ! [ -z /proc/xen/capabilities ] && return 0 - return 1 -} - -depend() { - before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp -} - -start() { - [ -x /run/xen ] || mkdir -p /run/xen - ebegin "Starting xenstored daemon" - - if [ -e /proc/xen/privcmd ] && is_privileged_domain - then - eend 1 "Not running on a privileged domain. xenstored not started" - return 1 - fi - - start-stop-daemon --start --exec /usr/sbin/xenstored \ - --pidfile /var/run/xenstored.pid \ - -- --pid-file=/var/run/xenstored.pid \ - $XENSTORED_OPTS || return 1 - - einfo "Waiting (upto 10 seconds) for xenstore to come up" - - for i in {0..20}; do - sleep .5 - ! xenstore-exists / 2> /dev/null || break - done - - if ! xenstore-exists / 2> /dev/null; then - eend 1 "xenstore not up within 10 seconds" - else - einfo "Setting domain0 name record" - xenstore-write "/local/domain/0/name" "Domain-0" - eend $? - fi -} - -stop() { - ebegin "Stopping xenstored daemon" - start-stop-daemon --stop --exec /usr/sbin/xenstored \ - --pidfile /var/run/xenstored.pid - eend $? -} - +# /etc/conf.d/xenstored +XENSTORED_OPTS="" 1.4 app-emulation/xen-tools/files/xenconsoled.initd file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd?rev=1.4&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd?rev=1.4&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd?r1=1.3&r2=1.4 Index: xenconsoled.initd =================================================================== RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- xenconsoled.initd 6 Dec 2013 23:34:11 -0000 1.3 +++ xenconsoled.initd 7 Dec 2013 06:49:41 -0000 1.4 @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd,v 1.3 2013/12/06 23:34:11 idella4 Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenconsoled.initd,v 1.4 2013/12/07 06:49:41 idella4 Exp $ depend() { need xenstored @@ -19,6 +19,6 @@ stop() { ebegin "Stopping xenconsoled daemon" start-stop-daemon --stop --exec /usr/sbin/xenconsoled \ - --pidfile run/xenconsoled.pid + --pidfile /run/xenconsoled.pid eend $* }