From patchwork Mon Aug 22 17:09:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 110987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 94268B6F81 for ; Tue, 23 Aug 2011 06:14:00 +1000 (EST) Received: from localhost ([::1]:37531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qvase-0004uF-Mp for incoming@patchwork.ozlabs.org; Mon, 22 Aug 2011 16:13:56 -0400 Received: from eggs.gnu.org ([140.186.70.92]:36293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvasZ-0004sv-AQ for qemu-devel@nongnu.org; Mon, 22 Aug 2011 16:13:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvasY-0000HS-3g for qemu-devel@nongnu.org; Mon, 22 Aug 2011 16:13:51 -0400 Received: from mout.perfora.net ([74.208.4.195]:55795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvasX-0000HN-6i for qemu-devel@nongnu.org; Mon, 22 Aug 2011 16:13:50 -0400 Received: from localhost.localdomain (adsl-99-62-38-222.dsl.aus2tx.sbcglobal.net [99.62.38.222]) by mrelay.perfora.net (node=mrus2) with ESMTP (Nemesis) id 0MYOHR-1Qik5F0TWz-00VGOY; Mon, 22 Aug 2011 13:10:07 -0400 From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 22 Aug 2011 12:09:18 -0500 Message-Id: <1314032960-23474-4-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1314032960-23474-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1314032960-23474-1-git-send-email-mdroth@linux.vnet.ibm.com> X-Provags-ID: V02:K0:FCL/Tg9gUpQsmoOEYjTsI91xTeRDsJNFcIOPrGGuNBr M+vTVbTzcEd8pch9W4hLKmgV40H/67NlJ8UXUnDWSONXvfdZyo h4+Aaum5NaDQUkZzE0+oVUrb85xniq1mOGvjWwABGe3FfUFbs9 EfyTuE/p/EvIwjwTb1XW85eMosAieEW1CA7ZlI0siUAGxde1B2 P3EuMbyxqlwAo4kGCCwPir5PPTZciUiiP87YKsZ6lo= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.208.4.195 Cc: aliguori@linux.vnet.ibm.com, mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 3/5] guest tools: qemu-ga, debian init files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Init files for debian/ubuntu guests Signed-off-by: Michael Roth --- .../projects/qemu-ga/debian/qemu-ga.init | 112 ++++++++++++++++++++ .../projects/qemu-ga/debian/qemu-ga.sysconfig | 14 +++ 2 files changed, 126 insertions(+), 0 deletions(-) create mode 100755 guest-tools-iso/projects/qemu-ga/debian/qemu-ga.init create mode 100644 guest-tools-iso/projects/qemu-ga/debian/qemu-ga.sysconfig diff --git a/guest-tools-iso/projects/qemu-ga/debian/qemu-ga.init b/guest-tools-iso/projects/qemu-ga/debian/qemu-ga.init new file mode 100755 index 0000000..0a4fd91 --- /dev/null +++ b/guest-tools-iso/projects/qemu-ga/debian/qemu-ga.init @@ -0,0 +1,112 @@ +#!/bin/sh +# +# qemu-ga Control the QEMU guest agent +# +# Author: Adam Litke +# +# Copyright 2011 IBM, and/or its affiliates. +# Released under the GPL +# +# chkconfig: 2345 50 40 +# description: The QEMU guest agent provides a mechanism for communication \ +# with a QEMU host and a host<->guest command API. +# processname: qemu-ga +# pidfile: /var/run/qemu-ga.pid +# + +### BEGIN INIT INFO +# Provides: qemu-ga +# Required-Start: $syslog +# Required-Stop: +# Should-Start: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 6 +# Short-Description: QEMU guest agent +# Description: The QEMU guest agent provides a mechanism for communication +# with a QEMU host and a host<->guest command API. +### END INIT INFO + +. /lib/lsb/init-functions +. /etc/sysconfig/qemu-ga + +prog=qemu-ga +bin=/usr/sbin/qemu-ga +pidfile=${PIDFILE-"/var/run/qemu-ga.pid"} +RETVAL=0 + +wait_for_port() { + for i in `seq 1 5`; do + [ -f "$PORT" ] && return 0 + sleep 1 + done + return 1 +} + +start() { + log_daemon_msg "Starting QEMU Guest Agent" "$prog" + + # Ensure the virtio_console module is loaded + /sbin/modprobe virtio_console + wait_for_port + + log_daemon_msg "$pidfile" "$prog" + start_daemon -p $pidfile -- $bin $OPTIONS -f $pidfile + RETVAL=$? + log_end_msg $RETVAL + return $RETVAL +} + +stop() { + log_daemon_msg "Stopping QEMU Guest Agent" "$prog" + killproc -p ${pidfile} + RETVAL=$? + log_end_msg $RETVAL + return $RETVAL +} + +restart() { + stop + start + return $? +} + +condrestart() { + pidofproc + if [ $? -eq 0 ]; then + log_daemon_msg "QEMU Guest Agent already running" "$prog" + RETVAL=0 + log_end_msg $RETVAL + else + restart + return $? + fi + +} + +case "$1" in + start) + start + RETVAL=$? + ;; + stop) + stop + RETVAL=$? + ;; + status) + status_of_pid -p ${pidfile} $bin $prog + RETVAL=$? + ;; + restart|force-reload) + restart + RETVAL=$? + ;; + condrestart|try-restart) + condrestart + RETVAL=$? + ;; + *) + echo $"Usage: $prog {start|stop|restart|force-reload|condrestart|try-restart|status|help}" + RETVAL=2 +esac + +exit $RETVAL diff --git a/guest-tools-iso/projects/qemu-ga/debian/qemu-ga.sysconfig b/guest-tools-iso/projects/qemu-ga/debian/qemu-ga.sysconfig new file mode 100644 index 0000000..c125a82 --- /dev/null +++ b/guest-tools-iso/projects/qemu-ga/debian/qemu-ga.sysconfig @@ -0,0 +1,14 @@ +# This file configures the qemu-ga guest agent daemon + +# METHOD= Sets the type of channel being used. The only type currently +# supported is virtio-serial +METHOD="virtio-serial" + +# PORT= Sets the name of the channel to use. This should be a device file +PORT="/dev/virtio-ports/org.qemu.guest_agent.0" + +# LOGFILE= Sets the path to the log file. +LOGFILE="/var/log/qemu-ga.log" + +# Set options according to above +OPTIONS="-m $METHOD -p $PORT -l $LOGFILE -d"