Project

General

Profile

Actions

Feature #14019

closed

Allow more control over zone init exit actions

Added by Andy Fiddaman 9 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
kernel
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

There is currently a brand option to control whether init is restarted if it exits as opposed to the zone shutting down (added in #5330).

SmartOS and OmniOS have additional options:

  • reboot the zone if init exits - this is used for the lx brand;
  • restart init if it exited with status 0, otherwise halt the zone - this is used for the bhyve brand.

These options would be useful to have in gate. In particular, the second option will allow distributions to improve their bhyve brands to operate in the same way as SmartOS and OmniOS, and will be necessary for any future bhyve brand upstreaming.


Related issues

Related to illumos gate - Bug #5330: zone brands could control init restart behaviorClosedJerry Jelinek2014-11-14

Actions
Actions #1

Updated by Andy Fiddaman 9 months ago

  • Related to Bug #5330: zone brands could control init restart behavior added
Actions #2

Updated by Andy Fiddaman 9 months ago

  • Gerrit CR set to 1656
Actions #3

Updated by Andy Fiddaman 8 months ago

I've tested this with a zone running in a gate ONU.

First, with no restart tags in the brand's config.xml, checking that things default correctly:

> ::zone
            ADDR     ID STATUS        NAME                 PATH
fffffffffbfe2620      0 running       global               /
fffffe2d5fb5ed00      2 running       pkgsrc               /zones/pkgsrc/root/
> fffffffffbfe2620::print zone_t ! grep _init
    zone_proc_initpid = 0x1
    zone_initname = initname "/sbin/init" 
    zone_restart_init = 0x1 (B_TRUE)
    zone_reboot_on_init_exit = 0 (0)
    zone_restart_init_0 = 0 (0)
> fffffe2d5fb5ed00::print zone_t ! grep _init
    zone_proc_initpid = 0x18beb
    zone_initname = 0xfffffe2db135cd20 "/sbin/init" 
    zone_restart_init = 0x1 (B_TRUE)
    zone_reboot_on_init_exit = 0 (0)
    zone_restart_init_0 = 0 (0)

Causing the zone's init to exit with a non-zero signal results in it being restarted, as expected:

Sep 21 10:59:15 bloody genunix: [ID 729207 kern.warning] WARNING: init(1M) for zone pkgsrc (pid 101355) exited on fatal signal 9: restarting automatically

I then tested all combinations of the three tags in the zone's config.xml file and verified that behaviour was as expected for each case. For the 'restart only when init exits 0' case, I used a bhyve branded zone from OmniOS which uses bhyve as init; that process exits 0 for a guest reboot and non-zero for other cases such as halt.

Actions #4

Updated by Electric Monk 7 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 55fcd84f321375248464013e08f0ff6d6e00fffe

commit  55fcd84f321375248464013e08f0ff6d6e00fffe
Author: Jerry Jelinek <jerry.jelinek@joyent.com>
Date:   2021-10-24T16:47:53.000Z

    14019 Allow more control over zone init exit actions
    Portions contributed by: Joshua M. Clulow <jmc@joyent.com>
    Portions contributed by: Andy Fiddaman <andy@omnios.org>
    Reviewed by: C Fraire <cfraire@me.com>
    Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF