implement graceful shutdown for local zones in zoneadm
Currently there are the following options:
- "zoneadm -z ZONE halt" - aborts local zone processes ungracefully and revokes its resources (like poweroff)
- "zoneadm -z ZONE reboot" - aborts local zone processes ungracefully and restarts it
- "zlogin ZONE init 0" - gracefully shuts down the local zone, invoking its SMF stop methods and RC stop scripts
- "zlogin ZONE init 6" - gracefully shuts down the local zone, invoking its SMF stop methods and RC stop scripts, then halts and restarts it
The first part of the newly proposed feature is to implement a "zoneadm -Z shutdown (-r)" method for feature-parity with Solaris 11 (http://docs.oracle.com/cd/E23824_01/html/821-1462/zoneadm-1m.html):
shutdown [-r [-— boot_options]] Cleanly shut down the zone (equivalent to running /usr/sbin/init 0 in the zone). The shutdown subcommand waits until the zone is successfully shut down; a zoneadm halt can be used to forcibly halt the zone, if the shutdown process takes a long time. If -r is specified, reboot the zone. See the boot subcommand for supported boot options.
The second part of the quest is to update halt.c and/or bootadm.c to invoke "zoneadm shutdown" when stopping the global zone gracefully (unless the fast halt/poweroff/reboot method is requested in GZ explicitly to bypass all stop methods).
Otherwise server processes running in local zones receive a SIGTERM signal via LZ "zoneadm halt" invokation, and at most 30 seconds to complete (from halt.c, see http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/halt/halt.c#check_zones_haltedness). For certain processes, especially in distributed systems like databases and their application servers, this timeframe may be inadequate for a proper clean shutdown, and should not be forced by the OS -- the local zone shutdown should behave just like global zone shutdown in both graceful and ungraceful modes.
Updated by Electric Monk about 6 years ago
Author: Alexander Eremin <email@example.com> 2594 implement graceful shutdown for local zones in zoneadm Reviewed by: Saso Kiselkov <firstname.lastname@example.org> Reviewed by: Jerry Jelinek <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>