changeset 13129:f5e08a0ff14b

6969507 mount of ipkg zone in alternate root fails
author Susan Kamm-Worrell <Susan.Kamm-Worrell@Sun.COM>
date Mon, 16 Aug 2010 11:59:54 -0700
parents 4fa15249a57b
children e192495818d4
files usr/src/cmd/zoneadmd/zoneadmd.c usr/src/lib/brand/solaris10/zone/poststate.ksh usr/src/lib/brand/solaris10/zone/prestate.ksh usr/src/lib/libbrand/dtd/brand.dtd.1 usr/src/lib/libzonecfg/common/libzonecfg.c
diffstat 5 files changed, 20 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/zoneadmd/zoneadmd.c	Mon Aug 16 12:53:13 2010 -0400
+++ b/usr/src/cmd/zoneadmd/zoneadmd.c	Mon Aug 16 11:59:54 2010 -0700
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
@@ -457,12 +456,14 @@
 brand_prestatechg(zlog_t *zlogp, int state, int cmd)
 {
 	char cmdbuf[2 * MAXPATHLEN];
+	const char *altroot;
 
 	if (pre_statechg_hook[0] == '\0')
 		return (0);
 
-	if (snprintf(cmdbuf, sizeof (cmdbuf), "%s %d %d", pre_statechg_hook,
-	    state, cmd) > sizeof (cmdbuf))
+	altroot = zonecfg_get_root();
+	if (snprintf(cmdbuf, sizeof (cmdbuf), "%s %d %d %s", pre_statechg_hook,
+	    state, cmd, altroot) > sizeof (cmdbuf))
 		return (-1);
 
 	if (do_subproc(zlogp, cmdbuf, NULL) != 0)
@@ -478,12 +479,14 @@
 brand_poststatechg(zlog_t *zlogp, int state, int cmd)
 {
 	char cmdbuf[2 * MAXPATHLEN];
+	const char *altroot;
 
 	if (post_statechg_hook[0] == '\0')
 		return (0);
 
-	if (snprintf(cmdbuf, sizeof (cmdbuf), "%s %d %d", post_statechg_hook,
-	    state, cmd) > sizeof (cmdbuf))
+	altroot = zonecfg_get_root();
+	if (snprintf(cmdbuf, sizeof (cmdbuf), "%s %d %d %s", post_statechg_hook,
+	    state, cmd, altroot) > sizeof (cmdbuf))
 		return (-1);
 
 	if (do_subproc(zlogp, cmdbuf, NULL) != 0)
--- a/usr/src/lib/brand/solaris10/zone/poststate.ksh	Mon Aug 16 12:53:13 2010 -0400
+++ b/usr/src/lib/brand/solaris10/zone/poststate.ksh	Mon Aug 16 11:59:54 2010 -0700
@@ -19,9 +19,10 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
+#
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
 #
 
 . /usr/lib/brand/solaris10/common.ksh
@@ -46,6 +47,7 @@
 zonepath=$2
 state=$3
 cmd=$4
+altroot=$5		# unused at this time for s10 branded zones
 
 # If we're readying the zone, update the zone index file to look like this is
 # the global zone.
--- a/usr/src/lib/brand/solaris10/zone/prestate.ksh	Mon Aug 16 12:53:13 2010 -0400
+++ b/usr/src/lib/brand/solaris10/zone/prestate.ksh	Mon Aug 16 11:59:54 2010 -0700
@@ -19,9 +19,9 @@
 #
 # CDDL HEADER END
 #
+
 #
-# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
 #
 
 . /usr/lib/brand/solaris10/common.ksh
@@ -46,6 +46,7 @@
 zonepath=$2
 state=$3
 cmd=$4
+altroot=$5		# unused at this time for s10 branded zones
 
 # If we're not readying the zone, then just return.
 if (( $cmd == 0 )); then
--- a/usr/src/lib/libbrand/dtd/brand.dtd.1	Mon Aug 16 12:53:13 2010 -0400
+++ b/usr/src/lib/libbrand/dtd/brand.dtd.1	Mon Aug 16 11:59:54 2010 -0700
@@ -519,6 +519,8 @@
 			0 - ready
 			1 - boot
 			4 - halt
+      3rd arg   Alternate root (zonepath is mounted under this root)
+			empty string if zone not mounted under alternate root
 -->
 <!ELEMENT prestatechange	(#PCDATA) >
 <!ATTLIST prestatechange>
@@ -534,7 +536,7 @@
 
       %z	Name of zone
       %R	Zonepath of zone
-    See prestatechange comment for 1st and 2nd argument values.
+    See prestatechange comment for 1st, 2nd and 3rd argument values.
 -->
 <!ELEMENT poststatechange	(#PCDATA) >
 <!ATTLIST poststatechange>
--- a/usr/src/lib/libzonecfg/common/libzonecfg.c	Mon Aug 16 12:53:13 2010 -0400
+++ b/usr/src/lib/libzonecfg/common/libzonecfg.c	Mon Aug 16 11:59:54 2010 -0700
@@ -238,6 +238,7 @@
  * Set the root (/) path for all zonecfg configuration files.  This is a
  * private interface used by Live Upgrade extensions to access zone
  * configuration inside mounted alternate boot environments.
+ * This interface is also used by zoneadm mount and unmount subcommands.
  */
 void
 zonecfg_set_root(const char *rootpath)