# HG changeset patch # User td153743 # Date 1180507273 25200 # Node ID cd92987240fb71e4f8af4e4d826a28e5a7521a49 # Parent 53be14f175bd90ec0a93a4feaef1317c8365b140 PSARC 2007/304 "cluster" Brand Zone 6556949 zoneadm mount/unmount command should work for cluster branded zones diff -r 53be14f175bd -r cd92987240fb usr/src/cmd/zoneadm/zoneadm.c --- a/usr/src/cmd/zoneadm/zoneadm.c Tue May 29 23:14:26 2007 -0700 +++ b/usr/src/cmd/zoneadm/zoneadm.c Tue May 29 23:41:13 2007 -0700 @@ -99,9 +99,12 @@ zone_iptype_t ziptype; } zone_entry_t; +#define CLUSTER_BRAND_NAME "cluster" + static zone_entry_t *zents; static size_t nzents; static boolean_t is_native_zone = B_TRUE; +static boolean_t is_cluster_zone = B_FALSE; #define LOOPBACK_IF "lo0" #define SOCKET_AF(af) (((af) == AF_UNSPEC) ? AF_INET : (af)) @@ -1625,7 +1628,7 @@ (void) zone_getattr(zid, ZONE_ATTR_ROOT, zeptr->zroot, sizeof (zeptr->zroot)); (void) strlcpy(zeptr->zbrand, NATIVE_BRAND_NAME, - sizeof (zeptr->zbrand)); + sizeof (zeptr->zbrand)); } else { (void) strlcpy(zeptr->zroot, "/", sizeof (zeptr->zroot)); (void) zone_getattr(zid, ZONE_ATTR_BRAND, zeptr->zbrand, @@ -1963,7 +1966,7 @@ return (Z_ERR); } - if (!is_native_zone && cmd_num == CMD_MOUNT) { + if (!is_native_zone && !is_cluster_zone && cmd_num == CMD_MOUNT) { zerror(gettext("%s operation is invalid for branded zones."), cmd_to_str(cmd_num)); return (Z_ERR); @@ -2869,8 +2872,8 @@ print_net_err(nwiftab.zone_nwif_physical, nwiftab.zone_nwif_address, af, zonecfg_strerror(res)); - return_code = Z_ERR; - continue; + return_code = Z_ERR; + continue; } af = lifr.lifr_addr.ss_family; if (!zonecfg_ifname_exists(af, @@ -2884,9 +2887,9 @@ */ (void) fprintf(stderr, gettext("WARNING: skipping network " - "interface '%s' which may not be " - "present/plumbed in the global " - "zone.\n"), + "interface '%s' which may not be " + "present/plumbed in the global " + "zone.\n"), nwiftab.zone_nwif_physical); } break; @@ -4700,6 +4703,8 @@ exit(Z_ERR); } is_native_zone = (strcmp(target_brand, NATIVE_BRAND_NAME) == 0); + is_cluster_zone = + (strcmp(target_brand, CLUSTER_BRAND_NAME) == 0); res = verify_handle(CMD_ATTACH, local_handle, argv); @@ -5683,6 +5688,8 @@ exit(Z_ERR); } is_native_zone = (strcmp(target_brand, NATIVE_BRAND_NAME) == 0); + is_cluster_zone = + (strcmp(target_brand, CLUSTER_BRAND_NAME) == 0); } err = parse_and_run(argc - optind, &argv[optind]); diff -r 53be14f175bd -r cd92987240fb usr/src/cmd/zoneadmd/vplat.c --- a/usr/src/cmd/zoneadmd/vplat.c Tue May 29 23:14:26 2007 -0700 +++ b/usr/src/cmd/zoneadmd/vplat.c Tue May 29 23:41:13 2007 -0700 @@ -561,7 +561,7 @@ static void root_to_lu(zlog_t *zlogp, char *zroot, size_t zrootlen, boolean_t isresolved) { - assert(zone_isnative); + assert(zone_isnative || zone_iscluster); if (!isresolved && zonecfg_in_alt_root()) resolve_lofs(zlogp, zroot, zrootlen); @@ -1279,7 +1279,7 @@ FILE *fp; uuid_t uuid; - assert(zone_isnative); + assert(zone_isnative || zone_iscluster); resolve_lofs(zlogp, rootpath, rootlen); (void) snprintf(luroot, lurootlen, "%s/lu", zonepath); @@ -1733,7 +1733,7 @@ * but /dev is special and always goes at the top * so strip the trailing '/a' from the rootpath. */ - assert(zone_isnative); + assert(zone_isnative || zone_iscluster); assert(strcmp(&rootpath[slen], "/a") == 0); rootpath[slen] = '\0'; if (mount_one(zlogp, &fs_ptr[i], rootpath) != 0) @@ -4026,7 +4026,7 @@ goto error; if (mount_cmd) { - assert(zone_isnative); + assert(zone_isnative || zone_iscluster); root_to_lu(zlogp, rootpath, sizeof (rootpath), B_TRUE); /* @@ -4319,7 +4319,7 @@ { char zroot[MAXPATHLEN]; - assert(zone_isnative); + assert(zone_isnative || zone_iscluster); if (zone_get_rootpath(zone_name, zroot, sizeof (zroot)) != Z_OK) { zerror(zlogp, B_FALSE, "unable to determine zone root"); diff -r 53be14f175bd -r cd92987240fb usr/src/cmd/zoneadmd/zoneadmd.c --- a/usr/src/cmd/zoneadmd/zoneadmd.c Tue May 29 23:14:26 2007 -0700 +++ b/usr/src/cmd/zoneadmd/zoneadmd.c Tue May 29 23:41:13 2007 -0700 @@ -106,6 +106,7 @@ char *zone_name; /* zone which we are managing */ char brand_name[MAXNAMELEN]; boolean_t zone_isnative; +boolean_t zone_iscluster; static zoneid_t zone_id; zlog_t logsys; @@ -1023,7 +1024,7 @@ case Z_FORCEMOUNT: if (kernelcall) /* Invalid; can't happen */ abort(); - if (!zone_isnative) { + if (!zone_isnative && !zone_iscluster) { zerror(zlogp, B_FALSE, "%s operation is invalid for branded " "zones", z_cmd_name(cmd)); @@ -1494,6 +1495,7 @@ return (1); } zone_isnative = brand_is_native(bh); + zone_iscluster = (strcmp(brand_name, CLUSTER_BRAND_NAME) == 0); brand_close(bh); /* diff -r 53be14f175bd -r cd92987240fb usr/src/cmd/zoneadmd/zoneadmd.h --- a/usr/src/cmd/zoneadmd/zoneadmd.h Tue May 29 23:14:26 2007 -0700 +++ b/usr/src/cmd/zoneadmd/zoneadmd.h Tue May 29 23:41:13 2007 -0700 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -56,6 +56,8 @@ #define EXEC_PREFIX "exec " #define EXEC_LEN (strlen(EXEC_PREFIX)) +#define CLUSTER_BRAND_NAME "cluster" + typedef struct zlog { FILE *logfile; /* file to log to */ @@ -79,7 +81,7 @@ extern char boot_args[BOOTARGS_MAX]; extern char bad_boot_arg[BOOTARGS_MAX]; extern boolean_t zone_isnative; - +extern boolean_t zone_iscluster; extern void zerror(zlog_t *, boolean_t, const char *, ...); extern char *localize_msg(char *locale, const char *msg);