glassfish
  1. glassfish
  2. GLASSFISH-15387

restart required status is not shown correctly for clustered instances

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1_b35
    • Fix Version/s: 3.1_b36
    • Component/s: admin_gui
    • Labels:
      None

      Description

      Steps to duplicate:

      • Create and start two instance cluster

      /asadmin list-instances --long
      NAME HOST PORT PID CLUSTER STATE
      in2 localhost 8363 27098 c1 running
      in1 localhost 8107 27096 c1 running

      • Make configuration changes that need server restart

      Configurations - c1-config - Transaction Service - On Restart - check Enabled - Save.

      • Check the status reported by CLI:
        asadmin list-instances --long
        NAME HOST PORT PID CLUSTER STATE
        in2 localhost 8363 27098 c1 running; requires restart
        in1 localhost 8107 27096 c1 running; requires restart
      • Check the Status reported by Admin Console. It shows "not running" status for the two instances.

      Clusters - c1 - General - status: 2 instances "not running" (see cluster-general-status.jpg)

        Activity

        Hide
        Anissa Lam added a comment -

        We considered anything that is not in the state of "RUNNING" being stopped. For the restart-required case, the state is "REQUIRE-RESTART", thus, it was considered not running. Thats a bug.
        I am fixing it such that there will be 3 category, like whatever we got back from backend. These being running, not-running and require-restart.

        How bad is its impact? (Severity)
        Provide the misleading info to user about cluster instance status on the cluster page. Although the status for each instance is listed correctly in the instances table.

        How often does it happen? Will many users see this problem? (Frequency)
        When the cluster instance is at restart-required state, it will be shown as not-running.

        How much effort is required to fix it? (Cost)
        low. Fix is ready. svn diff provided below.

        What is the risk of fixing it and how will the risk be mitigated? (Risk)
        Fix is small. change only that 1 method that look at the state and count up the # of instance of each state.

        ~/Awork/V3/v3/admingui 607) svn diff cluster common
        Index: cluster/src/main/resources/cluster/clusterGeneral.jsf
        ===================================================================
        — cluster/src/main/resources/cluster/clusterGeneral.jsf (revision 44118)
        +++ cluster/src/main/resources/cluster/clusterGeneral.jsf (working copy)
        @@ -63,7 +63,7 @@
        gf.getChildrenNamesList(endpoint="#

        {pageSession.resourceUrl}

        /server-ref" id="ref" result="#

        {pageSession.instanceList}

        " );
        gf.listInstances(optionKeys=

        {"id"}

        optionValues={"$pageSession

        {clusterName}

        "}, statusMap="#

        {requestScope.statusMap}");
        gf.getClusterStatusSummary(statusMap ="#{requestScope.statusMap}

        " ,

        • numRunning="# {pageSession.numRunning}" numNotRunning="#{pageSession.numNotRunning}"
          + numRunning="#{pageSession.numRunning}

          " numNotRunning="#

          {pageSession.numNotRunning}" numRequireRestart="#{pageSession.numRequireRestart}"
          disableStart="#{pageSession.disableStart}" disableStop="#{pageSession.disableStop}" disableEjb="#{pageSession.disableEjb}");
          setPageSessionAttribute(key="convertToFalseList" value={ "gmsEnabled"} );
          //set the following for including buttons.inc
          @@ -176,9 +176,16 @@
          </sun:property>

          <sun:property id="instanceStatusProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n.common.status}" >
          + <if condition="#{pageSession.numNotRunning}

          ">
          + <sun:staticText id="instanceStatusStopped" text=" #

          {pageSession.numNotRunning}" />
          + "<br />
          + </if>
          + <if condition="#{pageSession.numRequireRestart}">
          + <sun:staticText id="instanceStatusRequireRestart" text="#{pageSession.numRequireRestart}" />
          + "<br />
          + </if>
          <sun:staticText id="instanceStatusRunning" text="#{pageSession.numRunning}" />
          "<br />
          - <sun:staticText id="instanceStatusStopped" text="#{pageSession.numNotRunning}

          " />
          </sun:property>
          </sun:propertySheetSection>

        Index: cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties
        ===================================================================
        — cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties (revision 44118)
        +++ cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties (working copy)
        @@ -113,8 +113,9 @@
        cluster.gmsMulticastAddressHelp=Address at which GMS listens for group events. Must be unique for each cluster.
        cluster.gmsBindInterfaceAddress=Bind Interface Address:
        cluster.gmsBindInterfaceAddressHelp=Network interface on the DAS to which GMS binds. Token must be defined in the gms-bind-interface-address property in the DAS configuration.
        -cluster.number.instance.running=

        {0} instances running
        -cluster.number.instance.notRunning={0}

        instances not running
        +cluster.number.instance.running=

        {0} instance(s) {1} running
        +cluster.number.instance.notRunning={0}

        instance(s)

        {1} stopped
        +cluster.number.instance.requireRestart={0} instance(s) {1}

        restart required

        cluster.ApplicationsTitleHelp=All instances in a cluster have the same set of deployed applications, for example, a Java EE application EAR file, a Web module WAR file, or an EJB JAR file.<br/>

        Index: common/src/main/java/org/glassfish/admingui/common/handlers/ClusterHandler.java
        ===================================================================
        — common/src/main/java/org/glassfish/admingui/common/handlers/ClusterHandler.java (revision 44118)
        +++ common/src/main/java/org/glassfish/admingui/common/handlers/ClusterHandler.java (working copy)
        @@ -66,6 +66,7 @@
        import java.util.List;
        import org.glassfish.admingui.common.util.GuiUtil;
        import org.glassfish.admingui.common.util.RestUtil;
        +import org.glassfish.api.admin.InstanceState;

        public class ClusterHandler {

        @@ -85,6 +86,7 @@
        output = {
        @HandlerOutput(name = "numRunning", type = String.class),
        @HandlerOutput(name = "numNotRunning", type = String.class),
        + @HandlerOutput(name = "numRequireRestart", type = String.class),
        @HandlerOutput(name = "disableStart", type = Boolean.class),
        @HandlerOutput(name = "disableStop", type = Boolean.class),
        @HandlerOutput(name = "disableEjb", type = Boolean.class)
        @@ -93,22 +95,36 @@
        Map statusMap = (Map) handlerCtx.getInputValue("statusMap");
        int running=0;
        int notRunning=0;
        + int requireRestart=0;
        + int unknown = 0;
        try{
        -
        for (Iterator it=statusMap.values().iterator(); it.hasNext(); ) {
        Object value = it.next();

        • if (value.toString().equals(RUNNING))
          Unknown macro: {+ if (value.toString().equals(InstanceState.StateType.RUNNING.getDescription())){ running++; - }else{ + }else+ if (value.toString().equals(InstanceState.StateType.NOT_RUNNING.getDescription())){ notRunning++; + }else+ if (value.toString().equals(InstanceState.StateType.RESTART_REQUIRED.getDescription())){ + requireRestart++; + }else { + unknown++; + GuiUtil.getLogger().severe("Unknown Status"); } }

        handlerCtx.setOutputValue("disableEjb", (notRunning > 0) ? false :true); //refer to bug#6342445
        handlerCtx.setOutputValue("disableStart", (notRunning > 0) ? false :true);

        • handlerCtx.setOutputValue("disableStop", (running > 0) ? false :true);
        • handlerCtx.setOutputValue( "numRunning" , GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.number.instance.running", new String[] {""+running}

          ));

        • handlerCtx.setOutputValue( "numNotRunning" , GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.number.instance.notRunning", new String[] {""+notRunning}

          ));
          + handlerCtx.setOutputValue("disableStop", ( (running+requireRestart) > 0) ? false :true);
          + handlerCtx.setOutputValue( "numRunning" , (running > 0) ?
          + GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.number.instance.running", new String[]

          {""+running, GuiUtil.getCommonMessage("status.image.RUNNING")}

          ) : "");
          +
          + handlerCtx.setOutputValue( "numNotRunning" , (notRunning > 0) ?
          + GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.number.instance.notRunning", new String[]

          {""+notRunning , GuiUtil.getCommonMessage("status.image.NOT_RUNNING")}

          ) : "");
          +
          + handlerCtx.setOutputValue( "numRequireRestart" , (requireRestart > 0) ?
          + GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.number.instance.requireRestart", new String[]

          {""+requireRestart, GuiUtil.getCommonMessage("status.image.REQUIRES_RESTART")}

          ) : "");
          }catch(Exception ex){
          handlerCtx.setOutputValue("numRunning", GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.status.unknown"));
          GuiUtil.getLogger().info(GuiUtil.getCommonMessage("log.error.getClusterStatusSummary") + ex.getLocalizedMessage());

        Show
        Anissa Lam added a comment - We considered anything that is not in the state of "RUNNING" being stopped. For the restart-required case, the state is "REQUIRE-RESTART", thus, it was considered not running. Thats a bug. I am fixing it such that there will be 3 category, like whatever we got back from backend. These being running, not-running and require-restart. How bad is its impact? (Severity) Provide the misleading info to user about cluster instance status on the cluster page. Although the status for each instance is listed correctly in the instances table. How often does it happen? Will many users see this problem? (Frequency) When the cluster instance is at restart-required state, it will be shown as not-running. How much effort is required to fix it? (Cost) low. Fix is ready. svn diff provided below. What is the risk of fixing it and how will the risk be mitigated? (Risk) Fix is small. change only that 1 method that look at the state and count up the # of instance of each state. ~/Awork/V3/v3/admingui 607) svn diff cluster common Index: cluster/src/main/resources/cluster/clusterGeneral.jsf =================================================================== — cluster/src/main/resources/cluster/clusterGeneral.jsf (revision 44118) +++ cluster/src/main/resources/cluster/clusterGeneral.jsf (working copy) @@ -63,7 +63,7 @@ gf.getChildrenNamesList(endpoint="# {pageSession.resourceUrl} /server-ref" id="ref" result="# {pageSession.instanceList} " ); gf.listInstances(optionKeys= {"id"} optionValues={"$pageSession {clusterName} "}, statusMap="# {requestScope.statusMap}"); gf.getClusterStatusSummary(statusMap ="#{requestScope.statusMap} " , numRunning="# {pageSession.numRunning}" numNotRunning="#{pageSession.numNotRunning}" + numRunning="#{pageSession.numRunning} " numNotRunning="# {pageSession.numNotRunning}" numRequireRestart="#{pageSession.numRequireRestart}" disableStart="#{pageSession.disableStart}" disableStop="#{pageSession.disableStop}" disableEjb="#{pageSession.disableEjb}"); setPageSessionAttribute(key="convertToFalseList" value={ "gmsEnabled"} ); //set the following for including buttons.inc @@ -176,9 +176,16 @@ </sun:property> <sun:property id="instanceStatusProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n.common.status}" > + <if condition="#{pageSession.numNotRunning} "> + <sun:staticText id="instanceStatusStopped" text=" # {pageSession.numNotRunning}" /> + "<br /> + </if> + <if condition="#{pageSession.numRequireRestart}"> + <sun:staticText id="instanceStatusRequireRestart" text="#{pageSession.numRequireRestart}" /> + "<br /> + </if> <sun:staticText id="instanceStatusRunning" text="#{pageSession.numRunning}" /> "<br /> - <sun:staticText id="instanceStatusStopped" text="#{pageSession.numNotRunning} " /> </sun:property> </sun:propertySheetSection> Index: cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties =================================================================== — cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties (revision 44118) +++ cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties (working copy) @@ -113,8 +113,9 @@ cluster.gmsMulticastAddressHelp=Address at which GMS listens for group events. Must be unique for each cluster. cluster.gmsBindInterfaceAddress=Bind Interface Address: cluster.gmsBindInterfaceAddressHelp=Network interface on the DAS to which GMS binds. Token must be defined in the gms-bind-interface-address property in the DAS configuration. -cluster.number.instance.running= {0} instances running -cluster.number.instance.notRunning={0} instances not running +cluster.number.instance.running= {0} instance(s) {1} running +cluster.number.instance.notRunning={0} instance(s) {1} stopped +cluster.number.instance.requireRestart={0} instance(s) {1} restart required cluster.ApplicationsTitleHelp=All instances in a cluster have the same set of deployed applications, for example, a Java EE application EAR file, a Web module WAR file, or an EJB JAR file.<br/> Index: common/src/main/java/org/glassfish/admingui/common/handlers/ClusterHandler.java =================================================================== — common/src/main/java/org/glassfish/admingui/common/handlers/ClusterHandler.java (revision 44118) +++ common/src/main/java/org/glassfish/admingui/common/handlers/ClusterHandler.java (working copy) @@ -66,6 +66,7 @@ import java.util.List; import org.glassfish.admingui.common.util.GuiUtil; import org.glassfish.admingui.common.util.RestUtil; +import org.glassfish.api.admin.InstanceState; public class ClusterHandler { @@ -85,6 +86,7 @@ output = { @HandlerOutput(name = "numRunning", type = String.class), @HandlerOutput(name = "numNotRunning", type = String.class), + @HandlerOutput(name = "numRequireRestart", type = String.class), @HandlerOutput(name = "disableStart", type = Boolean.class), @HandlerOutput(name = "disableStop", type = Boolean.class), @HandlerOutput(name = "disableEjb", type = Boolean.class) @@ -93,22 +95,36 @@ Map statusMap = (Map) handlerCtx.getInputValue("statusMap"); int running=0; int notRunning=0; + int requireRestart=0; + int unknown = 0; try{ - for (Iterator it=statusMap.values().iterator(); it.hasNext(); ) { Object value = it.next(); if (value.toString().equals(RUNNING)) Unknown macro: {+ if (value.toString().equals(InstanceState.StateType.RUNNING.getDescription())){ running++; - }else{ + }else+ if (value.toString().equals(InstanceState.StateType.NOT_RUNNING.getDescription())){ notRunning++; + }else+ if (value.toString().equals(InstanceState.StateType.RESTART_REQUIRED.getDescription())){ + requireRestart++; + }else { + unknown++; + GuiUtil.getLogger().severe("Unknown Status"); } } handlerCtx.setOutputValue("disableEjb", (notRunning > 0) ? false :true); //refer to bug#6342445 handlerCtx.setOutputValue("disableStart", (notRunning > 0) ? false :true); handlerCtx.setOutputValue("disableStop", (running > 0) ? false :true); handlerCtx.setOutputValue( "numRunning" , GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.number.instance.running", new String[] {""+running} )); handlerCtx.setOutputValue( "numNotRunning" , GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.number.instance.notRunning", new String[] {""+notRunning} )); + handlerCtx.setOutputValue("disableStop", ( (running+requireRestart) > 0) ? false :true); + handlerCtx.setOutputValue( "numRunning" , (running > 0) ? + GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.number.instance.running", new String[] {""+running, GuiUtil.getCommonMessage("status.image.RUNNING")} ) : ""); + + handlerCtx.setOutputValue( "numNotRunning" , (notRunning > 0) ? + GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.number.instance.notRunning", new String[] {""+notRunning , GuiUtil.getCommonMessage("status.image.NOT_RUNNING")} ) : ""); + + handlerCtx.setOutputValue( "numRequireRestart" , (requireRestart > 0) ? + GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.number.instance.requireRestart", new String[] {""+requireRestart, GuiUtil.getCommonMessage("status.image.REQUIRES_RESTART")} ) : ""); }catch(Exception ex){ handlerCtx.setOutputValue("numRunning", GuiUtil.getMessage(CLUSTER_RESOURCE_NAME, "cluster.status.unknown")); GuiUtil.getLogger().info(GuiUtil.getCommonMessage("log.error.getClusterStatusSummary") + ex.getLocalizedMessage());
        Hide
        sirajg added a comment -

        Changes look good

        Show
        sirajg added a comment - Changes look good
        Hide
        Anissa Lam added a comment -

        Fix checked in on 12/30/2010.

        Project: glassfish
        Repository: svn
        Revision: 44163
        Author: anilam
        Date: 2010-12-30 18:22:31 UTC
        Link:

        Log Message:
        ------------
        GLASSFISH-15387. Fix the status summary in the Cluster General page.
        Approver: Anissa
        Reviewer: Siraj. Paul reviewed the status phrase.

        Revisions:
        ----------
        44163

        Modified Paths:
        ---------------
        trunk/v3/admingui/cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties
        trunk/v3/admingui/common/src/main/java/org/glassfish/admingui/common/handlers/ClusterHandler.java
        trunk/v3/admingui/cluster/src/main/resources/cluster/clusterGeneral.jsf

        Show
        Anissa Lam added a comment - Fix checked in on 12/30/2010. Project: glassfish Repository: svn Revision: 44163 Author: anilam Date: 2010-12-30 18:22:31 UTC Link: Log Message: ------------ GLASSFISH-15387 . Fix the status summary in the Cluster General page. Approver: Anissa Reviewer: Siraj. Paul reviewed the status phrase. Revisions: ---------- 44163 Modified Paths: --------------- trunk/v3/admingui/cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties trunk/v3/admingui/common/src/main/java/org/glassfish/admingui/common/handlers/ClusterHandler.java trunk/v3/admingui/cluster/src/main/resources/cluster/clusterGeneral.jsf
        Hide
        Harshad Vilekar added a comment -

        Verified: 3.1 build 40 promoted.

        Show
        Harshad Vilekar added a comment - Verified: 3.1 build 40 promoted.

          People

          • Assignee:
            Anissa Lam
            Reporter:
            Harshad Vilekar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: