Print this page
14019 Allow more control over zone init exit actions (fix mismerge)
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>
@@ -1290,12 +1290,12 @@
brand_handle_t bh;
zone_iptype_t iptype;
dladm_status_t status;
char errmsg[DLADM_STRSIZE];
int err;
- boolean_t restart_init;
boolean_t app_svc_dep;
+ boolean_t restart_init, restart_init0, restart_initreboot;
if (brand_prestatechg(zlogp, zstate, Z_BOOT, debug) != 0)
return (-1);
if ((zoneid = getzoneidbyname(zone_name)) == -1) {
@@ -1343,12 +1343,14 @@
"unable to determine zone's init(1M) location");
brand_close(bh);
goto bad;
}
- /* See if we should restart init if it dies. */
+ /* See if this zone's brand should restart init if it dies. */
restart_init = restartinit(bh);
+ restart_init0 = brand_restartinit0(bh);
+ restart_initreboot = brand_restartinitreboot(bh);
/*
* See if we need to setup contract dependencies between the zone's
* primary application and any of its services.
*/
@@ -1425,10 +1427,21 @@
if (!restart_init && zone_setattr(zoneid, ZONE_ATTR_INITNORESTART,
NULL, 0) == -1) {
zerror(zlogp, B_TRUE, "could not set zone init-no-restart");
goto bad;
}
+ if (restart_init0 && zone_setattr(zoneid, ZONE_ATTR_INITRESTART0,
+ NULL, 0) == -1) {
+ zerror(zlogp, B_TRUE,
+ "could not set zone init-restart-on-exit-0");
+ goto bad;
+ }
+ if (restart_initreboot && zone_setattr(zoneid, ZONE_ATTR_INITREBOOT,
+ NULL, 0) == -1) {
+ zerror(zlogp, B_TRUE, "could not set zone reboot-on-init-exit");
+ goto bad;
+ }
if (app_svc_dep && zone_setattr(zoneid, ZONE_ATTR_APP_SVC_CT,
(void *)B_TRUE, sizeof (boolean_t)) == -1) {
zerror(zlogp, B_TRUE, "could not set zone app-die");
goto bad;