brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #435: BROOKLYN-325: alert if provisioning/termi...
Date Wed, 16 Nov 2016 07:22:16 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/435#discussion_r88180158
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicEntityRebindSupport.java
---
    @@ -245,14 +249,52 @@ protected void instanceRebind(AbstractBrooklynObject instance) {
             Preconditions.checkState(instance == entity, "Expected %s and %s to match, but
different objects", instance, entity);
             Lifecycle expectedState = ServiceStateLogic.getExpectedState(entity);
             if (expectedState == Lifecycle.STARTING || expectedState == Lifecycle.STOPPING)
{
    -            LOG.warn("Entity {} goes on-fire because it was in state {} on rebind", entity,
expectedState);
    -            LOG.warn("not-up-indicators={}", entity.getAttribute(Attributes.SERVICE_NOT_UP_INDICATORS));
    -            ServiceStateLogic.setExpectedState(entity, Lifecycle.ON_FIRE);
    +            // If we were previously "starting" or "stopping", then those tasks will
have been 
    +            // aborted. We don't want to continue showing that state (e.g. the web-console
would
    +            // then show the it as in-progress with the "spinning" icon).
    +            // Therefore we set the entity as on-fire, and add the indicator that says
why.
    +            markTransitioningEntityOnFireOnRebind((EntityInternal) entity, expectedState);
    +        }
    +        
    +        // Clear the provisioning/termination task-state; the task will have been aborted,
so wrong to keep this state.
    +        ((EntityInternal)entity).sensors().remove(AttributesInternal.INTERNAL_PROVISIONING_TASK_STATE);
    +        ((EntityInternal)entity).sensors().remove(AttributesInternal.INTERNAL_TERMINATION_TASK_STATE);
    +        
    +        super.instanceRebind(instance);
    +    }
    +    
    +    protected void markTransitioningEntityOnFireOnRebind(EntityInternal entity, Lifecycle
expectedState) {
    +        LOG.warn("Entity {} being marked as on-fire because it was in state {} on rebind;
indicators={}", new Object[] {entity, expectedState, entity.getAttribute(Attributes.SERVICE_NOT_UP_INDICATORS)});
    +        ServiceStateLogic.setExpectedState(entity, Lifecycle.ON_FIRE);
    +        ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(
    +                entity, 
    +                "Task aborted on rebind", 
    +                "Set to on-fire (from previous expected state "+expectedState+") because
tasks aborted on rebind");
    --- End diff --
    
    Tasks get aborted during shutdown.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message