Re: starting jails in the background & dependencies

2010-01-24 Thread Simon L. Nielsen
B0;251;0cOn 2010.01.14 13:35:16 +0100, Alexander Leidinger wrote:
> Quoting Remko Lodder  (from Tue, 5 Jan 2010  
> 11:35:48 +0100):
> 
> > On Tue, January 5, 2010 11:24 am, 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?
> 
> > I think the best way at this moment is to revert the change ( I can do
> > that , or someone else, I dont mind ) and think of a better concept. Simon
> > also mentioned that he didn't like the current way of doing things, so I
> > kept it in, for possible suggestions. Reverting the change would mean that
> > the old behaviour at least works and is with what people are used to. We
> > can then further improve it where needed.
> 
> What about the following? Just have a look at the principle, I haven't  
> tested it yet. What it does is:
>   - revert back to serial startup by default
>   - allow to only start in the background (jail_parallel_start=YES)

In some thread there was talk about parallel stop as well, but I must
admit I never looked at it.

>   - take input from /dev/null: in case a start script inside the
> jail wants to read from stdin (it shouldn't), it will not
> switch the process into STOP state (but should generate some
> message in the application log)

This seems like a fine change - especially since the output from the
actual jail is hidden.

> Copy&paste, so maybe messed up tabs:

The bottom part of rc.d/jail after the patch seems well, "messy"
in lack of a better word, but since I can't come up with a better
solution right now I think this patch should be committed, and then we
can always improve the implementation later.

Note that I haven't tsted it, but I don't see any errors in the patch.

> ---snip---
> Index: share/man/man5/rc.conf.5
> ===
> --- share/man/man5/rc.conf.5(Revision 202277)
> +++ share/man/man5/rc.conf.5(Arbeitskopie)
> @@ -24,7 +24,7 @@
>   .\"
>   .\" $FreeBSD$
>   .\"
> -.Dd November 11, 2009
> +.Dd January 14, 2010
>   .Dt RC.CONF 5
>   .Os
>   .Sh NAME
> @@ -3472,6 +3472,11 @@
>   If set to
>   .Dq Li NO ,
>   any configured jails will not be started.
> +.It jail_parallel_start
> +.Pq Vt bool
> +If set to
> +.Dq Li YES
> +all configured jails will be started in the background (= in parallel).
>   .It Va jail_list
>   .Pq Vt str
>   A space separated list of names for jails.
> Index: etc/rc.d/jail
> ===
> --- etc/rc.d/jail   (Revision 202277)
> +++ etc/rc.d/jail   (Arbeitskopie)
> @@ -636,7 +636,8 @@
>  done
> 
>  eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \
> -   \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1
> +   \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 \
> +
>  if [ "$?" -eq 0 ] ; then
>  _jail_id=$(head -1 ${_tmp_jail})
> @@ -728,4 +729,19 @@
>   if [ -n "$*" ]; then
>  jail_list="$*"
>   fi
> -run_rc_command "${cmd}" &
> +
> +# Only allow the parallel start of jails, other commands are not
> +# safe to execute in parallel.
> +case "${cmd}" in
> +*start)
> +   ;;
> +*)
> +   jail_parallel_start=NO
> +esac
> +
> +if checkyesno jail_parallel_start; then
> +   run_rc_command "${cmd}" &
> +else
> +   run_rc_command "${cmd}"
> +fi
> +
> Index: etc/defaults/rc.conf
> ===
> --- etc/defaults/rc.conf(Revision 202277)
> +++ etc/defaults/rc.conf(Arbeitskopie)
> @@ -630,6 +630,7 @@
>   ### Jail Configuration ###
>   ##
>   jail_enable="NO"   # Set to NO to disable starting of any jails
> +jail_parallel_start="NO"   # Start jails in the background
>   jail_list=""   # Space separated list of names of jails
>   jail_set_hostname_allow="YES" # Allow root user in a jail to change  
> its hostname
>   jail_socket_unixiproute_only="YES" # Route only TCP/IP within a jail
> ---snip---

-- 
Simon L. Nielsen
___
freebsd-jail@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "freebsd-jail-unsubscr...@freebsd.org"


ports/packages management in jail

2010-01-24 Thread Maciej Jan Broniarz

Hi,

I am running a server with several jails. They were created using 
ezjail. What is the best way, to allow jail internal admin to manage 
ports/packages by himself?
By default ezjail shares ports tree between basejail and otherjails. Is 
there a way for each jail to have a separate ports tree?


Best regards,
mjb
___
freebsd-jail@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "freebsd-jail-unsubscr...@freebsd.org"


Re: ports/packages management in jail

2010-01-24 Thread Justin Head
On 1/24/10, Maciej Jan Broniarz  wrote:
> Hi,
>
> I am running a server with several jails. They were created using
> ezjail. What is the best way, to allow jail internal admin to manage
> ports/packages by himself?
> By default ezjail shares ports tree between basejail and otherjails. Is
> there a way for each jail to have a separate ports tree?
>
Inside the jail just rm the symlinked /usr/ports and then recreate
/usr/ports as a regular directory.  After that a simple portsnap to
grab the ports tree.
___
freebsd-jail@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "freebsd-jail-unsubscr...@freebsd.org"


Re: starting jails in the background & dependencies

2010-01-24 Thread Remko Lodder


> Note that I haven't tsted it, but I don't see any errors in the patch.
>
>> ---snip---

> --
> Simon L. Nielsen
>

Snipping a whole lot of data...

Thanks Simon, I will try to get to that as soon as possible, Alexander:
please feel free to do it earlier if possible, my internet access is
"limited" (or at least commit capabilities).

Thanks,
Remko

-- 
/"\   Best regards,  | re...@freebsd.org
\ /   Remko Lodder   | re...@efnet
 Xhttp://www.evilcoder.org/  |
/ \   ASCII Ribbon Campaign  | Against HTML Mail and News

___
freebsd-jail@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "freebsd-jail-unsubscr...@freebsd.org"