2573N/A.. CDDL HEADER START
2525N/A
2573N/A.. The contents of this file are subject to the terms of the
2573N/A Common Development and Distribution License (the "License").
2573N/A You may not use this file except in compliance with the License.
2573N/A
2573N/A.. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2573N/A or http://www.opensolaris.org/os/licensing.
2573N/A See the License for the specific language governing permissions
2573N/A and limitations under the License.
2573N/A
2573N/A.. When distributing Covered Code, include this CDDL HEADER in each
2573N/A file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2573N/A If applicable, add the following below this CDDL HEADER, with the
2573N/A fields enclosed by brackets "[]" replaced with your own identifying
2573N/A information: Portions Copyright [yyyy] [name of copyright owner]
2573N/A
2573N/A.. CDDL HEADER END
2573N/A
2573N/A.. Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2573N/A
2573N/AChapter 12
2573N/A----------
2573N/A
2585N/AHandling Non-Global Zones
2585N/A.........................
2573N/A
2573N/AThis chapter describes how IPS handles zones and discusses those cases where
2573N/Apackage developers should be aware of zones.
2562N/A
2585N/A
2585N/APackaging Considerations For Non-Global Zones
2585N/A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2585N/A
2585N/ADeveloping packages which work consistently with zones usually involves little to
2585N/Ano additional work. However, a few situations call for close attention from
2562N/Adevelopers. When considering zones and packaging there are two questions which
2562N/Aneed to be answered:
2585N/A
2585N/A * Does anything in my package have an interface which crosses the boundary
2585N/A between the global zone and non-global zones?
2585N/A * How much of the package should be installed in the non-global zone?
2585N/A
2585N/ADoes The Package Cross the Global, Non-Global Zone boundary?
2585N/A````````````````````````````````````````````````````````````
2585N/A
2585N/AIf a package delivers both kernel and userland functionality, and both sides
2585N/Aof that interface must be updated accordingly, then the package must be updated
2585N/Ain any zones that contain that package whenever the package in the non-global
2585N/Azone gets updated.
2585N/A
2585N/AThis can be done using a ``parent`` dependency in the package being developed.
2585N/AIf a single package delivers both sides of the interface, then a ``parent``
2585N/Adependency on ``feature/package/dependency/self`` will ensure that the global
2585N/Azone and the non-global zones contain the same version of the package,
2585N/Apreventing version skew across the interface.
2585N/A
2585N/AThe dependency will also ensure that if the package is in a non-global zone,
2585N/Athen it is also present in the global zone.
2562N/A
2585N/AIf the interface spans multiple packages, then the package containing the
2585N/Anon-global zone side of the interface must contain a ``parent`` dependency on
2585N/Athe package which delivers the global zone side of the interface. The
2585N/A``parent`` dependency is also discussed in *Chapter 6*.
2585N/A
2585N/A
2585N/AHow Much of a Package Should Be Installed in a Non-Global Zone?
2585N/A```````````````````````````````````````````````````````````````
2585N/A
2585N/AIf the answer to this question is "all of it" (and that's typically the case)
2585N/Athen nothing needs to be done to the package to enable it to function properly.
2562N/A
2585N/AFor consumers of the package, though, it can be reassuring to see that the
2585N/Apackage author properly considered zone installation and decided that this
2585N/Apackage can function in a zone.
2562N/A
2585N/AFor that reason, developers should explicitly state that their
2585N/Apackage functions in both global and non-global zones. This is done by adding
2585N/Athe following action to the manifest::
2585N/A
2585N/A set name=variant.opensolaris.zone value=global value=nonglobal
2585N/A
2585N/AIf no content in the package can be installed in a non-global zone (for example
2585N/Aa package which only delivers kernel modules or drivers), then the package
2585N/Ashould specify that it cannot be installed in a zone. This is done by adding
2585N/Athe following action to the manifest::
2573N/A
2573N/A set name=variant.opensolaris.zone value=global
2562N/A
2585N/AIf some but not all of the content in the package can be installed in a
2585N/Anon-global zone, then take the following steps:
2573N/A
2585N/A 1. Use the following ``set`` action to state that the package can be installed
2585N/A in both global and non-global zones:
2585N/A ::
2585N/A
2585N/A set name=variant.opensolaris.zone value=global value=nonglobal
2562N/A
2585N/A 2. Identify the actions that are only relevant in either the global or
2585N/A non-global zone. The global-zone-only actions should have the attribute
2585N/A ``variant.opensolaris.zone=global``. Similarly, actions that only apply in
2585N/A non-global zones should have the attribute
2585N/A ``variant.opensolaris.zone=nonglobal``.
2585N/A
2585N/AIf a package has a ``parent`` dependency or has pieces which are different in
2585N/Aglobal and non-global zones, it's important to test that the package works as
2585N/Aexpected in the non-global zone as well as the global zone. If the package has
2585N/Aa ``parent`` dependency on itself, then the global zone should configure the
2585N/Arepository which delivers the package as one of its origins. The package should
2585N/Abe installed in the global zone first, and then in the non-global zone for
2585N/Atesting.
2562N/A
2562N/A
2585N/ATroubleshooting Zones
2585N/A~~~~~~~~~~~~~~~~~~~~~
2585N/A
2585N/AOccasionally problems might be encountered when trying to install the package in
2585N/Athe non-global zone.
2585N/A
2562N/ATypically the first steps to take to attack the problem are to ensure that the
2585N/Afollowing services are online in the global zone:
2585N/A
2585N/A * ``svc:/application/pkg/zones-proxyd:default``
2585N/A * ``svc:/application/pkg/system-repository:default``
2585N/A
2585N/Aand that the following service is online in the non-global zone:
2585N/A
2585N/A * ``svc:/application/pkg/zones-proxy-client:default``
2562N/A
2585N/AThese three services provide publisher configuration to the non-global zone and
2585N/Aa communication channel that the non-global zone can use to make requests to the
2585N/Arepositories assigned to the system publishers served from the global zone.
2585N/A
2585N/ARemember that you won't be able to update the package in the non-global zone,
2585N/Asince it has a ``parent`` dependency on itself. Initiating the update from the
2585N/Aglobal zone and allowing the linked image code in |pkg| to update the non-global
2585N/Azone is the right solution.
2585N/A
2585N/AOnce the package is installed in the non-global zone, testing its functionality
2585N/Acan begin.
2585N/A
2585N/AIf the package does not have a ``parent`` dependency on itself, then it's not
2562N/Anecessary to configure the publisher in the global zone nor install the package
2562N/Athere. Further, updating the package in the global zone will not update it in
2562N/Athe non-global zone, causing potentially unexpected results when testing the
2585N/Aolder non-global zone package.
2585N/A
2585N/AThe simplest solution in this situation is to make the publisher available to
2585N/Athe non-global zone and install and update the package from within the zone.
2573N/A
2585N/AIf the zone cannot access the publisher's repositories, then configuring the
2585N/Apublisher in the global zone will allow the ``zones-proxy-client`` and
2585N/A``system-repository`` services to proxy access to the publisher for the
2585N/Anon-global zone. In that case, it's still best to install and update
2585N/Athe package in the non-global zone.
2585N/A