From owner-freebsd-jail@FreeBSD.ORG Thu Jan 14 17:14:43 2010 Return-Path: Delivered-To: jail@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6273106566B; Thu, 14 Jan 2010 17:14:43 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) by mx1.freebsd.org (Postfix) with ESMTP id 602438FC0C; Thu, 14 Jan 2010 17:14:42 +0000 (UTC) Received: from elsa.codelab.cz (localhost.codelab.cz [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 325A519E047; Thu, 14 Jan 2010 18:14:41 +0100 (CET) Received: from [192.168.1.2] (r5bb235.net.upc.cz [86.49.61.235]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id BB6F219E023; Thu, 14 Jan 2010 18:14:38 +0100 (CET) Message-ID: <4B4F50FD.8090207@quip.cz> Date: Thu, 14 Jan 2010 18:14:37 +0100 From: Miroslav Lachman <000.fbsd@quip.cz> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1.7) Gecko/20100104 SeaMonkey/2.0.2 MIME-Version: 1.0 To: Alexander Leidinger References: <20091207080353.66241t4vpmnmrilc@webmail.leidinger.net> <20100105112447.00005e71@unknown> <4B43184E.1010106@quip.cz> <20100114134059.1929551uvux5y3wo@webmail.leidinger.net> In-Reply-To: <20100114134059.1929551uvux5y3wo@webmail.leidinger.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: jail@freebsd.org, remko@freebsd.org Subject: Re: starting jails in the background & dependencies X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2010 17:14:43 -0000 Alexander Leidinger wrote: > Quoting Miroslav Lachman <000.fbsd@quip.cz> (from Tue, 05 Jan 2010 > 11:45:34 +0100): > >> Alexander Leidinger wrote: >>> On Mon, 07 Dec 2009 08:03:53 +0100 Alexander Leidinger >>> wrote: >>> >>>> Hi, >>>> >>>> now that jails are started in the background (which is good, to >>> >>> I just realized yesterday that it also stops in parallel (in the >>> background). This is bad. It may be the case that a jail is not fully >>> stopped via the rc scripts when the OS decides to kill the remaining >>> processes during a shutdown. >>> >>> My first reaction is to only allow to start in the background, but >>> everything else needs to be serialized. >>> >>> Any objections or better ideas out there? >> >> Maybe stopping can be done in parallel, but rc script should wait (in >> loop) until all jails are stopped or some configurable timeout (for >> example 60 seconds). > > Feel free to come up with a proof of concept... but the timeout on stop > should be "forever" IMO. If you have a busy software which needs to be > shutdown correctly for data safety or consistency reasons, I do not want > that a reboot or shutdown prevents the correct shutdown. I misunderstand the whole thing from the begining. It's all about wording "background" and "parallel". My first understanding was if I have 4 jails, they are started in parallel (each other) something like: for J in jail1 jail2 jail3 jail4 do jail_start $J & done and similar for stoping them. But now I see that it is just a start jails in serial as usual but rc.d/jail runs in the background, so next rc script will start right after rc.d/jail, not waiting to jails come up. Both approaches have its pros and cons. In the first case (starting and stopping each jail in the background) stopping can be easy as: for J in $jail_list do jail_stop $J & done while [ -n "`jls`" ] do sleep 1 done echo "all jails were stopped" For the second case, where jails are started / stopped as usual but whole rc.d/jail is backgrounded the only solution I got in my mind is the second rc script (for example bgjail_stop) with similar loop as above executed as one of the last rc scripts on system shutdown. (but I know it is ugly solution) I hope somebody will come with better idea :) Miroslav Lachman PS: as my english is not so well, it is sometimes hard to me to understand and sometimes hard to explain things