module          max_number_in_system
------          --------------------
disk                22

    system_attribute    values
    ----------------    ------
    condition           offline, initialising, online, broken
    initialised         yes, no
    tryonline           no, yes

    user_attribute      values
    --------------      ------
    location            NULL, t0, t1, \
			d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10 \
			d11, d12, d13, d14, d15, d16, d17, d18, d19
    type                0024, 0025, 0026, 0246, 0320
    revision            A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, \
			Q, R, S, T, U, V, W, X, Y, Z, ZZ
    req_condition       offline, online
    fault_acknowledged  no, yes
    description         "hard disk drive"
    alias		string

    constituent         values
    -----------         ------
    controller          null 0, \
			sec 0, sec 1, sec 2, sec 3, sec 4, \
			sec 5, sec 6, sec 7, sec 8, sec 9, \
			sec 10, sec 11, sec 12, sec 13, sec 14, sec 15

    state               function
    -----               --------
    not_here            if (location == NULL)
    uninitialised       if (controller->state == uninitialised || \
			  initialised == no)
    inaccessible        if (controller->state != online)
    offline             if (condition == offline && req_condition == offline)
    should_be_up        if (condition == offline && req_condition == online \
                        && tryonline == yes)
    should_be_on        if (condition == offline && req_condition == online)
    should_be_on_inz    if (condition == initialising && req_condition == online)
    should_be_off_inz   if (condition == initialising && req_condition == offline)
    online              if (condition == online && req_condition == online)
    should_be_off       if ((condition == online || condition == broken) && req_condition == offline)
    broken		if (condition == broken && req_condition == online)


    transition      response
    ----------      --------

# ========================= INACCESSIBLE TRANSITIONS =========================

    inaccessible -> uninitialised \
        echo "$name $number tryonline yes" > /dev/FTlog:cms

# no action:
#   accessible -> offline ;
#   accessible -> should_be_off_inz ;
#   accessible -> should_be_off ;
#   accessible -> should_be_on_inz ;
#   accessible -> online ;

# ====================== OFFLINE TRANSITIONS ===============================

    offline -> should_be_on \
        echo "$name $number initialised no" > /dev/FTlog:cms ; \
   /etc/cms/bin/slotctl $controller->location set chgme on \
     loc $location ; \
   if /etc/cms/bin/right_module $name $location $controller->location $type$revision ; \
   then \
            /etc/cms/bin/poweron $location $controller->location ; \
            sleep 3 ; \
            CON_NAME=$controller->name ; \
            CON_NUMBER=$controller->number ; \
            /etc/cms/bin/scsictl make $name$number: diskmod on \
              $$CON_NAME$$CON_NUMBER loc $location;\
            /etc/cms/bin/scsictl send $name$number online; \
     else \
         echo "$name $number condition offline <R1000d>module of required type/revision not present" >/dev/FTlog:cms; \
   fi ; \
   echo "$name $number initialised yes" > /dev/FTlog:cms ;
# no action:
#   fline -> should_be_off_inz ;

# ====================== UNINITIALISED TRANSITIONS =========================

    uninitialised -> offline \
        echo "$name $number tryonline no" > /dev/FTlog:cms ;

    uninitialised -> should_be_off \
        echo "$name $number tryonline no" > /dev/FTlog:cms ;

    uninitialised -> online \
        echo "$name $number tryonline no" > /dev/FTlog:cms ; \
        /etc/cms/bin/sysconfig -m $name -n $number \
     -a fault_acknowledged -v no ;

    uninitialised -> should_be_on \
        if /etc/cms/bin/right_module $name $location $controller->location $type$revision ; \
   then \
            /etc/cms/bin/slotctl $controller->location set power off \
        loc $location ; \
            /etc/cms/bin/slotctl $controller->location set chgme on \
        loc $location ; \
        else \
            echo "$name $number condition offline <R1000d>module of required type/revision not present" >/dev/FTlog:cms; \
   fi ;

    uninitialised -> should_be_up \
        echo "$name $number initialised no" > /dev/FTlog:cms ; \
    echo "$name $number tryonline no" > /dev/FTlog:cms ; \
        /etc/cms/bin/slotctl $controller->location set chgme on \
     loc $location ; \
   if /etc/cms/bin/right_module $name $location $controller->location $type$revision ; \
   then \
            /etc/cms/bin/poweron $location $controller->location ; \
            sleep 3 ; \
            CON_NAME=$controller->name ; \
            CON_NUMBER=$controller->number ; \
            /etc/cms/bin/scsictl make $name$number: diskmod on \
              $$CON_NAME$$CON_NUMBER loc $location;\
            /etc/cms/bin/scsictl send $name$number online; \
     else \
         echo "$name $number condition offline <R1000d>module of required type/revision not present" >/dev/FTlog:cms; \
   fi ; \
   echo "$name $number initialised yes" > /dev/FTlog:cms ;

# ========================== ONLINE TRANSITIONS ============================

    online -> should_be_off \
        /etc/cms/bin/slotctl $controller->location set chgme on \
     loc $location ; \
   /etc/cms/bin/scsictl send $name$number offline

    online -> should_be_on \
        /etc/cms/bin/slotctl $controller->location set power off \
     loc $location ; \
   /etc/cms/bin/slotctl $controller->location set chgme on \
     loc $location ; \
   /etc/cms/bin/moduleinfo -e failure \
     -l $location -p $controller->location ; \
   /etc/cms/bin/phonehome $name $number $location $laststate $state ;

    online -> broken \
        /etc/cms/bin/slotctl $controller->location set chgme on \
     loc $location ;


# ===================== SHOULD_BE_OFF TRANSITIONS ==========================

    should_be_off -> online \
        /etc/cms/bin/sysconfig -m $name -n $number \
     -a fault_acknowledged -v no ;

    should_be_off -> offline \
        /etc/cms/bin/slotctl $controller->location set power off \
     loc $location ; \
   /etc/cms/bin/slotctl $controller->location set chgme off \
     loc $location ; \
   /etc/cms/bin/scsictl del $name$number ;

# ===================== SHOULD_BE_OFF_INZ TRANSITIONS ======================

    should_be_off_inz -> offline \
        /etc/cms/bin/slotctl $controller->location set power off \
     loc $location ; \
   /etc/cms/bin/slotctl $controller->location set chgme off \
     loc $location ; \
   /etc/cms/bin/scsictl del $name$number ;

# no action:
#   ould_be_off_inz -> should_be_on_inz ;
#   ould_be_off_inz -> should_be_off ;


# ==================== SHOULD_BE_ON TRANSITIONS ============================

    should_be_on -> offline \
        /etc/cms/bin/slotctl $controller->location set power off \
     loc $location ; \
   /etc/cms/bin/slotctl $controller->location set chgme off \
     loc $location ; \
   /etc/cms/bin/scsictl del $name$number ;

    should_be_on -> online \
        /etc/cms/bin/sysconfig -m $name -n $number \
     -a fault_acknowledged -v no ;

# no action:
#   ould_be_on -> should_be_on_inz ;

# =================== BROKEN TRANSITIONS ===================================

    broken -> online \
        /etc/cms/bin/slotctl $controller->location set chgme off \
     loc $location ;

    broken -> should_be_off \
        /etc/cms/bin/scsictl send $name$number offline


