starting jails in the background & dependencies

Alexander Leidinger Alexander at Leidinger.net
Mon Dec 7 07:04:05 UTC 2009


Hi,

now that jails are started in the background (which is good, to  
prevent that a broken jail causes a good jail not to start), I have to  
problem how to express dependencies.

Scenario:
  - several jails on the same machine (via ezjail)
  - one jail depends on the services of another jail, e.g.
    - jail0 with a DNS server
    - jailA with mysql (requires that jail0 is up)
    - jailB needs access to the mysql of the jailA (and DNS of
      jail0)

Currently all jails are started in parallel. This may lead to a  
situation where something in jailB wants to access jailA before mysql  
is available.

In my case I have the special condition that I need to run a script  
(rc.d) on the jail-host, after two specific jails are started:
  - I have a good PROVIDE line in /usr/local/etc/ezjail/jailA
    (and jail0)
  - I have a corresponding REQUIRE line in
    /usr/local/etc/ezjail/jailB (and jailA for jail0)
  - rc.d/ezjail is called before my script (it hardlinks the
    mysql socket into jailB)
  - the jails are started in parallel -> rc.d/ezjail finishes
    before mysql is started
  - my link-script starts before mysql is up -> no DB connection
    possible from jailB (configured to use the unix domain socket)

In my case it would be OK to block the start of everything if one jail  
starts, so the easy solution would be to introduce a  
jail_background_start variable (default: yes).

Does someone have a better idea how to solve this? If not, any  
objections against the jail_background_start solution?

Bye,
Alexander.

-- 
Sanity and insanity overlap a fine grey line.

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137


More information about the freebsd-jail mailing list