diff --git a/core/src/main/java/org/wildfly/extras/creaper/core/online/Constants.java b/core/src/main/java/org/wildfly/extras/creaper/core/online/Constants.java index d97f85e5..379caa5e 100644 --- a/core/src/main/java/org/wildfly/extras/creaper/core/online/Constants.java +++ b/core/src/main/java/org/wildfly/extras/creaper/core/online/Constants.java @@ -18,6 +18,7 @@ private Constants() {} // avoid instantiation public static final String BLOCKING = "blocking"; public static final String COMPOSITE = "composite"; public static final String CORE_SERVICE = "core-service"; + public static final String DOMAIN_CONFIG = "domain-config"; public static final String DOMAIN_FAILURE_DESCRIPTION = "domain-failure-description"; public static final String FAILED = "failed"; public static final String HOST_FAILURE_DESCRIPTIONS = "host-failure-descriptions"; diff --git a/core/src/main/java/org/wildfly/extras/creaper/core/online/operations/admin/ReloadToSnapshot.java b/core/src/main/java/org/wildfly/extras/creaper/core/online/operations/admin/ReloadToSnapshot.java index 637c8989..91506691 100644 --- a/core/src/main/java/org/wildfly/extras/creaper/core/online/operations/admin/ReloadToSnapshot.java +++ b/core/src/main/java/org/wildfly/extras/creaper/core/online/operations/admin/ReloadToSnapshot.java @@ -34,19 +34,19 @@ public ReloadToSnapshot(OnlineManagementClient client, String snapshot, int time } /** - * Reload the server to a snapshot. In managed domain, reloads the default host. + * Reload the server to a snapshot. In managed domain, reloads the default host to a domain.xml snapshot. */ public void perform() throws InterruptedException, TimeoutException, IOException { if (client.options().isStandalone) { new StandaloneAdministrationOperations(client, timeoutInSeconds) - .performRestartOperation(new ReloadToSnapshotRestartOperation(snapshot)); + .performRestartOperation(new ReloadToStandaloneSnapshotRestartOperation(snapshot)); } else { perform(client.options().defaultHost); } } /** - * Reload given {@code host} to a snapshot. This method only makes sense in managed domain. + * Reload given {@code host} to a domain.xml snapshot. This method only makes sense in managed domain. */ public void perform(String host) throws InterruptedException, TimeoutException, IOException { if (!client.options().isDomain) { @@ -55,13 +55,13 @@ public void perform(String host) throws InterruptedException, TimeoutException, } new DomainAdministrationOperations(client, timeoutInSeconds) - .performRestartOperation(host, new ReloadToSnapshotRestartOperation(snapshot)); + .performRestartOperation(host, new ReloadToDomainSnapshotRestartOperation(snapshot)); } - private static final class ReloadToSnapshotRestartOperation implements RestartOperation { + private static final class ReloadToStandaloneSnapshotRestartOperation implements RestartOperation { private final String snapshot; - ReloadToSnapshotRestartOperation(String snapshot) { + ReloadToStandaloneSnapshotRestartOperation(String snapshot) { this.snapshot = snapshot; } @@ -70,4 +70,17 @@ public ModelNodeResult perform(Operations ops, Address address) throws IOExcepti return ops.invoke(Constants.RELOAD, address, Values.of(Constants.SERVER_CONFIG, snapshot)); } } + + private static final class ReloadToDomainSnapshotRestartOperation implements RestartOperation { + private final String snapshot; + + ReloadToDomainSnapshotRestartOperation(String snapshot) { + this.snapshot = snapshot; + } + + @Override + public ModelNodeResult perform(Operations ops, Address address) throws IOException { + return ops.invoke(Constants.RELOAD, address, Values.of(Constants.DOMAIN_CONFIG, snapshot)); + } + } }