private boolean updateHostRackInfoIfChanged(Cluster cluster, Host host, HostRequest hostRequest)
    throws AmbariException, AuthorizationException {

    Long resourceId = cluster.getResourceId();

    String hostRackInfo = host.getRackInfo();
    String requestRackInfo = hostRequest.getRackInfo();

    boolean rackChange = requestRackInfo != null && !requestRackInfo.equals(hostRackInfo);

    if (rackChange) {
      if(!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, resourceId, RoleAuthorization.HOST_ADD_DELETE_HOSTS)) {
        throw new AuthorizationException("The authenticated user is not authorized to update host rack information");
      }
      //TODO topology update

      host.setRackInfo(requestRackInfo);
    }

    return rackChange;
  }
If the rack info provided in the request differs from the rack info of the host
update the rack info of the host with the value from the host request

@param cluster The cluster to check user privileges against. User is required
               to have {@link RoleAuthorization#HOST_ADD_DELETE_HOSTS} rights on the cluster.
@param host The host of which rack information is to be updated
@param hostRequest
@return true is host was updated otherwise false
@throws AmbariException
@throws AuthorizationException
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java