void updateHostsForTopologyRequests() {
    AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
    TopologyRequestDAO topologyRequestDAO = injector.getInstance(TopologyRequestDAO.class);
    TopologyHostRequestDAO topologyHostRequestDAO = injector.getInstance(TopologyHostRequestDAO.class);
    TopologyHostGroupDAO topologyHostGroupDAO = injector.getInstance(TopologyHostGroupDAO.class);
    Clusters clusters = ambariManagementController.getClusters();

    if (clusters != null) {
      Map<String, Cluster> clusterMap = clusters.getClusters();

      if (clusterMap != null) {

        for (Map.Entry<String, Map<String, String>> clusterHosts : hostChangesFileMap.entrySet()) {
          Long clusterId = clusterMap.get(clusterHosts.getKey()).getClusterId();
          List<TopologyRequestEntity> topologyRequestEntities = topologyRequestDAO.findByClusterId(clusterId);
          List<String> currentHostNames = new ArrayList<>();
          Map<String, String> hostMapping = clusterHosts.getValue();

          for (Map.Entry<String, String> hostPair : hostMapping.entrySet()) {
            currentHostNames.add(hostPair.getKey());
          }

          for (TopologyRequestEntity topologyRequestEntity : topologyRequestEntities) {
            TopologyLogicalRequestEntity topologyLogicalRequestEntity = topologyRequestEntity.getTopologyLogicalRequestEntity();
            Collection<TopologyHostGroupEntity> topologyHostGroupEntities = topologyRequestEntity.getTopologyHostGroupEntities();

            // update topology host infos
            if (topologyHostGroupEntities != null) {
              for (TopologyHostGroupEntity topologyHostGroupEntity : topologyHostGroupEntities) {
                Collection<TopologyHostInfoEntity> topologyHostInfoEntities = topologyHostGroupEntity.getTopologyHostInfoEntities();
                boolean updatesAvailable = false;

                for (TopologyHostInfoEntity topologyHostInfoEntity : topologyHostInfoEntities) {
                  if (currentHostNames.contains(topologyHostInfoEntity.getFqdn())) {
                    topologyHostInfoEntity.setFqdn(hostMapping.get(topologyHostInfoEntity.getFqdn()));
                    updatesAvailable = true;
                  }
                }
                if (updatesAvailable) {
                  topologyHostGroupDAO.merge(topologyHostGroupEntity);
                }
              }
            }

            // update topology host requests
            if (topologyLogicalRequestEntity != null) {
              Collection<TopologyHostRequestEntity> topologyHostRequestEntities = topologyLogicalRequestEntity.getTopologyHostRequestEntities();

              if (topologyHostRequestEntities != null) {
                for (TopologyHostRequestEntity topologyHostRequestEntity : topologyHostRequestEntities) {
                  if (currentHostNames.contains(topologyHostRequestEntity.getHostName())) {
                    topologyHostRequestEntity.setHostName(hostMapping.get(topologyHostRequestEntity.getHostName()));
                    topologyHostRequestDAO.merge(topologyHostRequestEntity);
                  }
                }
              }
            }
          }
        }
      }
    }
  }
***************************

        if (clusterEntity != null) {
          Collection<ClusterConfigEntity> clusterConfigEntities = clusterEntity.getClusterConfigEntities();
          boolean configUpdated;

          // going through all cluster configs and update property values
          ConfigFactory configFactory = injector.getInstance(ConfigFactory.class);
          for (ClusterConfigEntity clusterConfigEntity : clusterConfigEntities) {
            Config config = configFactory.createExisting(cluster, clusterConfigEntity);
            configUpdated = false;

            for (Map.Entry<String,String> property : config.getProperties().entrySet()) {
              updatedPropertyValue = replaceHosts(property.getValue(), currentHostNames, hostMapping);

              if (updatedPropertyValue != null) {
                Map<String,String> propertiesWithUpdates = config.getProperties();
                propertiesWithUpdates.put(property.getKey(), updatedPropertyValue);
                config.setProperties(propertiesWithUpdates);
                configUpdated = true;
              }
            }

            if (configUpdated) {
              hostConfigsUpdated = true;
              config.save();
            }
          }
        }
        if (hostConfigsUpdated) {
          AgentConfigsHolder agentConfigsHolder = injector.getInstance(AgentConfigsHolder.class);
          agentConfigsHolder.updateData(cluster.getClusterId(), currentHostNames.stream()
              .map(hm -> cluster.getHost(hm).getHostId()).collect(Collectors.toList()));
        }

        //******************************
      }
    }
  }

  /*
Method replaces current hosts with new hosts in propertyValue
ambari-server/src/main/java/org/apache/ambari/server/update/HostUpdateHelper.java