Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
226bd62
Move Setting-specific methods to Setting
adoroszlai Feb 3, 2018
8f9d495
Move HOSTGROUP_REGEX to BlueprintConfigurationProcessor
adoroszlai Feb 3, 2018
01aa3b3
Remove unused code from HostGroup
adoroszlai Feb 3, 2018
1972f5d
Move TopologyValidator into validators subpackage
adoroszlai Feb 4, 2018
15b898a
Fix warnings, typos, formatting
adoroszlai Feb 4, 2018
936ed32
Clean up StackConfigTypeValidatorTest
adoroszlai Feb 4, 2018
04031e6
Verify that all stacks in cluster topology are known
adoroszlai Feb 4, 2018
0e71c77
Add MpackInstance.getStackId
adoroszlai Feb 5, 2018
e87b3cc
Eliminate mpack-parser duplication in ProvisionClusterRequest
adoroszlai Feb 5, 2018
1dcfd70
Promote StackFactory to top-level
adoroszlai Feb 5, 2018
51147a0
Eliminate static injection in BlueprintFactory
adoroszlai Feb 5, 2018
d5347f6
Remove unused dependencyConditionalServiceMap
adoroszlai Feb 6, 2018
31a860f
Blueprint does not know about services
adoroszlai Feb 6, 2018
9e53843
Set blueprint config's parent; simplify security config validation
adoroszlai Feb 12, 2018
a2cead9
Resolve components
adoroszlai Feb 13, 2018
1568c17
Combine Blueprint and ProvisionClusterRequest
adoroszlai Feb 13, 2018
303662c
Add Freebuilder
adoroszlai Feb 14, 2018
e3fbb9d
Use FreeBuilder for ResolvedComponent
adoroszlai Feb 15, 2018
a179dc1
Use ResolvedComponent for host component creation
adoroszlai Feb 20, 2018
53d64d5
Workaround for missing default cluster settings
adoroszlai Feb 20, 2018
1516b06
Avoid storing null-null as StackId
adoroszlai Feb 22, 2018
07dcdea
Remove unused code
adoroszlai Feb 22, 2018
fa03d29
Merge remote-tracking branch 'origin/branch-feature-AMBARI-14714' int…
adoroszlai Feb 22, 2018
a79dd88
Merge remote-tracking branch 'origin/branch-feature-AMBARI-14714' int…
adoroszlai Feb 23, 2018
9859d74
Address review comments (simplify, document)
adoroszlai Feb 23, 2018
32707c7
Merge remote-tracking branch 'origin/branch-feature-AMBARI-14714' int…
adoroszlai Feb 23, 2018
368ddf7
Merge remote-tracking branch 'origin/branch-feature-AMBARI-14714' int…
adoroszlai Feb 26, 2018
bab0e10
Merge remote-tracking branch 'origin/branch-feature-AMBARI-14714' int…
adoroszlai Feb 27, 2018
4c1d6dd
Merge remote-tracking branch 'origin/branch-feature-AMBARI-14714' int…
adoroszlai Feb 28, 2018
6fcdbc1
Fix unit tests
adoroszlai Feb 28, 2018
9be4a6a
Log level back to debug
adoroszlai Feb 28, 2018
c9277c7
Merge remote-tracking branch 'origin/branch-feature-AMBARI-14714' int…
adoroszlai Feb 28, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ambari-project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,13 @@
<artifactId>swagger-maven-plugin</artifactId>
<version>${swagger.maven.plugin.version}</version>
</dependency>
<dependency>
<groupId>org.inferred</groupId>
<artifactId>freebuilder</artifactId>
<version>1.14.8</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
Expand Down
4 changes: 4 additions & 0 deletions ambari-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,10 @@
<version>0.1.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.inferred</groupId>
<artifactId>freebuilder</artifactId>
</dependency>
</dependencies>

<pluginRepositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private Resource createBlueprintResource(TreeNode<Resource> clusterNode) {
BlueprintConfigurationProcessor configProcessor = new BlueprintConfigurationProcessor(topology);
configProcessor.doUpdateForBlueprintExport();

Set<StackId> stackIds = topology.getBlueprint().getStackIds();
Set<StackId> stackIds = topology.getStackIds();
if (stackIds.size() == 1) {
StackId stackId = Iterables.getOnlyElement(stackIds);
blueprintResource.setProperty("Blueprints/stack_name", stackId.getStackName());
Expand All @@ -210,8 +210,7 @@ private Resource createBlueprintResource(TreeNode<Resource> clusterNode) {

try {
String clusterName = topology.getAmbariContext().getClusterName(topology.getClusterId());
Map<String, Object> kerberosDescriptor = getKerberosDescriptor(topology.getAmbariContext()
.getClusterController(), clusterName);
Map<String, Object> kerberosDescriptor = getKerberosDescriptor(AmbariContext.getClusterController(), clusterName);
if (kerberosDescriptor != null) {
securityConfigMap.put(SecurityConfigurationFactory.KERBEROS_DESCRIPTOR_PROPERTY_ID, kerberosDescriptor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,13 +719,20 @@ public Collection<StackInfo> getStacks(String stackName) throws AmbariException
* @param stackId
* the stack id
* @return the stack info
* @throws AmbariException
*/
public StackInfo getStack(StackId stackId) throws AmbariException {
public StackInfo getStack(StackId stackId) throws StackAccessException {
return getStack(stackId.getStackName(), stackId.getStackVersion());
}

public StackInfo getStack(String stackName, String version) throws AmbariException {
public boolean isKnownStack(StackId stackId) {
try {
return getStack(stackId) != null;
} catch (StackAccessException e) {
return false;
}
}

public StackInfo getStack(String stackName, String version) throws StackAccessException {
StackInfo stackInfoResult = stackManager.getStack(stackName, version);

if (stackInfoResult == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.ValueAttributesInfo;
import org.apache.ambari.server.topology.AdvisedConfiguration;
import org.apache.ambari.server.topology.Blueprint;
import org.apache.ambari.server.topology.ClusterTopology;
import org.apache.ambari.server.topology.ConfigRecommendationStrategy;
import org.apache.ambari.server.topology.HostGroup;
Expand Down Expand Up @@ -76,7 +75,7 @@ public static void init(StackAdvisorHelper instance) {
* @param userProvidedConfigurations User configurations of cluster provided in Blueprint + Cluster template
*/
public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> userProvidedConfigurations) throws ConfigurationTopologyException {
for (StackId stackId : clusterTopology.getBlueprint().getStackIds()) {
for (StackId stackId : clusterTopology.getStackIds()) {
StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, stackId, StackAdvisorRequestType.CONFIGURATIONS);
try {
RecommendationResponse response = stackAdvisorHelper.recommend(request);
Expand All @@ -96,7 +95,7 @@ private StackAdvisorRequest createStackAdvisorRequest(ClusterTopology clusterTop
hgHostsMap);
return StackAdvisorRequest.StackAdvisorRequestBuilder
.forStack(stackId)
.forServices(clusterTopology.getBlueprint().getStack().getServices(stackId))
.forServices(clusterTopology.getStack().getServices(stackId))
.forHosts(gatherHosts(clusterTopology))
.forHostsGroupBindings(gatherHostGroupBindings(clusterTopology))
.forHostComponents(gatherHostGroupComponents(clusterTopology))
Expand Down Expand Up @@ -176,12 +175,11 @@ private void addAdvisedConfigurationsToTopology(RecommendationResponse response,

Map<String, BlueprintConfigurations> recommendedConfigurations =
response.getRecommendations().getBlueprint().getConfigurations();
Blueprint blueprint = topology.getBlueprint();

for (Map.Entry<String, BlueprintConfigurations> configEntry : recommendedConfigurations.entrySet()) {
String configType = configEntry.getKey();
// add recommended config type only if related service is present in Blueprint
if (blueprint.isValidConfigType(configType)) {
if (topology.isValidConfigType(configType)) {
BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(),
userProvidedConfigurations, topology);
topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
import org.apache.ambari.server.metrics.system.MetricsService;
import org.apache.ambari.server.orm.GuiceJpaInitializer;
import org.apache.ambari.server.orm.PersistenceType;
import org.apache.ambari.server.orm.dao.BlueprintDAO;
import org.apache.ambari.server.orm.dao.ClusterDAO;
import org.apache.ambari.server.orm.dao.GroupDAO;
import org.apache.ambari.server.orm.dao.MetainfoDAO;
Expand Down Expand Up @@ -948,7 +947,6 @@ public void performStaticInjection() {
injector.getInstance(TopologyRequestFactoryImpl.class), injector.getInstance(SecurityConfigurationFactory
.class), injector.getInstance(Gson.class));
HostResourceProvider.setTopologyManager(injector.getInstance(TopologyManager.class));
BlueprintFactory.init(injector.getInstance(BlueprintDAO.class));
BaseClusterRequest.init(injector.getInstance(BlueprintFactory.class));
AmbariContext.init(injector.getInstance(HostRoleCommandFactory.class));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,16 @@
import org.apache.ambari.server.state.stack.OsFamily;
import org.apache.ambari.server.state.svccomphost.ServiceComponentHostImpl;
import org.apache.ambari.server.topology.BlueprintFactory;
import org.apache.ambari.server.topology.BlueprintValidator;
import org.apache.ambari.server.topology.BlueprintValidatorImpl;
import org.apache.ambari.server.topology.ComponentResolver;
import org.apache.ambari.server.topology.DefaultStackFactory;
import org.apache.ambari.server.topology.PersistedState;
import org.apache.ambari.server.topology.PersistedStateImpl;
import org.apache.ambari.server.topology.SecurityConfigurationFactory;
import org.apache.ambari.server.topology.StackComponentResolver;
import org.apache.ambari.server.topology.StackFactory;
import org.apache.ambari.server.topology.tasks.ConfigureClusterTaskFactory;
import org.apache.ambari.server.topology.validators.BasicBlueprintValidator;
import org.apache.ambari.server.topology.validators.BlueprintValidator;
import org.apache.ambari.server.utils.PasswordUtils;
import org.apache.ambari.server.view.ViewInstanceHandlerList;
import org.eclipse.jetty.server.SessionIdManager;
Expand Down Expand Up @@ -414,6 +418,7 @@ protected void configure() {
bind(SecurityConfigurationFactory.class).in(Scopes.SINGLETON);

bind(PersistedState.class).to(PersistedStateImpl.class);
bind(ComponentResolver.class).to(StackComponentResolver.class);

// factory to create LoggingRequestHelper instances for LogSearch integration
bind(LoggingRequestHelperFactory.class).to(LoggingRequestHelperFactoryImpl.class);
Expand Down Expand Up @@ -541,7 +546,8 @@ private void installFactories() {
bind(RegistryFactory.class).to(RegistryFactoryImpl.class);
bind(HostRoleCommandFactory.class).to(HostRoleCommandFactoryImpl.class);
bind(SecurityHelper.class).toInstance(SecurityHelperImpl.getInstance());
bind(BlueprintValidator.class).to(BlueprintValidatorImpl.class);
bind(BlueprintValidator.class).to(BasicBlueprintValidator.class);
bind(StackFactory.class).to(DefaultStackFactory.class);
bind(BlueprintFactory.class);

install(new FactoryModuleBuilder().implement(AmbariEvent.class, Names.named("userCreated"), UserCreatedEvent.class).build(AmbariEventFactory.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
package org.apache.ambari.server.controller;


import java.util.Objects;

public class ServiceComponentRequest {

private String clusterName; // REF
Expand Down Expand Up @@ -145,4 +147,29 @@ public String toString() {
"desiredState=%s, recoveryEnabled=%s, componentCategory=%s]", clusterName, serviceGroupName,
serviceName, clusterName, desiredState, recoveryEnabled, componentCategory);
}

@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}

ServiceComponentRequest other = (ServiceComponentRequest) obj;

return Objects.equals(clusterName, other.clusterName) &&
Objects.equals(serviceGroupName, other.serviceGroupName) &&
Objects.equals(serviceName, other.serviceName) &&
Objects.equals(componentCategory, other.componentCategory) &&
Objects.equals(componentName, other.componentName) &&
Objects.equals(desiredState, other.desiredState) &&
Objects.equals(recoveryEnabled, other.recoveryEnabled);
}

@Override
public int hashCode() {
return Objects.hash(clusterName, serviceGroupName, serviceName, componentCategory, componentName, desiredState, recoveryEnabled);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*/
package org.apache.ambari.server.controller;

import java.util.Objects;

import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.StackId;

Expand Down Expand Up @@ -196,4 +198,32 @@ public String toString() {
public void setResolvedRepository(RepositoryVersionEntity repositoryVersion) { resolvedRepository = repositoryVersion; }

public RepositoryVersionEntity getResolvedRepository() { return resolvedRepository; }

@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}

ServiceRequest other = (ServiceRequest) obj;

return Objects.equals(clusterName, other.clusterName) &&
Objects.equals(serviceGroupName, other.serviceGroupName) &&
Objects.equals(serviceType, other.serviceType) &&
Objects.equals(serviceName, other.serviceName) &&
Objects.equals(desiredState, other.desiredState) &&
Objects.equals(maintenanceState, other.maintenanceState) &&
Objects.equals(credentialStoreEnabled, other.credentialStoreEnabled) &&
Objects.equals(credentialStoreSupported, other.credentialStoreSupported) &&
Objects.equals(desiredStackId, other.desiredStackId) &&
Objects.equals(desiredRepositoryVersionId, other.desiredRepositoryVersionId);
}

@Override
public int hashCode() {
return Objects.hash(clusterName, serviceGroupName, serviceType, serviceName, desiredState, maintenanceState, credentialStoreEnabled, credentialStoreSupported, desiredStackId, desiredRepositoryVersionId);
}
}
Loading