modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java | 20 +++++----- modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 5 ++ 2 files changed, 15 insertions(+), 10 deletions(-)
New commits: commit c367f45a05cd488d4822d51f4c6368f5924c8223 Author: Thomas Segismont tsegismo@redhat.com Date: Thu Feb 21 11:34:05 2013 +0100
BZ911327 - [EAP 6.1] Restarting servers in server-group fails
While the bug was detected because of the underlying EAP operation failing, it appears that the RHQ timeout for this operation is pretty low. The operation timeout is now configurable and should be adjusted by users for their particular environment. It defaults to 2 minutes.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java index 71967e5..eb97042 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java @@ -55,29 +55,30 @@ import org.rhq.modules.plugins.jbossas7.json.Result; * Component dealing with server group specific things * @author Heiko W. Rupp */ -@SuppressWarnings("unused") public class ServerGroupComponent extends BaseComponent implements ContentFacet, CreateChildResourceFacet, OperationFacet {
- private static final String SUCCESS = "success"; private static final String OUTCOME = "outcome"; + private static final String RESTART_SERVERS = "restart-servers";
@Override public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException, Exception { - Operation op = new Operation(name, getAddress()); - Result res = getASConnection().execute(op); - + Result res = null; + if (RESTART_SERVERS.equals(name)) { + // This operation as a timeout parameter as it can run for quite a long time + res = getASConnection().execute(op, parameters.getSimple("responseTimeout").getIntegerValue()); + } else { + res = getASConnection().execute(op); + } OperationResult result = new OperationResult(); - if (res.isSuccess()) { - result.setSimpleResult(SUCCESS); + result.setSimpleResult(Result.SUCCESS); } else { result.setErrorMessage(res.getFailureDescription()); } return result; - }
@Override @@ -119,7 +120,7 @@ public class ServerGroupComponent extends BaseComponent implements ContentFacet,
if (uploadResult.has(OUTCOME)) { String outcome = uploadResult.get(OUTCOME).getTextValue(); - if (outcome.equals(SUCCESS)) { // Upload was successful, so now add the file to the server group + if (outcome.equals(Result.SUCCESS)) { // Upload was successful, so now add the file to the server group JsonNode resultNode = uploadResult.get("result"); String hash = resultNode.get("BYTES_VALUE").getTextValue(); ASConnection connection = getASConnection(); @@ -202,6 +203,7 @@ public class ServerGroupComponent extends BaseComponent implements ContentFacet, return null; // TODO: Customise this generated block }
+ @SuppressWarnings("unused") private String serverGroupFromKey() { String key1 = context.getResourceKey(); return key1.substring(key1.lastIndexOf("/") + 1); diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml index 2509073..cf01d5f 100644 --- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml @@ -1016,7 +1016,10 @@ <c:simple-property name="operationResult"/> </results> </operation> - <operation name="restart-servers" description="Restarts all servers belonging to the server group currently running in the domain."> + <operation name="restart-servers" description="Restarts all servers belonging to the server group currently running in the domain." timeout="180"> + <parameters> + <c:simple-property name="responseTimeout" default="120" type="long" description="Amount of time the agent will be waiting for domain host response. Defaults to 120 seconds." /> + </parameters> <results> <c:simple-property name="operationResult"/> </results>
rhq-commits@lists.fedorahosted.org