mirror of https://github.com/apache/jclouds.git
tuning logs
This commit is contained in:
parent
b1b29ec222
commit
5ba249ae46
|
@ -115,8 +115,10 @@ public class RunScriptOnNodeAsInitScriptUsingSsh implements RunScriptOnNode {
|
||||||
ExecResponse returnVal;
|
ExecResponse returnVal;
|
||||||
String command = (runAsRoot) ? execScriptAsRoot(action) : execScriptAsDefaultUser(action);
|
String command = (runAsRoot) ? execScriptAsRoot(action) : execScriptAsDefaultUser(action);
|
||||||
returnVal = runCommand(command);
|
returnVal = runCommand(command);
|
||||||
logger.debug("<< %s(%d)", action, returnVal.getExitCode());
|
if (logger.isTraceEnabled())
|
||||||
logger.trace("<< %s[%s]", action, returnVal);
|
logger.trace("<< %s[%s]", action, returnVal);
|
||||||
|
else
|
||||||
|
logger.debug("<< %s(%d)", action, returnVal.getExitCode());
|
||||||
return returnVal;
|
return returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -425,10 +425,10 @@ public class BaseComputeService implements ComputeService {
|
||||||
@Override
|
@Override
|
||||||
public void suspendNode(String id) {
|
public void suspendNode(String id) {
|
||||||
checkNotNull(id, "id");
|
checkNotNull(id, "id");
|
||||||
logger.debug(">> suspendping node(%s)", id);
|
logger.debug(">> suspending node(%s)", id);
|
||||||
NodeMetadata node = suspendNodeStrategy.suspendNode(id);
|
NodeMetadata node = suspendNodeStrategy.suspendNode(id);
|
||||||
boolean successful = nodeSuspended.apply(node);
|
boolean successful = nodeSuspended.apply(node);
|
||||||
logger.debug("<< suspendped node(%s) success(%s)", id, successful);
|
logger.debug("<< suspended node(%s) success(%s)", id, successful);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -528,7 +528,7 @@ public class BaseComputeService implements ComputeService {
|
||||||
Iterable<? extends NodeMetadata> nodes, Statement script, RunScriptOptions options,
|
Iterable<? extends NodeMetadata> nodes, Statement script, RunScriptOptions options,
|
||||||
Map<NodeMetadata, Exception> badNodes) {
|
Map<NodeMetadata, Exception> badNodes) {
|
||||||
return filter(transformParallel(nodes, new TransformNodesIntoInitializedScriptRunners(script, options, badNodes),
|
return filter(transformParallel(nodes, new TransformNodesIntoInitializedScriptRunners(script, options, badNodes),
|
||||||
executor, null, logger, "transformNodesIntoInitializedScriptRunners(" + nodes + ")"), notNull());
|
executor, null, logger, "initialize script runners"), notNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<? extends NodeMetadata> detailsOnAllNodes() {
|
private Set<? extends NodeMetadata> detailsOnAllNodes() {
|
||||||
|
|
|
@ -85,63 +85,43 @@ public class AdaptingComputeServiceStrategies<N, H, I, L> implements AddNodeWith
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeMetadata getNode(String id) {
|
public NodeMetadata getNode(String id) {
|
||||||
N node = client.getNode(id);
|
N node = client.getNode(checkNotNull(id, "id"));
|
||||||
return node == null ? null : nodeMetadataAdapter.apply(node);
|
return node == null ? null : nodeMetadataAdapter.apply(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeMetadata rebootNode(String id) {
|
public NodeMetadata rebootNode(String id) {
|
||||||
|
NodeMetadata node = getNode(checkNotNull(id, "id"));
|
||||||
NodeMetadata node = getNode(id);
|
|
||||||
if (node == null || node.getState() == NodeState.TERMINATED)
|
if (node == null || node.getState() == NodeState.TERMINATED)
|
||||||
return node;
|
return node;
|
||||||
|
|
||||||
logger.debug(">> rebooting node(%s)", id);
|
|
||||||
client.rebootNode(id);
|
client.rebootNode(id);
|
||||||
logger.debug("<< rebooted node(%s)", id);
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeMetadata resumeNode(String id) {
|
public NodeMetadata resumeNode(String id) {
|
||||||
|
NodeMetadata node = getNode(checkNotNull(id, "id"));
|
||||||
NodeMetadata node = getNode(id);
|
|
||||||
if (node == null || node.getState() == NodeState.TERMINATED || node.getState() == NodeState.RUNNING)
|
if (node == null || node.getState() == NodeState.TERMINATED || node.getState() == NodeState.RUNNING)
|
||||||
return node;
|
return node;
|
||||||
|
|
||||||
logger.debug(">> resuming node(%s)", id);
|
|
||||||
client.resumeNode(id);
|
client.resumeNode(id);
|
||||||
logger.debug("<< resumed node(%s)", id);
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeMetadata suspendNode(String id) {
|
public NodeMetadata suspendNode(String id) {
|
||||||
|
NodeMetadata node = getNode(checkNotNull(id, "id"));
|
||||||
NodeMetadata node = getNode(id);
|
|
||||||
if (node == null || node.getState() == NodeState.TERMINATED || node.getState() == NodeState.SUSPENDED)
|
if (node == null || node.getState() == NodeState.TERMINATED || node.getState() == NodeState.SUSPENDED)
|
||||||
return node;
|
return node;
|
||||||
|
|
||||||
logger.debug(">> suspending node(%s)", id);
|
|
||||||
client.suspendNode(id);
|
client.suspendNode(id);
|
||||||
logger.debug("<< suspended node(%s)", id);
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeMetadata destroyNode(String id) {
|
public NodeMetadata destroyNode(String id) {
|
||||||
|
NodeMetadata node = getNode(checkNotNull(id, "id"));
|
||||||
NodeMetadata node = getNode(id);
|
|
||||||
if (node == null)
|
if (node == null)
|
||||||
return node;
|
return node;
|
||||||
|
|
||||||
logger.debug(">> destroying node(%s)", id);
|
|
||||||
client.destroyNode(id);
|
client.destroyNode(id);
|
||||||
logger.debug("<< destroyed node(%s)", id);
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,14 +132,10 @@ public class AdaptingComputeServiceStrategies<N, H, I, L> implements AddNodeWith
|
||||||
public NodeMetadata addNodeWithTag(String tag, String name, Template template) {
|
public NodeMetadata addNodeWithTag(String tag, String name, Template template) {
|
||||||
checkState(tag != null, "tag (that which groups identical nodes together) must be specified");
|
checkState(tag != null, "tag (that which groups identical nodes together) must be specified");
|
||||||
checkState(name != null && name.indexOf(tag) != -1, "name should have %s encoded into it", tag);
|
checkState(name != null && name.indexOf(tag) != -1, "name should have %s encoded into it", tag);
|
||||||
|
checkState(template != null, "template must be specified");
|
||||||
logger.debug(">> instantiating node location(%s) name(%s) image(%s) hardware(%s)",
|
|
||||||
template.getLocation().getId(), name, template.getImage().getProviderId(), template.getHardware()
|
|
||||||
.getProviderId());
|
|
||||||
|
|
||||||
N from = client.runNodeWithTagAndNameAndStoreCredentials(tag, name, template, credentialStore);
|
N from = client.runNodeWithTagAndNameAndStoreCredentials(tag, name, template, credentialStore);
|
||||||
NodeMetadata node = nodeMetadataAdapter.apply(from);
|
NodeMetadata node = nodeMetadataAdapter.apply(from);
|
||||||
logger.debug("<< instantiated node(%s)", node.getId());
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,9 @@ public class EncodeTagIntoNameRunNodesAndAddToSetStrategy implements RunNodesAnd
|
||||||
@Override
|
@Override
|
||||||
public NodeMetadata call() throws Exception {
|
public NodeMetadata call() throws Exception {
|
||||||
NodeMetadata node = null;
|
NodeMetadata node = null;
|
||||||
logger.debug(">> starting node(%s) tag(%s)", name, tag);
|
logger.debug(">> adding node location(%s) name(%s) image(%s) hardware(%s)",
|
||||||
|
template.getLocation().getId(), name, template.getImage().getProviderId(), template.getHardware()
|
||||||
|
.getProviderId());
|
||||||
node = addNodeWithTagStrategy.addNodeWithTag(tag, name, template);
|
node = addNodeWithTagStrategy.addNodeWithTag(tag, name, template);
|
||||||
logger.debug("<< %s node(%s)", node.getState(), node.getId());
|
logger.debug("<< %s node(%s)", node.getState(), node.getId());
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class ExecResponse implements CustomizationResponse {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ExecResponse [output=" + output + ", error=" + error + ", exitCode=" + exitCode + "]";
|
return "[output=" + output + ", error=" + error + ", exitCode=" + exitCode + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue