private RepositoryVersionState checkAllHostComponents(StackId stackId,
      HostEntity host) throws AmbariException {

    Collection<HostComponentDesiredStateEntity> hostComponents = host.getHostComponentDesiredStateEntities();

    for (HostComponentDesiredStateEntity hostComponent : hostComponents) {
      // Skip lookup if stack does not contain the component
      if (!ami.get().isValidServiceComponent(stackId.getStackName(),
          stackId.getStackVersion(), hostComponent.getServiceName(), hostComponent.getComponentName())) {
        LOG.debug("Component not found is host stack, stack={}, version={}, service={}, component={}",
            stackId.getStackName(), stackId.getStackVersion(),
            hostComponent.getServiceName(), hostComponent.getComponentName());
        continue;
      }
      ComponentInfo ci = ami.get().getComponent(stackId.getStackName(), stackId.getStackVersion(),
          hostComponent.getServiceName(), hostComponent.getComponentName());

      if (ci.isVersionAdvertised()) {
        return null;
      }
    }

    return RepositoryVersionState.NOT_REQUIRED;
  }
Checks if all the components advertise version.  If additional states need to be
computed, add on to the logic of this method; make sure the usages are checked for
correctness.

@param stackId the stack id
@param host    the host entity to find components
@return {@code null} if there should be no state change.  non-{@code null} to change it
ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/HostVersionOutOfSyncListener.java