Forum Stats

  • 3,814,896 Users
  • 2,258,926 Discussions
  • 7,892,883 Comments

Discussions

Create (Boot) Order Using The Delegated Zone Restarter

Joost PronkvH-Oracle
Joost PronkvH-Oracle Member Posts: 20 Employee
edited Jul 13, 2018 6:04AM in Oracle Solaris

Introduction

On modern systems the chances are very high that they are running consolidated workloads. In addition applications are becoming more and more complex using multiple elements running in multiple virtual environments as one cohesive whole. However in such a situation boot order of these elements can also be important as you many want to wait with starting certain applications only if others are already running.

To help address this Oracle Solaris 11.4 now introduces a new technology called Delegated Zones Restarter (DZR), which allows the administrator to set dependencies between Oracle Solaris Zones and even have the booting of one zone depend on an application running with another zone. This is now in part possible because of the introduction of Goal Services and now Oracle Solaris Zones are part of the Oracle Solaris Service Management Facility (SMF). For more specific information see the man page sec.zones(8).

In short, with the goal services you can define when you deem a zone to be fully booted when the service milestone/goals is online. You can add dependencies to other services to the milestone/goals service, for example on your application, and once everything is running the SMF service representing the zone in the global zone is online too. Buy then making the SMF service of another zone dependent on the first zone, this second zone will only start booting once the application in the first zone is online.

To be clear this is only for the boot order at boot time of the global zone. An administrator can always boot zones by hand if they want to.

Note: This works for both Native Zones and Kernel Zones as long as they're running Oracle Solaris 11.4.

Overview

In this article we'll build this in steps. We'll be using the environment as set up - shown Figure 1 - in the OTN article on how to install Oracle Solaris Zones, so if you don't have an environment with zones installed yet you can use that as a guide how to build it. It has a zone called testzone and two webzones, and we can simulate that the application running in the testzone requires a web server to be running.

OTN_Pictures_DZR-1.png

Figure 1: The general setup.

First we'll have the testzone simply dependent on an Apache Webserver service running in the global zone, then we'll show how to change that dependency to one of the webzones, with the presumption that the zone is running means the webserver is up. Next we'll show how include the dependency on the webserver in the webzone. And then finally we'll show how you can set the dependencies on the testzone such that it will boot if either webzone is running.

Setting a Zone Dependency on a Service

The core task of the Delegated Zone Restarter is to boot zones in the correct order at time of boot or reboot. This means that for this feature to take effect you will need to set autoboot to true in the zonecfg. So in this case we'll need to confirm that autoboot is set for the testzone so it looks at it's dependencies, and not set for the webzones because we want them to delay the boot until we boot them by hand.

OTN_Pictures_DZR-2.png

Figure 2: Making the testzone dependent on a service in the global zone.

First we're going to show how you can make the booting of the zone dependent on one or more services in the global zone, as shown in Figure 2. First we need to check if the global zone has the Apache Webserver installed, it should buy default but always good to validate:

[email protected]:~# <strong>pkg info apache-24<br/></strong>          Name: web/server/apache-24 <br/>       Summary: Apache Web Server V2.4 <br/>   Description: The Apache HTTP Server Version 2.4 <br/>      Category: Web Services/Application and Web Servers <br/>         State: Installed <br/>     Publisher: solaris <br/>       Version: 2.4.33 <br/>        Branch: 11.4.0.0.1.9.0 <br/>Packaging Date: June 18, 2018 at  6:41:14 PM <br/>          Size: 29.06 MB <br/>          FMRI: pkg://solaris/web/server/[email protected]:20180618T184114Z <br/>   Project URL: https://httpd.apache.org/ <br/>    Source URL: https://archive.apache.org/dist/httpd/httpd-2.4.33.tar.gz

Next we can set the dependency:

[email protected]:~# <strong>zonecfg -z testzone<br/></strong>zonecfg:testzone> <strong>add smf-dependency<br/></strong>zonecfg:testzone:smf-dependency> <strong>set fmri=svc:/network/http:apache24<br/></strong>zonecfg:testzone:smf-dependency> <strong>end<br/></strong>zonecfg:testzone> <strong>exit<br/></strong>[email protected]:~# <strong>svcs -l testzone<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        online <br/>next_state   none <br/>state_time   Wed Jun 27 21:42:27 2018 <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_all/none svc:/network/http:apache24 (disabled)

Note the dependency on http:apache24 that has now been added to the zone service.

Now is we reboot the global zone, the testzone will not boot until we enable the http:apache24 service:

[email protected]:~# <strong>reboot<br/></strong>reboot: Halting 1 zone.<br/>  <br/>...<br/>  <br/>[email protected]:~# <strong>zoneadm list -cv<br/></strong>  ID NAME             STATUS      PATH                         BRAND      IP     <br/>   0 global           running     /                            solaris    shared <br/>   - testzone         installed   /system/zones/testzone       solaris    excl   <br/>   - webzone-1        installed   /system/zones/webzone-1      solaris    excl   <br/>   - webzone-2        installed   /system/zones/webzone-2      solaris    excl   <br/>[email protected]:~# <strong>svcs -l testzone<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        offline <br/>next_state   none <br/>state_time   July 10, 2018 at  1:23:22 AM PDT <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_all/none svc:/network/http:apache24 (disabled) <br/>[email protected]:~# <strong>svcadm enable http:apache24<br/></strong>[email protected]:~# <strong>svcs -l testzone<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        offline <br/>next_state   online <br/>state_time   July 10, 2018 at  1:23:22 AM PDT <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_all/none svc:/network/http:apache24 (online) <br/> <br/>... <br/> <br/>[email protected]:~# <strong>svcs -l testzone<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        online <br/>next_state   none <br/>state_time   July 10, 2018 at  1:24:54 AM PDT <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_all/none svc:/network/http:apache24 (online)

As you can see, after the reboot initially the zone service is enabled but not online waiting for the http:apache24 service to come online. Once we enable this service the zone service next_state transitions to online and a little later the state is now online too.

Note that you can set multiple dependencies for the single zone, something we'll use at the end of this article.

Setting a Dependency on Another Zone

In this step we replace the previous dependency with one on webzone-1 as shown in Figure 3.

OTN_Pictures_DZR-3.png

Figure 3: Making the testzone dependent on webzone-1.

You can do this by simply setting a new FMRI:

[email protected]:~# <strong>zonecfg -z testzone<br/></strong>zonecfg:testzone> <strong>select smf-dependency 0<br/></strong>zonecfg:testzone:smf-dependency> <strong>info<br/></strong>smf-dependency 0: <br/>        fmri: svc:/network/http:apache24 <br/>zonecfg:testzone:smf-dependency> <strong>set name=web<br/></strong>zonecfg:testzone:smf-dependency> <strong>set fmri=svc:/system/zones/zone:webzone-1<br/></strong>zonecfg:testzone:smf-dependency> <strong>info<br/></strong>smf-dependency 0: <br/>        name: web <br/>        fmri: svc:/system/zones/zone:webzone-1 <br/>zonecfg:testzone> <strong>exit</strong>

Note we're also giving the dependency the name web, this is mostly for later when we want to group dependencies. In general it's good make sure you set a name on the dependency when you first create it.

Now we reboot the zone and then boot webzone-1 while checking for the status on testzone:

[email protected]:~# <strong>reboot<br/></strong>reboot: Halting 1 zone. <br/> <br/>...<br/>  <br/>[email protected]:~# <strong>zoneadm list -cv<br/></strong>  ID NAME             STATUS      PATH                         BRAND      IP     <br/>   0 global           running     /                            solaris    shared <br/>   - testzone         installed   /system/zones/testzone       solaris    excl   <br/>   - webzone-1        installed   /system/zones/webzone-1      solaris    excl   <br/>   - webzone-2        installed   /system/zones/webzone-2      solaris    excl   <br/>[email protected]:~# <strong>svcs -l testzone<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        offline <br/>next_state   none <br/>state_time   July 10, 2018 at  2:31:00 AM PDT <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_all/none svc:/system/zones/zone:webzone-1 (disabled) <br/>[email protected]:~# <strong>zoneadm -z webzone-1 boot<br/></strong>[email protected]:~# <strong>svcs -l testzone webzone-1<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        offline <br/>next_state   online <br/>state_time   July 10, 2018 at  2:31:00 AM PDT <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_all/none svc:/system/zones/zone:webzone-1 (online) <br/> <br/>fmri         svc:/system/zones/zone:webzone-1 <br/>name         Solaris Zone <br/>enabled      true (temporary) <br/>state        online <br/>next_state   none <br/>state_time   July 10, 2018 at  3:11:06 AM PDT <br/>logfile      /var/log/zones/webzone-1.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/> <br/>... <br/> <br/>[email protected]:~# <strong>svcs -l testzone webzone-1<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        online <br/>next_state   none <br/>state_time   July 10, 2018 at  3:11:25 AM PDT <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_all/none svc:/system/zones/zone:webzone-1 (online) <br/> <br/>fmri         svc:/system/zones/zone:webzone-1 <br/>name         Solaris Zone <br/>enabled      true (temporary) <br/>state        online <br/>next_state   none <br/>state_time   July 10, 2018 at  3:11:06 AM PDT <br/>logfile      /var/log/zones/webzone-1.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml

So once the webzone-1 is online, the testzone starts booting.

Appending the Goal Service

As stated above the state of the service representing the zone in the global zone is linked to the goal service milestone/goals running inside the zone.

OTN_Pictures_DZR-4.png

Figure 4: Setting the goal service up to be dependent on a service.

So, as shown in Figure 4, if you want make this dependent on specific services inside the zone you'll need to change the goals for this service:

[email protected]:~# <strong>zlogin webzone-1<br/></strong>[Connected to zone 'webzone-1' pts/1] <br/>Last login: Wed Jun 27 23:26:13 2018 on pts/4 <br/>Oracle Corporation      SunOS 5.11      Solaris_11/11.4/ON/production.build-11.4-26:2018-06-07  June 2018 <br/>[email protected]zone-1:~# <strong>svcs -l apache24<br/></strong>fmri         svc:/network/http:apache24 <br/>name         Apache 2.4 HTTP server <br/>enabled      false <br/>state        disabled <br/>next_state   none <br/>state_time   July 10, 2018 at  3:16:23 AM PDT <br/>logfile      /var/svc/log/network-http:apache24.log <br/>restarter    svc:/system/svc/restarter:default <br/>manifest     /lib/svc/manifest/network/http-apache24.xml <br/>dependency   optional_all/error svc:/system/filesystem/autofs:default (online) <br/>dependency   require_all/none svc:/system/filesystem/local:default (online) <br/>dependency   require_all/error svc:/milestone/network:default (online) <br/>[email protected]:~# <strong>svcs -l goals<br/></strong>fmri         svc:/milestone/goals:default <br/>name         goals services for the system <br/>enabled      true <br/>state        online <br/>next_state   none <br/>state_time   July 10, 2018 at  3:16:32 AM PDT <br/>logfile      /var/svc/log/milestone-goals:default.log <br/>restarter    svc:/system/svc/restarter:default <br/>manifest     /lib/svc/manifest/milestone/goals.xml <br/>dependency   require_all/restart svc:/milestone/multi-user-server (online) <br/>[email protected]:~# <strong>svcadm goals svc:/network/http:apache24<br/></strong>[email protected]:~# <strong>svcs -l goals<br/></strong>fmri         svc:/milestone/goals:default <br/>name         goals services for the system <br/>enabled      true <br/>state        online <br/>next_state   none <br/>state_time   July 10, 2018 at  3:16:32 AM PDT <br/>logfile      /var/svc/log/milestone-goals:default.log <br/>restarter    svc:/system/svc/restarter:default <br/>manifest     /lib/svc/manifest/milestone/goals.xml <br/>dependency   require_all/restart svc:/network/http:apache24 (disabled) <br/>[email protected]:~# <strong>exit<br/></strong>logout <br/> <br/>[Connection to zone 'webzone-1' pts/1 closed]

At this point the goal service milestone/goals is now set to only go online once the http:apache24 service is up and running.

Now if we reboot the global zone again we can see that booting the testzone waits until the http:apache24 service is up (which we didn't enable yet):

[email protected]:~# <strong>reboot<br/></strong>reboot: Halting 2 zones. <br/> <br/>... <br/> <br/>[email protected]:~# <strong>zoneadm list -cv<br/></strong>  ID NAME             STATUS      PATH                         BRAND      IP     <br/>   0 global           running     /                            solaris    shared <br/>   - testzone         installed   /system/zones/testzone       solaris    excl   <br/>   - webzone-1        installed   /system/zones/webzone-1      solaris    excl   <br/>   - webzone-2        installed   /system/zones/webzone-2      solaris    excl   <br/>[email protected]:~# <strong>zoneadm -z webzone-1 boot<br/></strong>[email protected]:~# <strong>zlogin webzone-1<br/></strong>[Connected to zone 'webzone-1' pts/1] <br/>Last login: Tue Jul 10 19:30:23 2018 on pts/1 <br/>NOTE: system has 1 active defect; run 'fmadm list' for details. <br/>Oracle Corporation      SunOS 5.11      Solaris_11/11.4/ON/production.build-11.4-26:2018-06-07  June 2018 <br/>You have new mail. <br/>[email protected]:~# <strong>svcs -xv</strong>  <br/>svc:/network/http:apache24 (Apache 2.4 HTTP server) <br/> State: disabled since July 10, 2018 at  7:33:31 PM PDT <br/>Reason: Disabled by an administrator. <br/>   See: http://support.oracle.com/msg/SMF-8000-05 <br/>   See: http://httpd.apache.org <br/>   See: man -M /usr/apache2/2.4/man -s 8 httpd <br/>   See: /var/svc/log/network-http:apache24.log <br/>Impact: 1 dependent service is not running: <br/>        svc:/milestone/goals:default <br/> <br/>svc:/milestone/goals:default (goals services for the system) <br/> State: maintenance since July 10, 2018 at  7:33:49 PM PDT <br/>Reason: goal service has dependencies that cannot be satisfied without administrative intervention. <br/>Reason: Service svc:/network/http:apache24 is disabled. <br/>   See: http://support.oracle.com/msg/SMF-8000-GE <br/>  Path: svc:/milestone/goals:default <br/>          svc:/network/http:apache24 <br/>   See: http://support.oracle.com/msg/(null) <br/>   See: man -M /usr/share/man -s 7 smf <br/>   See: man -M /usr/share/man -s 8 svcadm <br/>   See: /var/svc/log/milestone-goals:default.log<br/> Impact: This service is not running. <br/>[email protected]:~# <strong>svcadm enable http:apache24<br/></strong>[email protected]:~# <strong>exit<br/></strong>logout <br/> <br/>[Connection to zone 'webzone-1' pts/1 closed] <br/>You have new mail in /var/mail/root <br/>[email protected]:~# <strong>svcs -l testzone webzone-1<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        online <br/>next_state   none <br/>state_time   July 10, 2018 at  7:36:03 PM PDT <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_all/none svc:/system/zones/zone:webzone-1 (online) <br/> <br/>fmri         svc:/system/zones/zone:webzone-1 <br/>name         Solaris Zone <br/>enabled      true (temporary) <br/>state        online <br/>next_state   none <br/>state_time   July 10, 2018 at  7:35:44 PM PDT <br/>logfile      /var/log/zones/webzone-1.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml

You can see that both zones were in the installed state, testzone because it's waiting for webzone-1's goal service and webzone-1 because it doesn't have autoboot enabled. Once we boot webzone-1 and log in we can see the system warns that the milestone/goals service dependencies are not being met because the http:apache24 service isn't enabled. Once we enable that, the milestone is met and the testzone boots.

Setting Multiple Dependencies

Now let's say, as shown in Figure 5, the testzone is dependent on any Apache Webserver it can see, and it doesn't matter which one is up first. In other words, it doesn't care which of the webzones is up as long as one of them is.

OTN_Pictures_DZR-5.png

Figure 5: Making the testzone dependent in either webzone-1 or webzone-2.

To achieve this you only have to make some minor changes to the zone configuration:

[email protected]:~# <strong>zonecfg -z testzone<br/></strong>zonecfg:testzone> info <br/>zonename: testzone <br/>brand: solaris <br/>autoboot: true <br/>bootargs: -m verbose <br/>anet 0: <br/>        linkname: net0 <br/>        configure-allowed-address: true <br/>smf-dependency 0: <br/>        name: web <br/>        fmri: svc:/system/zones/zone:webzone-1 <br/>zonecfg:testzone> <strong>select smf-dependency 0<br/></strong>zonecfg:testzone:smf-dependency> <strong>set grouping=require_any<br/></strong>zonecfg:testzone:smf-dependency> <strong>info<br/></strong>smf-dependency 0: <br/>        name: web <br/>        fmri: svc:/system/zones/zone:webzone-1 <br/>        grouping: require_any <br/>zonecfg:testzone:smf-dependency> <strong>end<br/></strong>zonecfg:testzone> <strong>add smf-dependency<br/></strong>zonecfg:testzone:smf-dependency> <strong>set name=web<br/></strong>zonecfg:testzone:smf-dependency> <strong>set fmri=svc:/system/zones/zone:webzone-2<br/></strong>zonecfg:testzone:smf-dependency> <strong>set grouping=require_any<br/></strong>zonecfg:testzone:smf-dependency> <strong>info<br/></strong>smf-dependency 1: <br/>        name: web <br/>        fmri: svc:/system/zones/zone:webzone-2 <br/>        grouping: require_any <br/>zonecfg:testzone:smf-dependency> <strong>end<br/></strong>zonecfg:testzone> <strong>exit</strong>

By adding a second dependency, and also calling this dependency web, and setting the grouping to require_any for both dependencies they will be grouped together as one combined dependency, and the zone should now boot when either zone is booted.

Note that we're not changing the goal service milestone/goals inside webzone-2, we're assuming you can do this if you want to.

Now we reboot, and enable/boot one of the two webzones:

[email protected]:~# <strong>zoneadm list -cv<br/></strong>  ID NAME             STATUS      PATH                         BRAND      IP     <br/>   0 global           running     /                            solaris    shared <br/>   - testzone         installed   /system/zones/testzone       solaris    excl   <br/>   - webzone-1        installed   /system/zones/webzone-1      solaris    excl   <br/>   - webzone-2        installed   /system/zones/webzone-2      solaris    excl   <br/>[email protected]:~# <strong>svcs -l testzone webzone-1 webzone-2<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        offline <br/>next_state   none <br/>state_time   July 11, 2018 at  1:08:59 AM PDT <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_any/none svc:/system/zones/zone:webzone-2 (disabled) svc:/system/zones/zone:webzone-1 (disabled) <br/> <br/>fmri         svc:/system/zones/zone:webzone-1 <br/>name         Solaris Zone <br/>enabled      false <br/>state        disabled <br/>next_state   none <br/>state_time   July 11, 2018 at  1:08:59 AM PDT <br/>logfile      /var/log/zones/webzone-1.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/> <br/>fmri         svc:/system/zones/zone:webzone-2 <br/>name         Solaris Zone <br/>enabled      false <br/>state        disabled <br/>next_state   none <br/>state_time   July 11, 2018 at  1:08:59 AM PDT <br/>logfile      /var/log/zones/webzone-2.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>[email protected]:~# <strong>zoneadm -z webzone-2 boot<br/></strong>[email protected]:~# <strong>svcs -l testzone webzone-1 webzone-2<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        offline <br/>next_state   online <br/>state_time   July 11, 2018 at  1:08:59 AM PDT <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_any/none svc:/system/zones/zone:webzone-2 (online) svc:/system/zones/zone:webzone-1 (disabled) <br/> <br/>fmri         svc:/system/zones/zone:webzone-1 <br/>name         Solaris Zone <br/>enabled      false <br/>state        disabled <br/>next_state   none <br/>state_time   July 11, 2018 at  1:08:59 AM PDT <br/>logfile      /var/log/zones/webzone-1.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/> <br/>fmri         svc:/system/zones/zone:webzone-2 <br/>name         Solaris Zone <br/>enabled      true (temporary) <br/>state        online <br/>next_state   none <br/>state_time   July 11, 2018 at  1:36:52 AM PDT <br/>logfile      /var/log/zones/webzone-2.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml<br/><br/>...<br/><br/>[email protected]:~# <strong>svcs -l testzone webzone-1 webzone-2<br/></strong>fmri         svc:/system/zones/zone:testzone <br/>name         Solaris Zone <br/>enabled      true <br/>state        online <br/>next_state   none <br/>state_time   July 11, 2018 at  1:37:10 AM PDT <br/>logfile      /var/log/zones/testzone.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>dependency   require_any/none svc:/system/zones/zone:webzone-2 (online) svc:/system/zones/zone:webzone-1 (disabled) <br/> <br/>fmri         svc:/system/zones/zone:webzone-1 <br/>name         Solaris Zone <br/>enabled      false <br/>state        disabled <br/>next_state   none <br/>state_time   July 11, 2018 at  1:08:59 AM PDT <br/>logfile      /var/log/zones/webzone-1.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/> <br/>fmri         svc:/system/zones/zone:webzone-2 <br/>name         Solaris Zone <br/>enabled      true (temporary) <br/>state        online <br/>next_state   none <br/>state_time   July 11, 2018 at  1:36:52 AM PDT <br/>logfile      /var/log/zones/webzone-2.messages <br/>restarter    svc:/system/zones:default <br/>manifest     /lib/svc/manifest/system/zones.xml <br/>[email protected]:~# <strong>zoneadm list -cv<br/></strong>  ID NAME             STATUS      PATH                         BRAND      IP     <br/>   0 global           running     /                            solaris    shared <br/>   1 webzone-2        running     /system/zones/webzone-2      solaris    excl   <br/>   2 testzone         running     /system/zones/testzone       solaris    excl   <br/>   - webzone-1        installed   /system/zones/webzone-1      solaris    excl  

As you can see, after the reboot the testzone is waiting for either webzone. And once we boot webzone-2 it takes a little bit of time for it to complete it's milestones/goals goal service and once it does testzone boots.

Note that if we hadn't set the grouping to require_any SMF would have defaulted to require_all, so if that's what you want you can just omit that from the definition of the dependencies.

Conclusion

This concludes the examples in this article, here are a few additional thoughts. First, these tools allow you to easily and quickly create inter-zone dependencies to fit most of your needs. And this is especially handy in cases where a lot of smaller services are layered and dependent on each other, or if one service coming online before others is an issue.

Second, it's important to note that at this point this is single node only. So if you migrate a zone to another system and you reboot the system, if another zone is dependent on it this zone will not boot until the dependency is met. You can of course still boot the zone by hand.

Last, if you give the dependencies different names, let's say you give two dependencies the name web and two others the name firewall, and you give them all grouping=require_any, this will a create a logical AND of two ORs. That is to say, the zone will boot if either of the dependencies in with the web name are met, and either of the dependencies with the firewall name are met. It could be that you only need one webserver to be up and one firewall.

Comments