From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1PiYzj-0005Iu-Cq for garchives@archives.gentoo.org; Thu, 27 Jan 2011 21:03:07 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 49B40E0977; Thu, 27 Jan 2011 21:02:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 07AB7E09AD for ; Thu, 27 Jan 2011 21:02:58 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0AC361B400D for ; Thu, 27 Jan 2011 21:02:58 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 543) id 76D3520057; Thu, 27 Jan 2011 21:02:56 +0000 (UTC) From: "Doug Goldstein (cardoe)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, cardoe@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in app-emulation/libvirt/files: libvirtd.confd-r2 libvirtd.init-r2 X-VCS-Repository: gentoo-x86 X-VCS-Files: libvirtd.confd-r2 libvirtd.init-r2 X-VCS-Directories: app-emulation/libvirt/files X-VCS-Committer: cardoe X-VCS-Committer-Name: Doug Goldstein Content-Type: text/plain; charset=utf8 Message-Id: <20110127210256.76D3520057@flycatcher.gentoo.org> Date: Thu, 27 Jan 2011 21:02:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 92ea625e1c1e22f72bd310d08f13b8b0 cardoe 11/01/27 21:02:56 Added: libvirtd.confd-r2 libvirtd.init-r2 Log: Add to the init script the shutting down of NATed networks created by l= ibvirt itself. This functionality was written by Jan Vansteenkiste . It complements the 'virt-network' USE flag. =20 (Portage version: 2.1.9.35/cvs/Linux x86_64) Revision Changes Path 1.1 app-emulation/libvirt/files/libvirtd.confd-r2 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/libv= irt/files/libvirtd.confd-r2?rev=3D1.1&view=3Dmarkup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/libv= irt/files/libvirtd.confd-r2?rev=3D1.1&content-type=3Dtext/plain Index: libvirtd.confd-r2 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # /etc/conf.d/libvirtd # LIBVIRTD_OPTS # You may want to add '--listen' to have libvirtd listen for tcp/ip conne= ctions # if you want to use libvirt for remote control # Please consult 'libvirtd --help' for more options #LIBVIRTD_OPTS=3D"--listen" # LIBVIRTD_KVM_SHUTDOWN # Valid options: # * shutdown - Sends an ACPI shutdown (think when you tap the power butto= n # on your machine and it begins a graceful shutdown). If your # VM ignores this, it will have the power yanked out from under # it in LIBVIRTD_KVM_SHUTDOWN_MAXWAIT seconds. # * managedsave - Performs a state save external to the VM. qemu-kvm will= stop # stop the CPU and save off all state to a separate file. When # the machine is started again, it will resume like nothing ever # happened. This is guarenteed to always successfully stop your # machine and restart it. However it may take some time to finish. # * none - No attempts will be made to stop any VMs. If you are restartin= g your # machine the qemu-kvm process will be simply killed, which may result # in your VMs having disk corruption. LIBVIRTD_KVM_SHUTDOWN=3D"managedsave" # LIBVIRTD_KVM_SHUTDOWN_MAXWAIT # Timeout in seconds until stopping libvirtd and "pulling the plug" on th= e # remaining VM's still in a running state #LIBVIRTD_KVM_SHUTDOWN_MAXWAIT=3D"500" # LIBVIRTD_NET_SHUTDOWN # If libvirtd created networks for you (e.g. NATed networks) then this in= it # script will shut them down for you if this is set to 'yes'. Otherwise, # the networks will be left running once libvirt is shutdown. For this # option to be useful you must have enabled the 'virt-network' USE flag a= nd # have had libvirt create a NATed network for you. # Valid values: 'yes' or 'no' #LIBVIRTD_NET_SHUTDOWN=3D"yes" 1.1 app-emulation/libvirt/files/libvirtd.init-r2 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/libv= irt/files/libvirtd.init-r2?rev=3D1.1&view=3Dmarkup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/libv= irt/files/libvirtd.init-r2?rev=3D1.1&content-type=3Dtext/plain Index: libvirtd.init-r2 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #!/sbin/runscript opts=3D"start stop status reload restart" depend() { need net before sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp } libvirtd_virsh() { # Silence errors because virsh always throws an error about # not finding the hypervisor version when connecting to libvirtd LC_ALL=3DC virsh -c qemu:///system "$@" 2>/dev/null } libvirtd_dom_list() { # Make sure that it wouldn't be confused if the domain name # contains the word running. libvirtd_virsh list | awk '$3 =3D=3D "running" { print $1 }' } libvirtd_dom_count() { # Make sure that it wouldn't be confused if the domain name # contains the word running. libvirtd_virsh list | awk 'BEGIN { count =3D 0 } \ $3 =3D=3D "running" { count++ } \ END { print count }' } libvirtd_net_list() { # The purpose of the awk is to avoid networks with 'active' in the name libvirtd_virsh net-list | awk '$2 =3D=3D "active" { print $1 }' } libvirtd_net_count() { # The purpose of the awk is to avoid networks with 'active' in the name libvirtd_virsh net-list | awk 'BEGIN { count =3D 0 } \ $2 =3D=3D "active" { count++ } \ END { print count }' } start() { ebegin "Starting libvirtd" start-stop-daemon --start \ --env KRB5_KTNAME=3D/etc/libvirt/krb5.tab \ --exec /usr/sbin/libvirtd -- -d ${LIBVIRTD_OPTS} eend $? } stop() { ebegin "Stopping libvirtd" # try to shutdown all (KVM/Qemu) domains DOM_COUNT=3D"$(libvirtd_dom_count)" if [ "${LIBVIRTD_KVM_SHUTDOWN}" !=3D "none" ] \ && [ "${DOM_COUNT}" !=3D "0" ] ; then einfo " Shutting down domain(s):" for DOM_ID in $(libvirtd_dom_list) ; do NAME=3D"$(libvirtd_virsh domname ${DOM_ID} | head -n 1)" einfo " ${NAME}" libvirtd_virsh ${LIBVIRTD_KVM_SHUTDOWN} ${DOM_ID} > /dev/null done if [ -n "${LIBVIRTD_KVM_SHUTDOWN_MAXWAIT}" ] ; then COUNTER=3D"${LIBVIRTD_KVM_SHUTDOWN_MAXWAIT}" else COUNTER=3D500 fi if [ "${LIBVIRTD_KVM_SHUTDOWN}" =3D "shutdown" ]; then einfo " Waiting ${COUNTER} seconds while domains shutdown ..." DOM_COUNT=3D"$(libvirtd_dom_count)" while [ ${DOM_COUNT} -gt 0 ] && [ ${COUNTER} -gt 0 ] ; do DOM_COUNT=3D"$(libvirtd_dom_count)" sleep 1 COUNTER=3D$((${COUNTER} - 1)) echo -n "." done fi DOM_COUNT=3D"$(libvirtd_dom_count)" if [ "${DOM_COUNT}" !=3D "0" ] ; then eerror " !!! Some guests are still running, stopping anyway" fi fi NET_COUNT=3D"$(libvirtd_net_count)" if [ "${LIBVIRTD_NET_SHUTDOWN}" !=3D "no" \ && "${NET_COUNT}" !=3D "0" ]; then einfo " Shutting down network(s):" for NET_NAME in $(libvirtd_net_list); do einfo " ${NET_NAME}" libvirtd_virsh net-destroy ${NET_NAME} > /dev/null done NET_COUNT=3D"$(libvirtd_net_count)" if [ "${NET_COUNT}" !=3D "0" ]; then eerror " !!! Some networks are still active, stopping anyway" fi fi # Now actually stop the daemon start-stop-daemon --stop --quiet --exec \ /usr/sbin/libvirtd --pidfile=3D/var/run/libvirtd.pid eend $? } reload() { ebegin "Reloading libvirtd without shutting down your VMs" start-stop-daemon --stop --quiet --exec \ /usr/sbin/libvirtd --pidfile=3D/var/run/libvirtd.pid if [ $? -ne 0 ]; then eend $? fi start-stop-daemon --start --quiet --exec \ /usr/sbin/libvirtd -- -d ${LIBVIRTD_OPTS} eend $? }