|
@@ -23,6 +23,8 @@ import com.google.inject.Inject;
|
|
|
import org.apache.ambari.server.AmbariException;
|
|
|
import org.apache.ambari.server.actionmanager.HostRoleCommand;
|
|
|
import org.apache.ambari.server.api.predicate.InvalidQueryException;
|
|
|
+import org.apache.ambari.server.controller.internal.BaseClusterRequest;
|
|
|
+import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
|
|
|
import org.apache.ambari.server.orm.dao.HostDAO;
|
|
|
import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
|
|
|
import org.apache.ambari.server.orm.dao.TopologyHostGroupDAO;
|
|
@@ -97,7 +99,7 @@ public class PersistedStateImpl implements PersistedState {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public PersistedTopologyRequest persistTopologyRequest(TopologyRequest request) {
|
|
|
+ public PersistedTopologyRequest persistTopologyRequest(BaseClusterRequest request) {
|
|
|
TopologyRequestEntity requestEntity = toEntity(request);
|
|
|
topologyRequestDAO.create(requestEntity);
|
|
|
return new PersistedTopologyRequest(requestEntity.getId(), request);
|
|
@@ -178,6 +180,9 @@ public class PersistedStateImpl implements PersistedState {
|
|
|
if (clusterTopology == null) {
|
|
|
try {
|
|
|
clusterTopology = new ClusterTopologyImpl(ambariContext, replayedRequest);
|
|
|
+ if (entity.getProvisionAction() != null) {
|
|
|
+ clusterTopology.setProvisionAction(entity.getProvisionAction());
|
|
|
+ }
|
|
|
topologyRequests.put(replayedRequest.getClusterId(), clusterTopology);
|
|
|
allRequests.put(clusterTopology, new ArrayList<LogicalRequest>());
|
|
|
} catch (InvalidTopologyException e) {
|
|
@@ -211,7 +216,7 @@ public class PersistedStateImpl implements PersistedState {
|
|
|
return allRequests;
|
|
|
}
|
|
|
|
|
|
- private TopologyRequestEntity toEntity(TopologyRequest request) {
|
|
|
+ private TopologyRequestEntity toEntity(BaseClusterRequest request) {
|
|
|
TopologyRequestEntity entity = new TopologyRequestEntity();
|
|
|
|
|
|
//todo: this isn't set for a scaling operation because we had intended to allow multiple
|
|
@@ -227,6 +232,10 @@ public class PersistedStateImpl implements PersistedState {
|
|
|
entity.setClusterProperties(propertiesAsString(request.getConfiguration().getProperties()));
|
|
|
entity.setDescription(request.getDescription());
|
|
|
|
|
|
+ if (request.getProvisionAction() != null) {
|
|
|
+ entity.setProvisionAction(request.getProvisionAction());
|
|
|
+ }
|
|
|
+
|
|
|
// host groups
|
|
|
Collection<TopologyHostGroupEntity> hostGroupEntities = new ArrayList<TopologyHostGroupEntity>();
|
|
|
for (HostGroupInfo groupInfo : request.getHostGroupInfo().values()) {
|