changeset 3979:4fa53442c9a8

6528540 "zoneadm -z <lower labeled zone> list" returns bogus complaint about "missing or invalid brand" 6531553 diagnostics for legacy drivers in stack instance need improvement
author gjelinek
date Fri, 06 Apr 2007 06:37:23 -0700
parents 2dd668007b7a
children 8bd2afbaea63
files usr/src/cmd/zoneadm/zoneadm.c usr/src/cmd/zoneadmd/vplat.c usr/src/lib/libzonecfg/common/libzonecfg.c
diffstat 3 files changed, 25 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/zoneadm/zoneadm.c	Thu Apr 05 20:34:28 2007 -0700
+++ b/usr/src/cmd/zoneadm/zoneadm.c	Fri Apr 06 06:37:23 2007 -0700
@@ -1735,7 +1735,7 @@
 		sub_usage(SHELP_LIST, CMD_LIST);
 		return (Z_USAGE);
 	}
-	if (zone_id != GLOBAL_ZONEID) {
+	if (zone_id != GLOBAL_ZONEID && !is_system_labeled()) {
 		fake_up_local_zone(zone_id, &zent);
 		/*
 		 * main() will issue a Z_NO_ZONE error if it cannot get an
--- a/usr/src/cmd/zoneadmd/vplat.c	Thu Apr 05 20:34:28 2007 -0700
+++ b/usr/src/cmd/zoneadmd/vplat.c	Fri Apr 06 06:37:23 2007 -0700
@@ -2514,8 +2514,25 @@
 
 	/* Hold the link for this zone */
 	if (dladm_hold_link(dlname, zoneid, B_FALSE) < 0) {
-		zerror(zlogp, B_TRUE, "WARNING: unable to hold network "
-		    "interface '%s'.", dlname);
+		int res, old_errno;
+		dladm_attr_t da;
+
+		/*
+		 * The following check is similar to 'dladm show-link'
+		 * to determine if this is a legacy interface.
+		 */
+		old_errno = errno;
+		res = dladm_info(dlname, &da);
+		if (res < 0 && errno == ENODEV) {
+			zerror(zlogp, B_FALSE, "WARNING: legacy network "
+			    "interface '%s'\nunsupported with an "
+			    "ip-type=exclusive configuration.", dlname);
+		} else {
+			errno = old_errno;
+			zerror(zlogp, B_TRUE, "WARNING: unable to hold network "
+			    "interface '%s'.", dlname);
+		}
+
 		(void) zone_remove_datalink(zoneid, dlname);
 		return (-1);
 	}
--- a/usr/src/lib/libzonecfg/common/libzonecfg.c	Thu Apr 05 20:34:28 2007 -0700
+++ b/usr/src/lib/libzonecfg/common/libzonecfg.c	Fri Apr 06 06:37:23 2007 -0700
@@ -5020,6 +5020,10 @@
 	 * have to ask the kernel for the information.
 	 */
 	if (myzoneid != GLOBAL_ZONEID) {
+		if (is_system_labeled()) {
+			(void) strlcpy(brandname, NATIVE_BRAND_NAME, rp_sz);
+			return (Z_OK);
+		}
 		if (zone_getattr(myzoneid, ZONE_ATTR_NAME, myzone,
 		    sizeof (myzone)) < 0)
 			return (Z_NO_ZONE);
@@ -5033,7 +5037,7 @@
 
 	if (strcmp(zone_name, "global") == NULL) {
 		(void) strlcpy(brandname, NATIVE_BRAND_NAME, rp_sz);
-		return (0);
+		return (Z_OK);
 	}
 	if ((handle = zonecfg_init_handle()) == NULL)
 		return (Z_NOMEM);