conf/146053: [patch] [request] shutdown of jails breaks
inter-jail dependencies
Chad Milios
cropcirclesystems at yahoo.com
Thu Jun 3 01:10:04 UTC 2010
The following reply was made to PR conf/146053; it has been noted by GNATS.
From: Chad Milios <cropcirclesystems at yahoo.com>
To: bug-followup at FreeBSD.org
Cc:
Subject: Re: conf/146053: [patch] [request] shutdown of jails breaks inter-jail dependencies
Date: Wed, 2 Jun 2010 18:03:32 -0700 (PDT)
I think my original change request may have been unclear and my example was certainly contrived.
If a user of FreeBSD jails wishes to ensure that for jail A B and C, A and B are always running at any point in time in which C is, it is impossible to do so using the existing rc.conf system because `/etc/rc.d/jail stop` will stop them all, serially, in the same order that `./jail start` started them all.
In the EXISTING implementation, for rc.d scripts "a b jail f" (as a list output by rcorder(8)), and jails "C D E":
rc does basically something to the effect of: `./a start; ./b start; ./jail start C; ./jail stop D; ./jail stop E; ./f start`
while rc.shutdown then later does something to the effect of: `./f stop; ./jail stop C; ./jail stop D; ./jail stop E; ./b stop; ./a stop`
but I PROPOSE that the rc.shutdown process should instead result in: `./f stop; ./jail stop E; ./jail stop D; ./jail stop C; ./b stop; ./a stop`
If no one seems to care and there is no one worrying about their jails' shutdown order, IMHO we should just quietly add the single important line of my patch to rc.d/jail:
jail_stop()
{
echo -n 'Stopping jails:'
+jail_list=`reverse_list $jail_list`
and not clutter up rc.conf any more with this jail_reverse_shutdown boolean. But, the patch i originally provided will add this rc.conf variable while allowing existing behavior to remain the default.
Just because we are not meta-data gathering and automatically dependency sorting the jails for the user (a la what rcorder does with the rc.d scripts) doesn't mean we shouldn't reverse that jail_list for them when it comes time to shutdown, (like rc.shutdown does to the dependency-sorted list of rc.d scripts that are output from rcorder,) since the user may have ordered their jail_list manually for dependency reasons, and some dependencies may be required all the way through shutdown for a particular servi ce.
reversing the jail list in jail_stop also affects manual use of the jail rc.d script on the command line such as `./jail start A B C` and `./jail stop A B C`. the jails should still be listed in dependency order on the command line because jail_stop will reverse the list when stopping them.
More information about the freebsd-rc
mailing list