You can use the Logical Domains Manager to establish dependency relationships between domains. A domain that has one or more domains that depend on it is called a master domain. A domain that depends on another domain is called a slave domain.
Each slave domain can specify up to four master domains by setting the master property. For example, the pine slave domain specifies its four master domains in the following comma-separated list:
# ldm add-domain master=alpha,beta,gamma,delta pine
The alpha, beta, gamma, and delta master domains all specify a failure policy of stop.
Each master domain can specify what happens to its slave domains in the event that the master domain fails. For instance, if a master domain fails, it might require its slave domains to panic. If a slave domain has more than one master domain, each master domain must have the same failure policy. So, the first master domain to fail triggers its defined failure policy on all of its slave domains.
The master domain's failure policy is controlled by setting one of the following values to the failure-policy property:
ignore ignores any slave domains
panic panics any slave domains (similar to running the ldm panic command)
reset immediately stops and then restarts any slave domains (similar to running the ldm stop -f command and then the ldm start command)
stop stops any slave domains (similar to running the ldm stop -f command)
In this example, the master domains specify their failure policy as follows:
primary# ldm set-domain failure-policy=ignore apple primary# ldm set-domain failure-policy=panic lemon primary# ldm set-domain failure-policy=reset orange primary# ldm set-domain failure-policy=stop peach primary# ldm set-domain failure-policy=stop alpha primary# ldm set-domain failure-policy=stop beta primary# ldm set-domain failure-policy=stop gamma primary# ldm set-domain failure-policy=stop delta
You can use this mechanism to create explicit dependencies between domains. For example, a guest domain implicitly depends on the service domain to provide its virtual devices. A guest domain's I/O is blocked when the service domain on which it depends is not up and running. By defining a guest domain as a slave of its service domain, you can specify the behavior of the guest domain when its service domain goes down. When no such dependency is established, a guest domain just waits for its service domain to return to service.
For domain dependency XML examples, see Example 97.
The following examples show how to configure domain dependencies.Example 71 Configuring a Failure Policy by Using Domain Dependencies
The first command creates a master domain called twizzle. This command uses failure-policy=reset to specify that slave domains reset if the twizzle domain fails. The second command modifies a master domain called primary. This command uses failure-policy=reset to specify that slave domains reset if the primary domain fails. The third command creates a slave domain called chocktaw that depends on two master domains, twizzle and primary. The slave domain uses master=twizzle,primary to specify its master domains. In the event either the twizzle or primary domain fails, the chocktaw domain will reset.
primary# ldm add-domain failure-policy=reset twizzle primary# ldm set-domain failure-policy=reset primary primary# ldm add-domain master=twizzle,primary chocktawExample 72 Modifying a Domain to Assign a Master Domain
This example shows how to use the ldm set-domain command to modify the orange domain to assign primary as the master domain. The second command uses the ldm set-domain command to assign orange and primary as master domains for the tangerine domain. The third command lists information about all of these domains.
primary# ldm set-domain master=primary orange primary# ldm set-domain master=orange,primary tangerine primary# ldm list -o domain NAME STATE FLAGS UTIL primary active -n-cv- 0.2% SOFTSTATE Solaris running HOSTID 0x83d8b31c CONTROL failure-policy=ignore DEPENDENCY master= ------------------------------------------------------------------------------ NAME STATE FLAGS UTIL orange bound ------ HOSTID 0x84fb28ef CONTROL failure-policy=ignore DEPENDENCY master=primary ------------------------------------------------------------------------------ NAME STATE FLAGS UTIL tangerine bound ------ HOSTID 0x84f948e9 CONTROL failure-policy=ignore DEPENDENCY master=orange,primaryExample 73 Showing a Parseable Domain Listing
The following shows an example listing with parseable output:
primary# ldm list -o domain -p
The Logical Domains Manager does not permit you to create domain relationships that create a dependency cycle. A dependency cycle is a relationship between two or more domains that lead to a situation where a slave domain depends on itself or a master domain depends on one of its slave domains.
The Logical Domains Manager determines whether a dependency cycle exists before adding a dependency. The Logical Domains Manager starts at the slave domain and searches along all paths that are specified by the master array until the end of the path is reached. Any dependency cycles found along the way are reported as errors.
The following example shows how a dependency cycle might be created. The first command creates a slave domain called mohawk that specifies its master domain as primary. So, mohawk depends on primary in the dependency chain shown in the following diagram.
Figure 27 Single Domain Dependency
The second command creates a slave domain called primary that specifies its master domain as counter. So, mohawk depends on primary, which depends on counter in the dependency chain shown in the following diagram.
Figure 28 Multiple Domain Dependency
The third command attempts to create a dependency between the counter and mohawk domains, which would produce the dependency cycle shown in the following diagram.
Figure 29 Domain Dependency Cycle
The ldm set-domain command will fail with the following error message:
# ldm add-domain master=primary mohawk # ldm set-domain master=counter primary # ldm set-domain master=mohawk counter Dependency cycle detected: LDom "counter" indicates "primary" as its master