You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/05/15 13:05:39 UTC
[1/3] stratos git commit: This closes #321 on GitHub
Repository: stratos
Updated Branches:
refs/heads/master 2254dde69 -> 7e813291e
This closes #321 on GitHub
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7e813291
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7e813291
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7e813291
Branch: refs/heads/master
Commit: 7e813291ecaebf824066a2a93398186d39956b5f
Parents: 1a87371
Author: Imesh Gunaratne <im...@apache.org>
Authored: Fri May 15 16:35:33 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri May 15 16:35:33 2015 +0530
----------------------------------------------------------------------
----------------------------------------------------------------------
[2/3] stratos git commit: Improving logs by adding application id in
CC
Posted by im...@apache.org.
Improving logs by adding application id in CC
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/1a87371a
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/1a87371a
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/1a87371a
Branch: refs/heads/master
Commit: 1a87371a1a96f99530b9542d0520ca05042a1e68
Parents: 95a7060
Author: Vishanth <vi...@gmail.com>
Authored: Fri May 15 16:22:10 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri May 15 16:35:33 2015 +0530
----------------------------------------------------------------------
.../impl/CloudControllerServiceImpl.java | 53 +++++++++++---------
1 file changed, 30 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/1a87371a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
index f83e95f..b617cd9 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
@@ -496,8 +496,8 @@ public class CloudControllerServiceImpl implements CloudControllerService {
// Start instance in a new thread
if (log.isDebugEnabled()) {
log.debug(String.format("Starting instance creator thread: [cluster] %s [cluster-instance] %s " +
- "[member] %s", instanceContext.getClusterId(), instanceContext.getClusterInstanceId(),
- memberId));
+ "[member] %s [application-id] %s", instanceContext.getClusterId(),
+ instanceContext.getClusterInstanceId(), memberId, applicationId));
}
executorService.execute(new InstanceCreator(memberContext, iaasProvider, payload.toString().getBytes()));
@@ -606,7 +606,8 @@ public class CloudControllerServiceImpl implements CloudControllerService {
if (memberTerminated) {
log.info(String.format("Member terminated [member-id] %s ", memberId));
} else {
- log.warn(String.format("Stratos could not terminate the member [member-id] %s. This may due to a issue in the underlying IaaS, Please terminate the member manually", memberId));
+ log.warn(String.format("Stratos could not terminate the member [member-id] %s. This may due to a issue " +
+ "in the underlying IaaS, Please terminate the member manually", memberId));
MemberContext memberContext = CloudControllerContext.getInstance().getMemberContextOfMemberId(memberId);
CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberContext);
}
@@ -653,8 +654,8 @@ public class CloudControllerServiceImpl implements CloudControllerService {
if (isMemberExpired(member, memberContext.getObsoleteInitTime(), memberContext.getObsoleteExpiryTime())) {
if (log.isInfoEnabled()) {
log.info(String.format(
- "Member pending termination in ReadyToShutdown state exceeded expiry time. This member has to be manually deleted: %s",
- memberContext.getMemberId()));
+ "Member pending termination in ReadyToShutdown state exceeded expiry time. " +
+ "This member has to be manually deleted: %s", memberContext.getMemberId()));
}
CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberContext);
@@ -748,9 +749,6 @@ public class CloudControllerServiceImpl implements CloudControllerService {
throw new CartridgeNotFoundException(msg);
}
-// Properties properties = CloudControllerUtil.toJavaUtilProperties(registrant.getProperties());
-// Property property = properties.getProperty(CloudControllerConstants.IS_LOAD_BALANCER);
-// boolean isLb = property != null ? Boolean.parseBoolean(property.getValue()) : false;
TopologyBuilder.handleClusterCreated(registrant);
CloudControllerContext.getInstance().persist();
@@ -808,7 +806,8 @@ public class CloudControllerServiceImpl implements CloudControllerService {
if (cartridge == null) {
String msg =
- "Service unregistration failed. No matching cartridge found: [cartridge-type] " + cartridgeType;
+ String.format("Service unregistration failed. No matching cartridge found: [cartridge-type] %s " +
+ "[application-id] %s", cartridgeType, ctxt.getApplicationId());
log.error(msg);
throw new UnregisteredClusterException(msg);
}
@@ -822,7 +821,8 @@ public class CloudControllerServiceImpl implements CloudControllerService {
public void run() {
ClusterContext ctxt = CloudControllerContext.getInstance().getClusterContext(clusterId_);
if (ctxt == null) {
- String msg = "Service unregistration failed. Cluster not found: [cluster-id] " + clusterId_;
+ String msg = String.format("Service unregistration failed. Cluster not found: [cluster-id] %s " +
+ "[application-id] %s", clusterId_, ctxt.getApplicationId());
log.error(msg);
return;
}
@@ -842,7 +842,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
}
- // if there're still alive members
+ // if there are still alive members
if (members.size() > 0) {
//forcefully terminate them
for (Member member : members) {
@@ -851,7 +851,9 @@ public class CloudControllerServiceImpl implements CloudControllerService {
terminateInstance(member.getMemberId());
} catch (Exception e) {
// we are not gonna stop the execution due to errors.
- log.warn("Instance termination failed of member [id] " + member.getMemberId(), e);
+ log.warn((String.format("Instance termination failed of member [member-id] %s " +
+ "[application-id] %s", member.getMemberId(), ctxt.getApplicationId())), e);
+
}
}
}
@@ -864,7 +866,8 @@ public class CloudControllerServiceImpl implements CloudControllerService {
lock = CloudControllerContext.getInstance().acquireClusterContextWriteLock();
ClusterContext ctxt = CloudControllerContext.getInstance().getClusterContext(clusterId_);
if (ctxt == null) {
- String msg = "Service unregistration failed. Cluster not found: [cluster-id] " + clusterId_;
+ String msg = String.format("Service unregistration failed. Cluster not found: [cluster-id] %s " +
+ "[application-id] %s " , clusterId_, ctxt.getApplicationId());
log.error(msg);
return;
}
@@ -876,7 +879,8 @@ public class CloudControllerServiceImpl implements CloudControllerService {
CloudControllerUtil.sleep(1000);
}
- log.info("Unregistration of service cluster: " + clusterId_);
+ log.info(String.format("Unregistration of service cluster: [cluster-id] %s [application-id]",
+ clusterId_, ctxt.getApplicationId()));
deleteVolumes(ctxt);
onClusterRemoval(clusterId_);
} finally {
@@ -907,7 +911,9 @@ public class CloudControllerServiceImpl implements CloudControllerService {
}
} catch (Exception ignore) {
if (log.isErrorEnabled()) {
- log.error("Error while deleting volume [id] " + volume.getId(), ignore);
+ log.error((String.format("Error while deleting volume [id] %s " +
+ "[application-id]", volume.getId(), ctxt.getApplicationId())),
+ ignore);
}
}
}
@@ -1067,7 +1073,8 @@ public class CloudControllerServiceImpl implements CloudControllerService {
public boolean createApplicationClusters(String appId, ApplicationClusterContext[] appClustersContexts) throws
ApplicationClusterRegistrationException {
if (appClustersContexts == null || appClustersContexts.length == 0) {
- String errorMsg = "No application cluster information found, unable to create clusters";
+ String errorMsg = "No application cluster information found, unable to create clusters: " +
+ "[application-id] " + appId;
log.error(errorMsg);
throw new ApplicationClusterRegistrationException(errorMsg);
}
@@ -1195,7 +1202,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
public boolean addKubernetesCluster(KubernetesCluster kubernetesCluster) throws InvalidKubernetesClusterException,
KubernetesClusterAlreadyExistsException {
if (kubernetesCluster == null) {
- throw new InvalidKubernetesClusterException("Kubernetes cluster can not be null");
+ throw new InvalidKubernetesClusterException("Kubernetes cluster cannot be null");
}
try {
@@ -1236,10 +1243,10 @@ public class CloudControllerServiceImpl implements CloudControllerService {
public boolean addKubernetesHost(String kubernetesClusterId, KubernetesHost kubernetesHost) throws
InvalidKubernetesHostException, NonExistingKubernetesClusterException {
if (kubernetesHost == null) {
- throw new InvalidKubernetesHostException("Kubernetes host can not be null");
+ throw new InvalidKubernetesHostException("Kubernetes host cannot be null");
}
if (StringUtils.isEmpty(kubernetesClusterId)) {
- throw new NonExistingKubernetesClusterException("Kubernetes cluster id can not be null");
+ throw new NonExistingKubernetesClusterException("Kubernetes cluster id cannot be null");
}
Lock lock = null;
@@ -1259,7 +1266,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
kubernetesHostArrayList = new ArrayList<KubernetesHost>();
} else {
if (CloudControllerContext.getInstance().kubernetesHostExists(kubernetesHost.getHostId())) {
- throw new InvalidKubernetesHostException("Kubernetes host already exists: [hostnae] " +
+ throw new InvalidKubernetesHostException("Kubernetes host already exists: [hostname] " +
kubernetesHost.getHostId());
}
kubernetesHostArrayList = new
@@ -1289,7 +1296,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
@Override
public boolean removeKubernetesCluster(String kubernetesClusterId) throws NonExistingKubernetesClusterException {
if (StringUtils.isEmpty(kubernetesClusterId)) {
- throw new NonExistingKubernetesClusterException("Kubernetes cluster id can not be empty");
+ throw new NonExistingKubernetesClusterException("Kubernetes cluster id cannot be empty");
}
Lock lock = null;
@@ -1319,7 +1326,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
@Override
public boolean removeKubernetesHost(String kubernetesHostId) throws NonExistingKubernetesHostException {
if (kubernetesHostId == null) {
- throw new NonExistingKubernetesHostException("Kubernetes host id can not be null");
+ throw new NonExistingKubernetesHostException("Kubernetes host id cannot be null");
}
Lock lock = null;
@@ -1332,7 +1339,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
try {
KubernetesCluster kubernetesClusterStored = CloudControllerContext.getInstance().getKubernetesClusterContainingHost(kubernetesHostId);
- // Kubernetes master can not be removed
+ // Kubernetes master cannot be removed
if (kubernetesClusterStored.getKubernetesMaster().getHostId().equals(kubernetesHostId)) {
throw new NonExistingKubernetesHostException("Kubernetes master is not allowed to be removed [id] " + kubernetesHostId);
}
[3/3] stratos git commit: Improving logs by adding application id
Posted by im...@apache.org.
Improving logs by adding application id
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/95a70607
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/95a70607
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/95a70607
Branch: refs/heads/master
Commit: 95a7060733576e3191348721e01ef8dc13249cac
Parents: 2254dde
Author: Vishanth <vi...@gmail.com>
Authored: Fri May 15 15:24:52 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri May 15 16:35:33 2015 +0530
----------------------------------------------------------------------
.../services/impl/AutoscalerServiceImpl.java | 49 +++++++++++---------
1 file changed, 26 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/95a70607/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
index 9986df3..390a402 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
@@ -69,11 +69,10 @@ import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
import org.wso2.carbon.registry.api.RegistryException;
import java.rmi.RemoteException;
-import java.text.MessageFormat;
import java.util.*;
/**
- * Auto Scaler Service API is responsible getting Partitions and Policies.
+ * Autoscaler Service API is responsible getting Partitions and Policies.
*/
public class AutoscalerServiceImpl implements AutoscalerService {
@@ -169,18 +168,19 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
if (AutoscalerContext.getInstance().getApplicationContext(applicationId) == null) {
- String msg = "Application is not found as ApplicationContext. Please add application before updating it";
- log.error(msg);
- throw new ApplicationDefinitionException(msg);
+ String message = "Application is not found as ApplicationContext. Please add application before updating it: " +
+ "[application-id] " + applicationId;
+ log.error(message);
+ throw new ApplicationDefinitionException(message);
}
if (ApplicationHolder.getApplications().getApplication(applicationId) == null) {
- String msg = "Application is not found as Application. Please add application before updating it";
- log.error(msg);
- throw new ApplicationDefinitionException(msg);
+ String message = "Application is not found as Application. Please add application before updating it: " +
+ "[application-id] " + applicationId;
+ log.error(message);
+ throw new ApplicationDefinitionException(message);
}
-
ApplicationParser applicationParser = new DefaultApplicationParser();
Application application = applicationParser.parse(applicationContext);
@@ -270,7 +270,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
applicationContext.setStatus(ApplicationContext.STATUS_DEPLOYED);
AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
- log.info("Waiting for application clusters to be created: [application] " + applicationId);
+ log.info("Waiting for application clusters to be created: [application-id] " + applicationId);
return true;
} catch (Exception e) {
ApplicationContext applicationContext = RegistryManager.getInstance().
@@ -280,7 +280,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
applicationContext.setStatus(ApplicationContext.STATUS_CREATED);
AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
}
- String message = "Application deployment failed";
+ String message = "Application deployment failed: [application-id]" + applicationId;
log.error(message, e);
throw new RuntimeException(message, e);
}
@@ -354,7 +354,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
}
} catch (Exception e) {
- String message = "Could not add application signup";
+ String message = "Could not add application signup: [application-id]" + applicationContext.getApplicationId();
log.error(message, e);
throw new RuntimeException(message, e);
}
@@ -482,7 +482,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
if (appMonitor.isTerminating()) {
if (appMonitor.isForce()) {
- log.warn("Force un-deployment is already in progress, hence not invoking again");
+ log.warn(String.format("Force un-deployment is already in progress, hence not invoking again " +
+ "[application-id] %s", applicationId));
return false;
} else {
log.info(String.format("Previous graceful un-deployment is in progress for " +
@@ -574,7 +575,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
public boolean updateClusterMonitor(String clusterId, Properties properties) throws InvalidArgumentException {
if (log.isDebugEnabled()) {
- log.debug(String.format("Updating Cluster monitor [Cluster id] %s ", clusterId));
+ log.debug(String.format("Updating Cluster monitor [cluster-id] %s ", clusterId));
}
AutoscalerContext asCtx = AutoscalerContext.getInstance();
ClusterMonitor monitor = asCtx.getClusterMonitor(clusterId);
@@ -582,7 +583,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
if (monitor != null) {
monitor.handleDynamicUpdates(properties);
} else {
- log.debug(String.format("Updating Cluster monitor failed: Cluster monitor [Cluster id] %s not found.",
+ log.debug(String.format("Updating Cluster monitor failed: Cluster monitor [cluster-id] %s not found.",
clusterId));
}
return true;
@@ -591,7 +592,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
public boolean addServiceGroup(ServiceGroup servicegroup) throws InvalidServiceGroupException {
if (servicegroup == null || StringUtils.isEmpty(servicegroup.getName())) {
- String msg = "Cartridge group can not be null service name can not be empty.";
+ String msg = "Cartridge group cannot be null or service name cannot be empty.";
log.error(msg);
throw new IllegalArgumentException(msg);
}
@@ -606,7 +607,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
if (log.isDebugEnabled()) {
- log.debug(MessageFormat.format("Adding cartridge group {0}", servicegroup.getName()));
+ log.debug(String.format("Adding cartridge group %s", servicegroup.getName()));
}
String[] subGroups = servicegroup.getCartridges();
@@ -839,7 +840,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
String applicationPolicyId = applicationPolicy.getId();
ApplicationPolicy existingApplicationPolicy = PolicyManager.getInstance().getApplicationPolicy(applicationPolicyId);
if (existingApplicationPolicy == null) {
- String msg = String.format("No such application poliicy found [application-policy-id] %s", applicationPolicyId);
+ String msg = String.format("No such application policy found [application-policy-id] %s", applicationPolicyId);
log.error(msg);
throw new ApplicatioinPolicyNotExistsException(msg);
}
@@ -859,7 +860,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
private void terminateAllApplicationMembersForcefully(String applicationId) {
if (StringUtils.isEmpty(applicationId)) {
- throw new IllegalArgumentException("Application Id can not be empty");
+ throw new IllegalArgumentException("Application Id cannot be empty");
}
Application application;
@@ -867,7 +868,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
ApplicationManager.acquireReadLockForApplication(applicationId);
application = ApplicationManager.getApplications().getApplication(applicationId);
if (application == null) {
- log.warn(String.format("Could not find application, thus no members to be terminated [application-id] %s", applicationId));
+ log.warn(String.format("Could not find application, thus no members to be terminated " +
+ "[application-id] %s", applicationId));
return;
}
} finally {
@@ -876,7 +878,6 @@ public class AutoscalerServiceImpl implements AutoscalerService {
Set<ClusterDataHolder> allClusters = application.getClusterDataRecursively();
- //CloudControllerServiceClient cloudControllerServiceClient = CloudControllerServiceClient.getInstance().ter
for (ClusterDataHolder clusterDataHolder : allClusters) {
String serviceType = clusterDataHolder.getServiceType();
String clusterId = clusterDataHolder.getClusterId();
@@ -896,10 +897,12 @@ public class AutoscalerServiceImpl implements AutoscalerService {
for (String memberIdToTerminate : memberListToTerminate) {
try {
- log.info(String.format("Terminating member forcefully [member-id] %s of the cluster [cluster-id] %s [application-id] %s", memberIdToTerminate, clusterId, application));
+ log.info(String.format("Terminating member forcefully [member-id] %s of the cluster [cluster-id] %s " +
+ "[application-id] %s", memberIdToTerminate, clusterId, application));
CloudControllerServiceClient.getInstance().terminateInstanceForcefully(memberIdToTerminate);
} catch (Exception e) {
- log.error(String.format("Forcefull termination of member %s is failed, but continuing forcefull deletion of other members", memberIdToTerminate));
+ log.error(String.format("Forceful termination of member %s has failed, but continuing forceful " +
+ "deletion of other members", memberIdToTerminate));
}
}
}