I am not too clear on what these STATEs in libzonecfg.h mean. The
zoneadm(1M) man page is not clear on this. One may list zones and their
"state" with zoneadm list -cv and see something like this :

[this is edited to fit into 72 chars width]
# zoneadm list -cv
  ID NAME       STATUS     PATH                   BRAND    IP
   0 global     running    /                      native   shared
   - z_001      installed  /zone/z_001            solaris8 excl
   - z_004      installed  /zone/z_004            native   shared
.
.
.
   - z_012      installed  /zone/z_012            native   shared
   - z_013      installed  /zone/z_013            native   excl
   - z_014      installed  /zone/z_014            native   shared
   - z_003      installed  /zone/z_003            native   shared
   - z_011      installed  /zone/z_011            native   shared
   - z_002      installed  /zone/z_002            native   shared
   - z_007      installed  /zone/z_007            native   shared
etc etc etc

Would be nice if that were sorted by NAME or something, but I digress.

However, at one point I saw this :

# zoneadm list -cv
  ID NAME       STATUS     PATH                   BRAND    IP
   0 global     running    /                      native   shared
   1 z_004      mounted    /zone/z_004            native   shared
   2 z_001      running    /zone/z_001            solaris8 excl
   3 z_002      running    /zone/z_002            native   shared

Note the STATUS == 'mounted' there.

I found that a STATE='ZONE_STATE_MOUNTED' zone can NOT be booted to single
user mode:

# zoneadm -z z_004 boot -- -m milestone=single-user
zoneadm: zone 'z_004': boot operation is invalid for zones in state 'mounted'
zoneadm: zone 'z_004': call to zoneadmd failed

That is caused me to go surfing into sources.

I'll go back to messing about with snv_121 but really I don't see a doc
that explains the STATUS other than the sources for zoneadm.c, zones.c and
libzonecfg.h.

In zoneadm.c I see this :

from lines 89 - 99 :

/* Reflects kernel zone entries */
typedef struct zone_entry {
        zoneid_t        zid;
        char            zname[ZONENAME_MAX];
        char            *zstate_str;
        zone_state_t    zstate_num;
        char            zbrand[MAXNAMELEN];
        char            zroot[MAXPATHLEN];
        char            zuuid[UUID_PRINTABLE_STRING_LENGTH];
        zone_iptype_t   ziptype;
} zone_entry_t;

There we see zone_state_t which seems to be defined as a uint in zoneadm.h
but far more interesting is the function z_zlist_get_current_state in
zones.c which says , more or less ( I closed the gap to the dangling
semicolon on line 1771), this :

from lines 1747 - 1786 : [ nice to have comments, btw, thank you ]
/*
 * Name:        z_zlist_get_current_state
 * Description: Determine the current kernel state of the specified zone
 * Arguments:   a_zlst - handle to zoneList_t object describing all zones
 *              a_zoneIndex - index into a_zlst of the zone to return
 * Returns:     zone_state_t
 *                      The current state of the specified zone is returned
 */

zone_state_t
z_zlist_get_current_state(zoneList_t a_zlst, int a_zoneIndex)
{
        int     i;

        /* ignore empty list */

        if (a_zlst == (zoneList_t)NULL) {
                return (ZONE_STATE_INCOMPLETE);
        }

        /* find the specified zone in the list */
        /***********************************************************
         * this would be just silly on a machine with 1000 zones   *
         * and the user runs zoneadm list -cv because near the end *
         * of the list we need to search all the way to the bottom *
         ***********************************************************/
        for (i = 0; (i != a_zoneIndex) &&
            (a_zlst[i]._zlName != (char *)NULL); i++);

        /* return error if the specified zone does not exist */

        if (a_zlst[i]._zlName == (char *)NULL) {
                return (ZONE_STATE_INCOMPLETE);
        }

        /* return selected zone's current kernel state */

        _z_echoDebug(DBG_ZONES_GET_ZONE_STATE,
            a_zlst[i]._zlName ? a_zlst[i]._zlName : "",
            a_zlst[i]._zlCurrKernelStatus);

        return (a_zlst[i]._zlCurrKernelStatus);
}

That, right there, returns the zone STATE. But what is the possible
"STATE" values?  From usr/src/head/libzonecfg.h :

#define ZONE_STATE_CONFIGURED           0
#define ZONE_STATE_INCOMPLETE           1
#define ZONE_STATE_INSTALLED            2
#define ZONE_STATE_READY                3
#define ZONE_STATE_RUNNING              4
#define ZONE_STATE_SHUTTING_DOWN        5
#define ZONE_STATE_DOWN                 6
#define ZONE_STATE_MOUNTED              7

great. I still have no idea what "MOUNTED" means.

Any thoughts on what a "MOUNTED" zone is ?

-- 
Dennis Clarke
[email protected]  <- Email related to the open source Solaris
[email protected]   <- Email related to open source for Solaris


_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to