Print this page

        

@@ -126,22 +126,19 @@
                 cp = buf;
                 if (*cp == '#') {
                         /* skip comment lines */
                         continue;
                 }
-
-                /* zonename */
                 p = gettok(&cp);
                 if (*p == '\0' || strlen(p) >= ZONENAME_MAX) {
                         /*
                          * empty or very long zone names are not allowed
                          */
                         continue;
                 }
                 (void) strlcpy(ze->zone_name, p, ZONENAME_MAX);
 
-                /* state */
                 p = gettok(&cp);
                 if (*p == '\0') {
                         /* state field should not be empty */
                         continue;
                 }

@@ -154,47 +151,21 @@
                         ze->zone_state = ZONE_STATE_INSTALLED;
                 } else {
                         continue;
                 }
 
-                /* zonepath */
                 p = gettok(&cp);
                 if (strlen(p) >= MAXPATHLEN) {
                         /* very long paths are not allowed */
                         continue;
                 }
                 (void) strlcpy(ze->zone_path, p, MAXPATHLEN);
 
-                /* uuid */
                 p = gettok(&cp);
                 if (uuid_parse(p, ze->zone_uuid) == -1)
                         uuid_clear(ze->zone_uuid);
 
-                /* brand [optional] */
-                p = gettok(&cp);
-                if (strlen(p) >= MAXNAMELEN) {
-                        /* very long names are not allowed */
-                        continue;
-                }
-                (void) strlcpy(ze->zone_brand, p, MAXNAMELEN);
-
-                /* IP type [optional] */
-                p = gettok(&cp);
-                if (strlen(p) >= MAXNAMELEN) {
-                        /* very long names are not allowed */
-                        continue;
-                }
-                ze->zone_iptype = ZS_SHARED;
-                if (*p == 'e') {
-                        ze->zone_iptype = ZS_EXCLUSIVE;
-                }
-
-                /* debug ID [optional] */
-                p = gettok(&cp);
-                if (*p != '\0')
-                        ze->zone_did = atoi(p);
-
                 break;
         }
 
         return (ze);
 }

@@ -321,18 +292,16 @@
 {
         FILE *index_file, *tmp_file;
         char buf[MAX_INDEX_LEN];
         int tmp_file_desc, lock_fd, err;
         boolean_t exist, need_quotes;
-        char *cp, *tmpp;
+        char *cp;
         char tmp_path[MAXPATHLEN];
         char path[MAXPATHLEN];
         char uuidstr[UUID_PRINTABLE_STRING_LENGTH];
         size_t namelen;
-        const char *zone_name, *zone_state, *zone_path, *zone_uuid,
-            *zone_brand = "", *zone_iptype;
-        zoneid_t zone_did;
+        const char *zone_name, *zone_state, *zone_path, *zone_uuid;
 
         assert(ze != NULL);
 
         /*
          * Don't allow modification of Global Zone entry

@@ -381,13 +350,10 @@
         }
 
         exist = B_FALSE;
         zone_name = ze->zone_name;
         namelen = strlen(zone_name);
-        zone_brand = ze->zone_brand;
-        zone_iptype = (ze->zone_iptype == ZS_SHARED ? "sh" : "ex");
-        zone_did = ze->zone_did;
         for (;;) {
                 if (fgets(buf, sizeof (buf), index_file) == NULL) {
                         if (operation == PZE_ADD && !exist) {
                                 zone_state = zone_state_str(ze->zone_state);
                                 zone_path = ze->zone_path;

@@ -438,15 +404,10 @@
                         err = Z_UPDATING_INDEX;
                         goto error;
                 }
                 zone_path = gettok(&cp);
                 zone_uuid = gettok(&cp);
-                zone_brand = gettok(&cp);
-                zone_iptype = gettok(&cp);
-                tmpp = gettok(&cp);
-                if (*tmpp != '\0')
-                        zone_did = atoi(tmpp);
 
                 switch (operation) {
                 case PZE_ADD:
                         /* can't add same zone */
                         err = Z_UPDATING_INDEX;

@@ -457,39 +418,26 @@
                          * If the caller specified a new state for the zone,
                          * then use that.  Otherwise, use the current state.
                          */
                         if (ze->zone_state >= 0) {
                                 zone_state = zone_state_str(ze->zone_state);
+
+                                /*
+                                 * If the caller is uninstalling this zone,
+                                 * then wipe out the uuid.  The zone's contents
+                                 * are no longer known.
+                                 */
+                                if (ze->zone_state < ZONE_STATE_INSTALLED)
+                                        zone_uuid = "";
                         }
 
                         /* If a new name is supplied, use it. */
                         if (ze->zone_newname[0] != '\0')
                                 zone_name = ze->zone_newname;
 
                         if (ze->zone_path[0] != '\0')
                                 zone_path = ze->zone_path;
-
-                        /* If new UUID provided, replace it */
-                        if (!uuid_is_null(ze->zone_uuid)) {
-                                uuid_unparse(ze->zone_uuid, uuidstr);
-                                zone_uuid = uuidstr;
-                        }
-
-                        /* If a brand is supplied, use it. */
-                        if (ze->zone_brand[0] != '\0') {
-                                zone_brand = ze->zone_brand;
-
-                                /*
-                                 * Since the brand, iptype and did are optional,
-                                 * we we only reset the iptype and did if the
-                                 * brand is provided.
-                                 */
-                                zone_iptype = (ze->zone_iptype == ZS_SHARED ?
-                                    "sh" : "ex");
-                                zone_did = ze->zone_did;
-                        }
-
                         break;
 
                 case PZE_REMOVE:
                 default:
                         continue;

@@ -517,21 +465,13 @@
                  * names, and do not occur in zone states, and in theory should
                  * never occur in a zonepath since zonecfg does not support a
                  * method for escaping them.
                  */
                 need_quotes = (strchr(zone_path, ':') != NULL);
-
-                if (*zone_brand != '\0') {
-                        (void) fprintf(tmp_file, "%s:%s:%s%s%s:%s:%s:%s:%d\n",
-                            zone_name, zone_state, need_quotes ? "\"" : "",
-                            zone_path, need_quotes ? "\"" : "", zone_uuid,
-                            zone_brand, zone_iptype, zone_did);
-                } else {
                         (void) fprintf(tmp_file, "%s:%s:%s%s%s:%s\n", zone_name,
                             zone_state, need_quotes ? "\"" : "", zone_path,
                             need_quotes ? "\"" : "", zone_uuid);
-                }
                 exist = B_TRUE;
         }
 
         (void) fclose(index_file);
         index_file = NULL;