zoneadmd.c (2b24ab6b3865caeede9eeb9db6b83e1d89dcd1ea) zoneadmd.c (628680125482a37a45c692030029fd62a600f914)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 81 unchanged lines hidden (view full) ---

90#include <unistd.h>
91#include <wait.h>
92#include <limits.h>
93#include <zone.h>
94#include <libbrand.h>
95#include <sys/brand.h>
96#include <libcontract.h>
97#include <libcontract_priv.h>
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 81 unchanged lines hidden (view full) ---

90#include <unistd.h>
91#include <wait.h>
92#include <limits.h>
93#include <zone.h>
94#include <libbrand.h>
95#include <sys/brand.h>
96#include <libcontract.h>
97#include <libcontract_priv.h>
98#include <sys/brand.h>
98#include <sys/contract/process.h>
99#include <sys/ctfs.h>
100#include <libdladm.h>
101#include <sys/dls_mgmt.h>
102
103#include <libzonecfg.h>
104#include "zoneadmd.h"
105

--- 1636 unchanged lines hidden (view full) ---

1742 if (zstate < ZONE_STATE_INCOMPLETE) {
1743 zerror(zlogp, B_FALSE,
1744 "cannot manage a zone which is in state '%s'",
1745 zone_state_str(zstate));
1746 return (1);
1747 }
1748
1749 /* Get a handle to the brand info for this zone */
99#include <sys/contract/process.h>
100#include <sys/ctfs.h>
101#include <libdladm.h>
102#include <sys/dls_mgmt.h>
103
104#include <libzonecfg.h>
105#include "zoneadmd.h"
106

--- 1636 unchanged lines hidden (view full) ---

1743 if (zstate < ZONE_STATE_INCOMPLETE) {
1744 zerror(zlogp, B_FALSE,
1745 "cannot manage a zone which is in state '%s'",
1746 zone_state_str(zstate));
1747 return (1);
1748 }
1749
1750 /* Get a handle to the brand info for this zone */
1750 if ((zone_get_brand(zone_name, brand_name, sizeof (brand_name))
1751 != Z_OK) || (bh = brand_open(brand_name)) == NULL) {
1751 if (zone_get_brand(zone_name, brand_name, sizeof (brand_name))
1752 != Z_OK) {
1752 zerror(zlogp, B_FALSE, "unable to determine zone brand");
1753 return (1);
1754 }
1753 zerror(zlogp, B_FALSE, "unable to determine zone brand");
1754 return (1);
1755 }
1755 zone_isnative = brand_is_native(bh);
1756 zone_iscluster = (strcmp(brand_name, CLUSTER_BRAND_NAME) == 0);
1756 zone_isnative = (strcmp(brand_name, NATIVE_BRAND_NAME) == 0);
1757 zone_islabeled = (strcmp(brand_name, LABELED_BRAND_NAME) == 0);
1758
1757 zone_islabeled = (strcmp(brand_name, LABELED_BRAND_NAME) == 0);
1758
1759 /*
1760 * In the alternate root environment, the only supported
1761 * operations are mount and unmount. In this case, just treat
1762 * the zone as native if it is cluster. Cluster zones can be
1763 * native for the purpose of LU or upgrade, and the cluster
1764 * brand may not exist in the miniroot (such as in net install
1765 * upgrade).
1766 */
1767 if (strcmp(brand_name, CLUSTER_BRAND_NAME) == 0) {
1768 zone_iscluster = B_TRUE;
1769 if (zonecfg_in_alt_root()) {
1770 (void) strlcpy(brand_name, NATIVE_BRAND_NAME,
1771 sizeof (brand_name));
1772 }
1773 } else {
1774 zone_iscluster = B_FALSE;
1775 }
1776
1777 if ((bh = brand_open(brand_name)) == NULL) {
1778 zerror(zlogp, B_FALSE, "unable to open zone brand");
1779 return (1);
1780 }
1781
1759 /* Get state change brand hooks. */
1760 if (brand_callback_init(bh, zone_name) == -1) {
1761 zerror(zlogp, B_TRUE,
1762 "failed to initialize brand state change hooks");
1763 brand_close(bh);
1764 return (1);
1765 }
1766

--- 296 unchanged lines hidden ---
1782 /* Get state change brand hooks. */
1783 if (brand_callback_init(bh, zone_name) == -1) {
1784 zerror(zlogp, B_TRUE,
1785 "failed to initialize brand state change hooks");
1786 brand_close(bh);
1787 return (1);
1788 }
1789

--- 296 unchanged lines hidden ---