From 243c63e4bab0f605d12e6e4a66f8fb82f55b5b8f Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Wed, 8 May 2024 10:31:23 +0100 Subject: [PATCH 1/7] [WFCORE-6815] Add reload-enhanced operation to Host Controllers Jira issue: https://issues.redhat.com/browse/WFCORE-6815 --- .../DefaultOperationDescriptionProvider.java | 18 ++++- .../common/ProcessReloadHandler.java | 10 ++- .../operations/HostProcessReloadHandler.java | 68 +++++++++++++++---- .../DomainModelControllerService.java | 6 +- .../controller/HostControllerEnvironment.java | 29 ++++++-- ...tEnvironmentAwareProcessReloadHandler.java | 24 +++++++ .../model/host/HostResourceDefinition.java | 11 ++- .../descriptions/LocalDescriptions.properties | 9 +++ .../ServerProcessReloadHandler.java | 6 +- 9 files changed, 144 insertions(+), 37 deletions(-) create mode 100644 host-controller/src/main/java/org/jboss/as/host/controller/HostEnvironmentAwareProcessReloadHandler.java diff --git a/controller/src/main/java/org/jboss/as/controller/descriptions/DefaultOperationDescriptionProvider.java b/controller/src/main/java/org/jboss/as/controller/descriptions/DefaultOperationDescriptionProvider.java index 8e0df045b0b..fed6d79b76f 100644 --- a/controller/src/main/java/org/jboss/as/controller/descriptions/DefaultOperationDescriptionProvider.java +++ b/controller/src/main/java/org/jboss/as/controller/descriptions/DefaultOperationDescriptionProvider.java @@ -110,6 +110,19 @@ public DefaultOperationDescriptionProvider(final String operationName, this(operationName, descriptionResolver, attributeDescriptionResolver, replyType, replyValueType, replyAllowNull, deprecationData, replyParameters, parameters, null); } + public DefaultOperationDescriptionProvider(final String operationName, + final ResourceDescriptionResolver descriptionResolver, + final ResourceDescriptionResolver attributeDescriptionResolver, + final ModelType replyType, + final ModelType replyValueType, + final boolean replyAllowNull, + final DeprecationData deprecationData, + final AttributeDefinition[] replyParameters, + final AttributeDefinition[] parameters, + final List accessConstraints) { + this(operationName, descriptionResolver, attributeDescriptionResolver, replyType, replyValueType, replyAllowNull, deprecationData, replyParameters, parameters, accessConstraints, Stability.DEFAULT); + } + public DefaultOperationDescriptionProvider(final String operationName, final ResourceDescriptionResolver descriptionResolver, final ResourceDescriptionResolver attributeDescriptionResolver, @@ -119,7 +132,8 @@ public DefaultOperationDescriptionProvider(final String operationName, final DeprecationData deprecationData, final AttributeDefinition[] replyParameters, final AttributeDefinition[] parameters, - final List accessConstraints) { + final List accessConstraints, + final Stability stability) { this.operationName = operationName; this.descriptionResolver = descriptionResolver; this.attributeDescriptionResolver = attributeDescriptionResolver; @@ -130,7 +144,7 @@ public DefaultOperationDescriptionProvider(final String operationName, this.deprecationData = deprecationData; this.replyParameters = replyParameters; this.accessConstraints = accessConstraints != null ? accessConstraints : Collections.emptyList(); - this.stability = Stability.DEFAULT; + this.stability = stability; } public DefaultOperationDescriptionProvider(OperationDefinition definition, ResourceDescriptionResolver resolver, ResourceDescriptionResolver attributeResolver) { diff --git a/controller/src/main/java/org/jboss/as/controller/operations/common/ProcessReloadHandler.java b/controller/src/main/java/org/jboss/as/controller/operations/common/ProcessReloadHandler.java index bc58522406a..3781a2b7c6d 100644 --- a/controller/src/main/java/org/jboss/as/controller/operations/common/ProcessReloadHandler.java +++ b/controller/src/main/java/org/jboss/as/controller/operations/common/ProcessReloadHandler.java @@ -14,7 +14,9 @@ import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; import org.jboss.as.controller.UninterruptibleCountDownLatch; import org.jboss.as.controller.descriptions.ModelDescriptionConstants; +import org.jboss.as.controller.operations.validation.EnumValidator; import org.jboss.as.controller.remote.EarlyResponseSendListener; +import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; import org.jboss.msc.service.LifecycleEvent; @@ -35,9 +37,15 @@ public abstract class ProcessReloadHandler impleme * The operation name. */ protected static final String OPERATION_NAME = ModelDescriptionConstants.RELOAD; + protected static final String ENHANCED_OPERATION_NAME = ModelDescriptionConstants.RELOAD_ENHANCED; protected static final AttributeDefinition ADMIN_ONLY = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.ADMIN_ONLY, ModelType.BOOLEAN, true) - .setDefaultValue(ModelNode.FALSE).build(); + .setDefaultValue(ModelNode.FALSE).build(); + + protected static final AttributeDefinition STABILITY = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.STABILITY, ModelType.STRING, true) + .setStability(Stability.COMMUNITY) + .setValidator(EnumValidator.create(Stability.class)) + .build(); private final T runningModeControl; private final ControlledProcessState processState; diff --git a/host-controller/src/main/java/org/jboss/as/domain/controller/operations/HostProcessReloadHandler.java b/host-controller/src/main/java/org/jboss/as/domain/controller/operations/HostProcessReloadHandler.java index 31a592edd87..fe2feff2ce1 100644 --- a/host-controller/src/main/java/org/jboss/as/domain/controller/operations/HostProcessReloadHandler.java +++ b/host-controller/src/main/java/org/jboss/as/domain/controller/operations/HostProcessReloadHandler.java @@ -16,6 +16,7 @@ import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; import org.jboss.as.controller.SimpleOperationDefinition; import org.jboss.as.controller.SimpleOperationDefinitionBuilder; +import org.jboss.as.controller.access.management.SensitiveTargetAccessConstraintDefinition; import org.jboss.as.controller.descriptions.DefaultOperationDescriptionProvider; import org.jboss.as.controller.descriptions.DescriptionProvider; import org.jboss.as.controller.descriptions.ModelDescriptionConstants; @@ -24,10 +25,12 @@ import org.jboss.as.controller.registry.OperationEntry; import org.jboss.as.domain.controller.LocalHostControllerInfo; import org.jboss.as.host.controller.HostControllerEnvironment; +import org.jboss.as.host.controller.HostEnvironmentAwareProcessReloadHandler; import org.jboss.as.host.controller.HostModelUtil; import org.jboss.as.host.controller.HostRunningModeControl; import org.jboss.as.host.controller.RestartMode; import org.jboss.as.host.controller.logging.HostControllerLogger; +import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelType; import org.jboss.msc.service.ServiceName; @@ -36,10 +39,10 @@ * * @author Kabir Khan */ -public class HostProcessReloadHandler extends ProcessReloadHandler{ +public class HostProcessReloadHandler extends HostEnvironmentAwareProcessReloadHandler { private static final AttributeDefinition RESTART_SERVERS = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.RESTART_SERVERS, ModelType.BOOLEAN, true) - .setDefaultValue(ModelNode.TRUE).build(); + .setDefaultValue(ModelNode.TRUE).build(); private static final AttributeDefinition USE_CURRENT_DOMAIN_CONFIG = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.USE_CURRENT_DOMAIN_CONFIG, ModelType.BOOLEAN, true) .setAlternatives(ModelDescriptionConstants.DOMAIN_CONFIG) @@ -60,9 +63,13 @@ public class HostProcessReloadHandler extends ProcessReloadHandler initializeReloadContext(final OperationContext context, final ModelNode operation) throws OperationFailedException { + final Stability stability; + if (operation.hasDefined(STABILITY.getName())) { + String val = STABILITY.resolveModelAttribute(context, operation).asString(); + stability = Stability.fromString(val); + environment.checkStabilityIsValidForInstallation(stability); + } else { + stability = null; + } final boolean adminOnly = ADMIN_ONLY.resolveModelAttribute(context, operation).asBoolean(false); final boolean restartServers = RESTART_SERVERS.resolveModelAttribute(context, operation).asBoolean(true); final boolean useCurrentHostConfig = USE_CURRENT_HOST_CONFIG.resolveModelAttribute(context, operation).asBoolean(true); @@ -124,7 +148,7 @@ protected ProcessReloadHandler.ReloadContext initializeR throw HostControllerLogger.ROOT_LOGGER.domainConfigForReloadNotFound(hostConfig); } - return new ReloadContext() { + return new ReloadContext<>() { @Override public void reloadInitiated(HostRunningModeControl runningModeControl) { @@ -140,24 +164,42 @@ public void doReload(HostRunningModeControl runningModeControl) { runningModeControl.setNewDomainBootFileName(domainConfig); runningModeControl.setNewBootFileName(hostConfig); runningModeControl.setReloadHostName(hostName); + if (stability != null) { + updateHostEnvironmentStability(stability); + } } }; } /** - * The host controller info does not know if it is master or not until later in the bootup process + * The host controller info does not know if it is master or not until later in the booting process */ private static class DeferredParametersOperationDefinitionBuilder extends SimpleOperationDefinitionBuilder { private final LocalHostControllerInfo hostControllerInfo; + private final AttributeDefinition[] primaryHcAttr; + private final AttributeDefinition[] secondaryHcAttr; + private final Stability stability; public DeferredParametersOperationDefinitionBuilder(LocalHostControllerInfo hostControllerInfo, String name, ResourceDescriptionResolver resolver) { super(name, resolver); this.hostControllerInfo = hostControllerInfo; + this.primaryHcAttr = PRIMARY_HC_ATTRIBUTES; + this.secondaryHcAttr = SECONDARY_HC_ATTRIBUTES; + this.stability = Stability.DEFAULT; + } + + public DeferredParametersOperationDefinitionBuilder(LocalHostControllerInfo hostControllerInfo, String name, ResourceDescriptionResolver resolver, AttributeDefinition[] primaryHcAttr, AttributeDefinition[] secondaryHcAttr, Stability stability) { + super(name, resolver); + this.hostControllerInfo = hostControllerInfo; + this.primaryHcAttr = primaryHcAttr; + this.secondaryHcAttr = secondaryHcAttr; + this.stability = stability; } @Override public SimpleOperationDefinition internalBuild(final ResourceDescriptionResolver resolver, final ResourceDescriptionResolver attributeResolver) { return new SimpleOperationDefinition(new SimpleOperationDefinitionBuilder(name, resolver) + .setStability(stability) .setAttributeResolver(attributeResolver) .setParameters(parameters) .withFlags(flags)) { @@ -166,8 +208,8 @@ public DescriptionProvider getDescriptionProvider() { return new DescriptionProvider() { @Override public ModelNode getModelDescription(Locale locale) { - AttributeDefinition[] params = hostControllerInfo.isMasterDomainController() ? MASTER_ATTRIBUTES : SLAVE_ATTRIBUTES; - return new DefaultOperationDescriptionProvider(getName(), resolver, attributeResolver, replyType, replyValueType, replyAllowNull, deprecationData, replyParameters, params, accessConstraints).getModelDescription(locale); + AttributeDefinition[] params = hostControllerInfo.isMasterDomainController() ? primaryHcAttr : secondaryHcAttr; + return new DefaultOperationDescriptionProvider(getName(), resolver, attributeResolver, replyType, replyValueType, replyAllowNull, deprecationData, replyParameters, params, accessConstraints, stability).getModelDescription(locale); } }; } diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/DomainModelControllerService.java b/host-controller/src/main/java/org/jboss/as/host/controller/DomainModelControllerService.java index 45a371c28fa..cf04b0ce092 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/DomainModelControllerService.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/DomainModelControllerService.java @@ -164,7 +164,6 @@ import org.jboss.as.server.controller.resources.VersionModelInitializer; import org.jboss.as.server.deployment.ContentCleanerService; import org.jboss.as.server.mgmt.UndertowHttpManagementService; -import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; import org.jboss.msc.service.Service; import org.jboss.msc.service.ServiceBuilder; @@ -262,10 +261,9 @@ static void addService(final ServiceTarget serviceTarget, final ManagementSecurityIdentitySupplier securityIdentitySupplier = new ManagementSecurityIdentitySupplier(); final RuntimeHostControllerInfoAccessor hostControllerInfoAccessor = new DomainHostControllerInfoAccessor(hostControllerInfo); final ProcessType processType = environment.getProcessType(); - final Stability stability = environment.getStability(); final ExtensionRegistry hostExtensionRegistry = ExtensionRegistry.builder(processType) .withRunningModeControl(runningModeControl) - .withStability(stability) + .withStabilitySupplier(environment::getStability) .withAuditLogger(auditLogger) .withAuthorizer(authorizer) .withSecurityIdentitySupplier(securityIdentitySupplier) @@ -273,7 +271,7 @@ static void addService(final ServiceTarget serviceTarget, .build(); final ExtensionRegistry extensionRegistry = ExtensionRegistry.builder(processType) .withRunningModeControl(runningModeControl) - .withStability(stability) + .withStabilitySupplier(environment::getStability) .withAuditLogger(auditLogger) .withAuthorizer(authorizer) .withSecurityIdentitySupplier(securityIdentitySupplier) diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java index 52a69157fb5..f7957902401 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java @@ -14,6 +14,7 @@ import java.nio.file.Path; import java.util.Collections; import java.util.EnumSet; +import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.Set; @@ -26,13 +27,13 @@ import org.jboss.as.controller.RunningMode; import org.jboss.as.controller.operations.common.ProcessEnvironment; import org.jboss.as.controller.persistence.ConfigurationFile; -import org.jboss.as.host.controller.logging.HostControllerLogger; import org.jboss.as.host.controller.jvm.JvmType; +import org.jboss.as.host.controller.logging.HostControllerLogger; import org.jboss.as.host.controller.operations.LocalHostControllerInfoImpl; import org.jboss.as.network.NetworkUtils; import org.jboss.as.server.logging.ServerLogger; -import org.jboss.as.version.Stability; import org.jboss.as.version.ProductConfig; +import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; import org.wildfly.common.Assert; import org.wildfly.security.manager.WildFlySecurityManager; @@ -234,7 +235,7 @@ public class HostControllerEnvironment extends ProcessEnvironment { private final boolean useCachedDc; private final RunningMode initialRunningMode; - private final Stability stability; + private volatile Stability stability; private final Set stabilities; private final ProductConfig productConfig; private final String qualifiedHostName; @@ -265,7 +266,7 @@ public HostControllerEnvironment(Map hostSystemProperties, boole ProductConfig productConfig, boolean securityManagerEnabled, long startTime, ProcessType processType, ConfigurationFile.InteractionPolicy hostConfigInteractionPolicy, ConfigurationFile.InteractionPolicy domainConfigInteractionPolicy) { - this.hostSystemProperties = Collections.unmodifiableMap(Assert.checkNotNullParam("hostSystemProperties", hostSystemProperties)); + this.hostSystemProperties = new HashMap<>(Assert.checkNotNullParam("hostSystemProperties", hostSystemProperties)); Assert.checkNotNullParam("modulePath", modulePath); Assert.checkNotNullParam("processControllerAddress", processControllerAddress); Assert.checkNotNullParam("processControllerPort", processControllerPort); @@ -736,10 +737,10 @@ public File getDefaultJVM() { /** * Initial set of system properties provided to this Host Controller at boot via the command line. - * @return the properties + * @return An unmodifiable map with the system properties. */ public Map getHostSystemProperties() { - return hostSystemProperties; + return Collections.unmodifiableMap(hostSystemProperties); } /** @@ -922,6 +923,22 @@ public OperationStepHandler getHostNameWriteHandler(LocalHostControllerInfoImpl return new HostNameWriteAttributeHandler(hostControllerInfo); } + void setStability(Stability stability) { + WildFlySecurityManager.setPropertyPrivileged(ProcessEnvironment.STABILITY, stability.toString()); + this.hostSystemProperties.put(ProcessEnvironment.STABILITY, stability.toString()); + this.stability = stability; + } + + public void checkStabilityIsValidForInstallation(Stability stability) { + checkStabilityIsValidForInstallation(productConfig, stability); + } + + private void checkStabilityIsValidForInstallation(ProductConfig productConfig, Stability stability) { + if (!productConfig.getStabilitySet().contains(stability)) { + throw HostControllerLogger.ROOT_LOGGER.unsupportedStability(this.stability, productConfig.getProductName()); + } + } + protected class HostNameWriteAttributeHandler extends ProcessNameWriteAttributeHandler { private final LocalHostControllerInfoImpl hostControllerInfo; diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/HostEnvironmentAwareProcessReloadHandler.java b/host-controller/src/main/java/org/jboss/as/host/controller/HostEnvironmentAwareProcessReloadHandler.java new file mode 100644 index 00000000000..9bfb8d78558 --- /dev/null +++ b/host-controller/src/main/java/org/jboss/as/host/controller/HostEnvironmentAwareProcessReloadHandler.java @@ -0,0 +1,24 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.jboss.as.host.controller; + +import org.jboss.as.controller.ControlledProcessState; +import org.jboss.as.controller.operations.common.ProcessReloadHandler; +import org.jboss.as.version.Stability; +import org.jboss.msc.service.ServiceName; + +public abstract class HostEnvironmentAwareProcessReloadHandler extends ProcessReloadHandler { + protected final HostControllerEnvironment environment; + + public HostEnvironmentAwareProcessReloadHandler(ServiceName rootService, HostRunningModeControl runningModeControl, ControlledProcessState processState, HostControllerEnvironment environment) { + super(rootService, runningModeControl, processState); + this.environment = environment; + } + + protected void updateHostEnvironmentStability(Stability stability) { + environment.setStability(stability); + } +} diff --git a/host-controller/src/main/java/org/jboss/as/host/controller/model/host/HostResourceDefinition.java b/host-controller/src/main/java/org/jboss/as/host/controller/model/host/HostResourceDefinition.java index f6b58a4e61f..7912c8c97d5 100644 --- a/host-controller/src/main/java/org/jboss/as/host/controller/model/host/HostResourceDefinition.java +++ b/host-controller/src/main/java/org/jboss/as/host/controller/model/host/HostResourceDefinition.java @@ -7,10 +7,12 @@ import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DOMAIN_ORGANIZATION; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST; +import static org.jboss.as.controller.services.path.PathResourceDefinition.PATH_CAPABILITY; import org.jboss.as.controller.BootErrorCollector; import org.jboss.as.controller.ControlledProcessState; import org.jboss.as.controller.ModelOnlyWriteAttributeHandler; +import org.jboss.as.controller.ModelVersion; import org.jboss.as.controller.ObjectTypeAttributeDefinition; import org.jboss.as.controller.OperationContext; import org.jboss.as.controller.OperationFailedException; @@ -22,6 +24,7 @@ import org.jboss.as.controller.RunningMode; import org.jboss.as.controller.SimpleAttributeDefinition; import org.jboss.as.controller.SimpleAttributeDefinitionBuilder; +import org.jboss.as.controller.SimpleOperationDefinitionBuilder; import org.jboss.as.controller.SimpleResourceDefinition; import org.jboss.as.controller.access.management.DelegatingConfigurableAuthorizer; import org.jboss.as.controller.access.management.ManagementSecurityIdentitySupplier; @@ -44,6 +47,7 @@ import org.jboss.as.controller.operations.common.SnapshotTakeHandler; import org.jboss.as.controller.operations.common.ValidateAddressOperationHandler; import org.jboss.as.controller.operations.common.ValidateOperationHandler; +import org.jboss.as.controller.operations.common.XmlFileMarshallingHandler; import org.jboss.as.controller.operations.common.XmlMarshallingHandler; import org.jboss.as.controller.operations.global.GlobalInstallationReportHandler; import org.jboss.as.controller.operations.global.ReadAttributeHandler; @@ -54,12 +58,6 @@ import org.jboss.as.controller.registry.ManagementResourceRegistration; import org.jboss.as.controller.services.path.PathManagerService; import org.jboss.as.controller.services.path.PathResourceDefinition; - -import static org.jboss.as.controller.services.path.PathResourceDefinition.PATH_CAPABILITY; - -import org.jboss.as.controller.ModelVersion; -import org.jboss.as.controller.SimpleOperationDefinitionBuilder; -import org.jboss.as.controller.operations.common.XmlFileMarshallingHandler; import org.jboss.as.domain.controller.DomainController; import org.jboss.as.domain.controller.operations.DomainServerLifecycleHandlers; import org.jboss.as.domain.controller.operations.HostProcessReloadHandler; @@ -370,6 +368,7 @@ public void registerOperations(ManagementResourceRegistration hostRegistration) HostProcessReloadHandler reloadHandler = new HostProcessReloadHandler(HostControllerService.HC_SERVICE_NAME, runningModeControl, processState, environment, hostControllerInfo); hostRegistration.registerOperationHandler(HostProcessReloadHandler.getDefinition(hostControllerInfo), reloadHandler); + hostRegistration.registerOperationHandler(HostProcessReloadHandler.getEnhancedDefinition(hostControllerInfo), reloadHandler); DomainServerLifecycleHandlers.initializeServerInventory(serverInventory); diff --git a/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties b/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties index ad45e3215c9..eb4d22c2436 100644 --- a/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties +++ b/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties @@ -122,6 +122,15 @@ host.reload.use-current-host-config=Only has an effect if --read-only-host-confi host.reload.domain-config=Use to override the name of the domain config to use for the reloaded host controller. When making changes to the model after the reload, the changes will still be persisted to the original domain configuration file that was used to first boot up the host controller. This parameter is resolved the same way as the --domain-config command-line option. host.reload.host-config=Use to override the name of the host config to use for the reloaded host controller. When making changes to the model after the reload, the changes will still be persisted to the original host configuration file that was used to first boot up the host controller. This parameter is resolved the same way as the --host-config command-line option. +host.reload-enhanced=Reloads the Host Controller by shutting down all its services and starting again. The JVM itself is not restarted. Note however that this will lead to a full process restart for any server processes managed by this host controller. +host.reload-enhanced.admin-only=Whether the Host Controller should start in running mode ADMIN_ONLY when it restarts. An ADMIN_ONLY Host Controller will start any configured management interfaces and accept management requests, but will not start servers or, if this host controller is the primary for the domain, accept incoming connections from secondary host controllers. +host.reload-enhanced.restart-servers=If true the servers will be reloaded, and if false the servers will be left running and reconnect to the Host Controller when started again. +host.reload-enhanced.use-current-domain-config=Only has an effect if --read-only-domain-config was specified when starting the controller. In that case, if this parameter is set to false the reloaded controller loads the original configuration version; if null or true the current runtime version of the model is used. +host.reload-enhanced.use-current-host-config=Only has an effect if --read-only-host-config was specified when starting the controller. In that case, if this parameter is set to false the reloaded controller loads the original configuration version; if null or true the current runtime version of the model is used. +host.reload-enhanced.domain-config=Use to override the name of the domain config to use for the reloaded host controller. When making changes to the model after the reload, the changes will still be persisted to the original domain configuration file that was used to first boot up the host controller. This parameter is resolved the same way as the --domain-config command-line option. +host.reload-enhanced.host-config=Use to override the name of the host config to use for the reloaded host controller. When making changes to the model after the reload, the changes will still be persisted to the original host configuration file that was used to first boot up the host controller. This parameter is resolved the same way as the --host-config command-line option. +host.reload-enhanced.stability=Set to change the stability level of the reloaded server. + server-config=Defines a server in the host-level management model. server-config.add=Add a new server configuration. server-config.remove=Remove an existing server configuration. diff --git a/server/src/main/java/org/jboss/as/server/operations/ServerProcessReloadHandler.java b/server/src/main/java/org/jboss/as/server/operations/ServerProcessReloadHandler.java index 821b834b70c..fa4a64d4c81 100644 --- a/server/src/main/java/org/jboss/as/server/operations/ServerProcessReloadHandler.java +++ b/server/src/main/java/org/jboss/as/server/operations/ServerProcessReloadHandler.java @@ -72,10 +72,6 @@ public class ServerProcessReloadHandler extends ServerEnvironmentAwareProcessRel ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Parameters only allowed in the 'enhanced' operation - private static final String ENHANCED_OPERATION_NAME = ModelDescriptionConstants.RELOAD_ENHANCED; - - protected static final AttributeDefinition STABILITY = new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.STABILITY, ModelType.STRING, true) - .setValidator(EnumValidator.create(Stability.class)).build(); private static final AttributeDefinition[] ENHANCED_ATTRIBUTES = new AttributeDefinition[] {ADMIN_ONLY, USE_CURRENT_SERVER_CONFIG, SERVER_CONFIG, START_MODE, STABILITY}; private static final OperationDefinition ENHANCED_DEFINITION = new SimpleOperationDefinitionBuilder(ENHANCED_OPERATION_NAME, ServerDescriptions.getResourceDescriptionResolver("server")) .setStability(Stability.COMMUNITY) @@ -85,7 +81,7 @@ public class ServerProcessReloadHandler extends ServerEnvironmentAwareProcessRel .build(); private final Set additionalAttributes; - private ExtensibleConfigurationPersister extensibleConfigurationPersister; + private final ExtensibleConfigurationPersister extensibleConfigurationPersister; public ServerProcessReloadHandler(ServiceName rootService, RunningModeControl runningModeControl, ControlledProcessState processState, ServerEnvironment environment, Set additionalAttributes, ExtensibleConfigurationPersister extensibleConfigurationPersister) { From f0774e03327a2184a051d5d1733464d5a3671058 Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Wed, 8 May 2024 17:59:28 +0100 Subject: [PATCH 2/7] [WFCORE-6815] Tests cases to verify the stability after reloading the doamin Jira issue: https://issues.redhat.com/browse/WFCORE-6815 --- .../suites/DomainStabilityTestCase.java | 131 +++++++++++++ .../domain/suites/DomainTestSuite.java | 1 + .../wildfly/test/snapshot/DomainSnapshot.java | 115 ++++++++++++ ...bilityDomainSetupSnapshotRestoreTasks.java | 173 ++++++++++++++++++ ...bilityServerSetupSnapshotRestoreTasks.java | 24 +-- 5 files changed, 432 insertions(+), 12 deletions(-) create mode 100644 testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainStabilityTestCase.java create mode 100644 testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java create mode 100644 testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java diff --git a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainStabilityTestCase.java b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainStabilityTestCase.java new file mode 100644 index 00000000000..8bfe28cb60c --- /dev/null +++ b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainStabilityTestCase.java @@ -0,0 +1,131 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.jboss.as.test.integration.domain.suites; + +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.BLOCKING; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CORE_SERVICE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST_ENVIRONMENT; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SERVER; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SERVER_GROUP; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STABILITY; +import static org.jboss.as.server.controller.descriptions.ServerDescriptionConstants.SERVER_ENVIRONMENT; + +import java.io.IOException; +import java.util.Arrays; + +import org.jboss.as.controller.PathAddress; +import org.jboss.as.controller.client.helpers.domain.DomainClient; +import org.jboss.as.controller.operations.common.Util; +import org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil; +import org.jboss.as.test.integration.domain.management.util.DomainTestSupport; +import org.jboss.as.test.integration.domain.management.util.DomainTestUtils; +import org.jboss.as.test.integration.management.util.MgmtOperationException; +import org.jboss.as.version.Stability; +import org.jboss.dmr.ModelNode; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.wildfly.test.stability.StabilityDomainSetupSnapshotRestoreTasks; + +@RunWith(Parameterized.class) +public class DomainStabilityTestCase { + public PathAddress HOST_PRIMARY = PathAddress.pathAddress(HOST, "primary"); + public PathAddress HOST_SECONDARY = PathAddress.pathAddress(HOST, "secondary"); + public PathAddress SERVER_MAIN_ONE = PathAddress.pathAddress(SERVER, "main-one"); + public PathAddress SERVER_MAIN_THREE = PathAddress.pathAddress(SERVER, "main-three"); + public PathAddress CORE_SERVICE_HOST_ENVIRONMENT = PathAddress.pathAddress(CORE_SERVICE, HOST_ENVIRONMENT); + public PathAddress CORE_SERVICE_SERVER_ENVIRONMENT = PathAddress.pathAddress(CORE_SERVICE, SERVER_ENVIRONMENT); + public PathAddress SERVER_GROUP_MAIN_SERVER_GROUP = PathAddress.pathAddress(SERVER_GROUP, "main-server-group"); + + private static DomainTestSupport testSupport; + private final Stability desiredStability; + private static StabilityDomainSetupSnapshotRestoreTasks setupSnapshotRestoreTasks; + + @Parameterized.Parameters + public static Iterable data() { + return Arrays.asList(Stability.DEFAULT, Stability.COMMUNITY, Stability.PREVIEW, Stability.EXPERIMENTAL); + } + + public DomainStabilityTestCase(Stability desiredStability) { + this.desiredStability = desiredStability; + } + + @BeforeClass + public static void setupDomain() throws Exception { + testSupport = DomainTestSuite.createSupport(DomainStabilityTestCase.class.getSimpleName()); + } + + @Before + public void setup() throws Exception { + setupSnapshotRestoreTasks = new StabilityDomainSetupSnapshotRestoreTasks(desiredStability, testSupport); + setupSnapshotRestoreTasks.setup(); + } + + @After + public void tearDown() throws Exception { + setupSnapshotRestoreTasks.tearDown(); + } + + @AfterClass + public static void tearDownDomain() throws Exception { + testSupport = null; + DomainTestSuite.stopSupport(); + } + + @Test + public void verifyDesiredStability() throws IOException, MgmtOperationException { + DomainLifecycleUtil domainPrimaryLifecycleUtil = testSupport.getDomainPrimaryLifecycleUtil(); + DomainClient primaryClient = domainPrimaryLifecycleUtil.getDomainClient(); + + DomainLifecycleUtil secondaryLifecycleUtil = testSupport.getDomainSecondaryLifecycleUtil(); + DomainClient secondaryClient = secondaryLifecycleUtil.getDomainClient(); + + // Verifies Primary Host Controller + verifyStability(primaryClient, HOST_PRIMARY.append(CORE_SERVICE_HOST_ENVIRONMENT)); + // Verifies Primary Host Controller managed server + verifyStability(primaryClient, HOST_PRIMARY.append(SERVER_MAIN_ONE).append(CORE_SERVICE_SERVER_ENVIRONMENT)); + + // Verifies Secondary Host Controller + verifyStability(secondaryClient, HOST_SECONDARY.append(CORE_SERVICE_HOST_ENVIRONMENT)); + // Verifies Secondary Host Controller managed server + verifyStability(secondaryClient, HOST_SECONDARY.append(SERVER_MAIN_THREE).append(CORE_SERVICE_SERVER_ENVIRONMENT)); + + // Verifies stability after other managed server reload operations + ModelNode params = new ModelNode(); + params.get(BLOCKING).set(true); + ModelNode op = Util.getOperation("reload-servers", PathAddress.EMPTY_ADDRESS, params); + DomainTestUtils.executeForResult(op, primaryClient); + + op = Util.getOperation("reload-servers", SERVER_GROUP_MAIN_SERVER_GROUP, params); + DomainTestUtils.executeForResult(op, primaryClient); + + // Verifies Primary Host Controller managed server + verifyStability(primaryClient, HOST_PRIMARY.append(SERVER_MAIN_ONE).append(CORE_SERVICE_SERVER_ENVIRONMENT)); + // Verifies Secondary Host Controller managed server + verifyStability(secondaryClient, HOST_SECONDARY.append(SERVER_MAIN_THREE).append(CORE_SERVICE_SERVER_ENVIRONMENT)); + + op = Util.getOperation("reload", HOST_PRIMARY.append(SERVER_MAIN_ONE), params); + DomainTestUtils.executeForResult(op, primaryClient); + + // Verifies Primary Host Controller managed server + verifyStability(primaryClient, HOST_PRIMARY.append(SERVER_MAIN_ONE).append(CORE_SERVICE_SERVER_ENVIRONMENT)); + // Verifies Secondary Host Controller managed server + verifyStability(secondaryClient, HOST_SECONDARY.append(SERVER_MAIN_THREE).append(CORE_SERVICE_SERVER_ENVIRONMENT)); + } + + private void verifyStability(DomainClient client, PathAddress address) throws IOException, MgmtOperationException { + ModelNode op = Util.getReadAttributeOperation(address, STABILITY); + ModelNode result = DomainTestUtils.executeForResult(op, client); + Stability stability = Stability.fromString(result.asString()); + Assert.assertEquals(desiredStability, stability); + } +} diff --git a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainTestSuite.java b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainTestSuite.java index eb7b842be6a..8825fee6057 100644 --- a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainTestSuite.java +++ b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainTestSuite.java @@ -58,6 +58,7 @@ ValidateOperationOperationTestCase.class, WildcardOperationsTestCase.class, ServerAuthenticationTestCase.class, + DomainStabilityTestCase.class }) public class DomainTestSuite { diff --git a/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java b/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java new file mode 100644 index 00000000000..2ea76461a8d --- /dev/null +++ b/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java @@ -0,0 +1,115 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.wildfly.test.snapshot; + +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CORE_SERVICE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST_ENVIRONMENT; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STABILITY; + +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + +import org.jboss.as.controller.PathAddress; +import org.jboss.as.controller.client.helpers.domain.DomainClient; +import org.jboss.as.controller.operations.common.Util; +import org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil; +import org.jboss.as.test.integration.domain.management.util.DomainTestSupport; +import org.jboss.as.test.integration.domain.management.util.DomainTestUtils; +import org.jboss.as.test.integration.domain.management.util.WildFlyManagedConfiguration; +import org.jboss.as.test.integration.management.util.MgmtOperationException; +import org.jboss.as.version.Stability; +import org.jboss.dmr.ModelNode; + +public class DomainSnapshot { + /** + * Takes a snapshot of the current state of the domain. + *

+ * Returns a AutoCloseable that can be used to restore the state + * + * @param testSupport The test support + * @return A closeable that can be used to restore the server + */ + public static AutoCloseable takeSnapshot(DomainTestSupport testSupport) { + try { + DomainLifecycleUtil primaryLifecycleUtil = testSupport.getDomainPrimaryLifecycleUtil(); + DomainClient primaryClient = primaryLifecycleUtil.getDomainClient(); + + WildFlyManagedConfiguration domainPrimaryConfiguration = testSupport.getDomainPrimaryConfiguration(); + WildFlyManagedConfiguration domainSecondaryConfiguration = testSupport.getDomainSecondaryConfiguration(); + + PathAddress hostPrimaryAddress = PathAddress.pathAddress(HOST, domainPrimaryConfiguration.getHostName()); + PathAddress hostSecondaryAddress = domainSecondaryConfiguration != null ? PathAddress.pathAddress(HOST, domainSecondaryConfiguration.getHostName()) : null; + + // take domain level snapshot + ModelNode result = DomainTestUtils.executeForResult(Util.createEmptyOperation("take-snapshot", null), primaryClient); + String domainConfig = result.asString(); + // Domain Config must be specified for reload operation being path relative to the JBoss Configuration Directory + Path relDomainConfigPath = findSnapShotRelativePath(domainConfig, domainPrimaryConfiguration); + + // take primary snapshot + final List snapShots = new ArrayList<>(); + Snapshot snapshot = takeHostSnapShot(hostPrimaryAddress, primaryLifecycleUtil, domainPrimaryConfiguration, relDomainConfigPath); + snapShots.add(snapshot); + + // take secondary snapshot if it exists + if (hostSecondaryAddress != null) { + snapshot = takeHostSnapShot(hostSecondaryAddress, testSupport.getDomainSecondaryLifecycleUtil(), domainSecondaryConfiguration, null); + snapShots.add(snapshot); + } + + return new AutoCloseable() { + @Override + public void close() throws Exception { + for (Snapshot snapshot : snapShots) { + snapshot.lifecycleUtil.reload(snapshot.hostName, snapshot.stability, snapshot.hostConfig, snapshot.domainConfig); + } + } + }; + } catch (Exception e) { + throw new RuntimeException("Failed to take snapshot", e); + } + } + + private static Snapshot takeHostSnapShot(PathAddress hostAddress, DomainLifecycleUtil lifecycleUtil, WildFlyManagedConfiguration configuration, Path relDomainConfigPath) throws IOException, MgmtOperationException { + DomainClient client = lifecycleUtil.getDomainClient(); + + ModelNode result = DomainTestUtils.executeForResult(Util.createEmptyOperation("take-snapshot", hostAddress), client); + String hostConfig = result.asString(); + Path relHostConfigPath = findSnapShotRelativePath(hostConfig, configuration); + + ModelNode op = Util.getReadAttributeOperation(hostAddress.append(PathAddress.pathAddress(CORE_SERVICE, HOST_ENVIRONMENT)), STABILITY); + result = DomainTestUtils.executeForResult(op, client); + Stability stability = Stability.fromString(result.asString()); + + return new Snapshot(relDomainConfigPath, relHostConfigPath.toString(), stability, lifecycleUtil); + } + + private static Path findSnapShotRelativePath(String absPath, WildFlyManagedConfiguration configuration) { + Path primaryConfigDir = Paths.get(configuration.getDomainDirectory()).resolve("configuration"); + Path absDomainConfigPath = Paths.get(absPath); + return primaryConfigDir.relativize(absDomainConfigPath); + } + + private static class Snapshot { + final String domainConfig; + final String hostConfig; + final Stability stability; + final String hostName; + final DomainLifecycleUtil lifecycleUtil; + + public Snapshot(Path domainConfig, String hostConfig, Stability stability, DomainLifecycleUtil lifecycleUtil) { + this.lifecycleUtil = lifecycleUtil; + this.hostName = lifecycleUtil.getConfiguration().getHostName(); + this.domainConfig = domainConfig != null ? domainConfig.toString() : null; + this.hostConfig = hostConfig; + this.stability = stability; + } + } +} diff --git a/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java b/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java new file mode 100644 index 00000000000..4f29f541779 --- /dev/null +++ b/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java @@ -0,0 +1,173 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.wildfly.test.stability; + +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CORE_SERVICE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST_ENVIRONMENT; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_OPERATION_DESCRIPTION_OPERATION; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_OPERATION_NAMES_OPERATION; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELOAD_ENHANCED; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STABILITY; + +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.jboss.as.controller.PathAddress; +import org.jboss.as.controller.client.ModelControllerClient; +import org.jboss.as.controller.client.helpers.domain.DomainClient; +import org.jboss.as.controller.operations.common.Util; +import org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil; +import org.jboss.as.test.integration.domain.management.util.DomainTestSupport; +import org.jboss.as.test.integration.domain.management.util.DomainTestUtils; +import org.jboss.as.test.integration.domain.management.util.WildFlyManagedConfiguration; +import org.jboss.as.test.integration.management.ManagementOperations; +import org.jboss.as.test.integration.management.util.MgmtOperationException; +import org.jboss.as.version.Stability; +import org.jboss.dmr.ModelNode; +import org.junit.Assert; +import org.junit.Assume; +import org.wildfly.test.snapshot.DomainSnapshot; + +/** + * A task to set up the domain to be reloaded to a desired stability level. + * The setup method will take a snapshot of the current domain configuration and reload the domain to the desired stability level. + * The tear down method will restore the domain to the original stability level. + */ +public class StabilityDomainSetupSnapshotRestoreTasks { + + private final Stability desiredStability; + private final DomainTestSupport testSupport; + private final PathAddress hostPrimaryAddress; + private final PathAddress hostSecondaryAddress; + private final Map hostAddresses = new HashMap<>(); + private AutoCloseable snapshot; + + /** + * Constructor + * + * @param desiredStability The stability level to which the domain should be reloaded + * @param testSupport The domain test support + */ + public StabilityDomainSetupSnapshotRestoreTasks(Stability desiredStability, DomainTestSupport testSupport) { + if (testSupport == null) { + throw new IllegalArgumentException("testSupport is null"); + } + this.desiredStability = desiredStability; + this.testSupport = testSupport; + + WildFlyManagedConfiguration domainPrimaryConfiguration = testSupport.getDomainPrimaryConfiguration(); + WildFlyManagedConfiguration domainSecondaryConfiguration = testSupport.getDomainSecondaryConfiguration(); + + hostPrimaryAddress = PathAddress.pathAddress(HOST, domainPrimaryConfiguration.getHostName()); + hostSecondaryAddress = domainSecondaryConfiguration != null ? PathAddress.pathAddress(HOST, domainSecondaryConfiguration.getHostName()) : null; + } + + public void setup() throws Exception { + assumeStability(hostPrimaryAddress, testSupport.getDomainPrimaryLifecycleUtil()); + assumeStability(hostSecondaryAddress, testSupport.getDomainSecondaryLifecycleUtil()); + + // Take a snapshot, indicating that when reloading we want to go back to the original stability + snapshot = DomainSnapshot.takeSnapshot(testSupport); + + // All good, let's do it! + reloadToDesiredStability(hostPrimaryAddress, testSupport.getDomainPrimaryLifecycleUtil(), desiredStability); + reloadToDesiredStability(hostSecondaryAddress, testSupport.getDomainSecondaryLifecycleUtil(), desiredStability); + } + + public void tearDown() throws Exception { + if (snapshot != null) { + snapshot.close(); + } + } + + private void assumeStability(PathAddress hostAddress, DomainLifecycleUtil domainLifecycleUtil) throws Exception { + if (domainLifecycleUtil == null) { + return; + } + + // Make sure the desired stability level is one of the ones supported by the server + Set supportedStabilityLevels = getSupportedStabilityLevels(hostAddress, domainLifecycleUtil.getDomainClient()); + + Assume.assumeTrue( + String.format("%s is not a supported stability level. Supported levels are %s", desiredStability, supportedStabilityLevels), + supportedStabilityLevels.contains(desiredStability)); + + + // Check the reload-enhanced operation exists in the current stability level + Assume.assumeTrue( + "The reload-enhanced operation is not registered at this stability level", + checkReloadEnhancedOperationIsAvailable(hostAddress, domainLifecycleUtil.getDomainClient())); + + // Check the reload-enhanced operation exists in the stability level we want to load to so that + // we can reload back to the current one + Stability reloadOpStability = getReloadEnhancedOperationStabilityLevel(hostAddress, domainLifecycleUtil.getDomainClient()); + Assume.assumeTrue(desiredStability.enables(reloadOpStability)); + } + + private Stability getReloadEnhancedOperationStabilityLevel(PathAddress hostAddress, ModelControllerClient managementClient) throws Exception { + ModelNode op = Util.createOperation(READ_OPERATION_DESCRIPTION_OPERATION, hostAddress); + op.get(NAME).set(RELOAD_ENHANCED); + + ModelNode result = ManagementOperations.executeOperation(managementClient, op); + String stability = result.get(STABILITY).asString(); + return Stability.fromString(stability); + } + + private Set getSupportedStabilityLevels(PathAddress hostAddress, ModelControllerClient managementClient) throws IOException, MgmtOperationException { + ModelNode op = Util.getReadAttributeOperation(hostAddress.append( + PathAddress.pathAddress(CORE_SERVICE, HOST_ENVIRONMENT)), + "permissible-stability-levels"); + + ModelNode result = ManagementOperations.executeOperation(managementClient, op); + Set set = new HashSet<>(); + for (ModelNode mn : result.asList()) { + set.add(Stability.fromString(mn.asString())); + } + return set; + } + + private boolean checkReloadEnhancedOperationIsAvailable(PathAddress hostAddress, ModelControllerClient managementClient) throws Exception { + ModelNode op = Util.createOperation(READ_OPERATION_NAMES_OPERATION, hostAddress.append(PathAddress.EMPTY_ADDRESS)); + ModelNode result = DomainTestUtils.executeForResult(op, managementClient); + for (ModelNode name : result.asList()) { + if (name.asString().equals(RELOAD_ENHANCED)) { + return true; + } + } + return false; + } + + private void reloadToDesiredStability(PathAddress hostAddress, DomainLifecycleUtil domainLifecycleUtil, Stability stability) throws Exception { + if (domainLifecycleUtil == null) { + // Ignore, this is the case when there is no secondary Host Controller configured on the domain + return; + } + + // Check the stability + DomainClient client = domainLifecycleUtil.getDomainClient(); + Stability currentStability = readCurrentStability(hostAddress, client); + if (currentStability == stability) { + return; + } + + //Reload the server to the desired stability level + domainLifecycleUtil.reload(hostAddress.getLastElement().getValue(), stability, null, null); + client = domainLifecycleUtil.getDomainClient(); + Stability reloadedStability = readCurrentStability(hostAddress, client); + Assert.assertEquals(stability, reloadedStability); + } + + private Stability readCurrentStability(PathAddress hostAddress, ModelControllerClient client) throws Exception { + ModelNode op = Util.getReadAttributeOperation(hostAddress.append(PathAddress.pathAddress(CORE_SERVICE, HOST_ENVIRONMENT)), STABILITY); + ModelNode result = ManagementOperations.executeOperation(client, op); + return Stability.fromString(result.asString()); + } +} diff --git a/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityServerSetupSnapshotRestoreTasks.java b/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityServerSetupSnapshotRestoreTasks.java index 7325b53845d..4d02b4e9baf 100644 --- a/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityServerSetupSnapshotRestoreTasks.java +++ b/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityServerSetupSnapshotRestoreTasks.java @@ -5,6 +5,17 @@ package org.wildfly.test.stability; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CORE_SERVICE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_OPERATION_DESCRIPTION_OPERATION; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_OPERATION_NAMES_OPERATION; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELOAD_ENHANCED; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STABILITY; +import static org.jboss.as.server.controller.descriptions.ServerDescriptionConstants.SERVER_ENVIRONMENT; + +import java.util.HashSet; +import java.util.Set; + import org.jboss.as.controller.PathAddress; import org.jboss.as.controller.client.ModelControllerClient; import org.jboss.as.controller.operations.common.Util; @@ -18,17 +29,6 @@ import org.wildfly.core.testrunner.ServerSetupTask; import org.wildfly.test.snapshot.ServerSnapshot; -import java.util.HashSet; -import java.util.Set; - -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CORE_SERVICE; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_OPERATION_DESCRIPTION_OPERATION; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_OPERATION_NAMES_OPERATION; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELOAD_ENHANCED; -import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STABILITY; -import static org.jboss.as.server.controller.descriptions.ServerDescriptionConstants.SERVER_ENVIRONMENT; - /** * For tests that need to run under a specific server stability level, * the server setup tasks from the inner classes can be used to change the stability level of the server to the desired level. @@ -54,7 +54,7 @@ public final void setup(ManagementClient managementClient) throws Exception { // Make sure the desired stability level is one of the ones supported by the server Set supportedStabilityLevels = getSupportedStabilityLevels(managementClient); Assume.assumeTrue( - String.format("%s is not a supported stability level", desiredStability, supportedStabilityLevels), + String.format("%s is not a supported stability level. The supported values are %s", desiredStability, supportedStabilityLevels), supportedStabilityLevels.contains(desiredStability)); // Check the reload-enhanced operation exists in the current stability level From b8257319e361f9bc456b3d16f0a1e4a72b783a69 Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Thu, 9 May 2024 09:16:25 +0100 Subject: [PATCH 3/7] [WFCORE-6815] Move Domain Mode stability test case outside of the Domain testsuite Jira issue: https://issues.redhat.com/browse/WFCORE-6815 --- .../domain/{suites => }/DomainStabilityTestCase.java | 10 ++++++---- .../integration/domain/suites/DomainTestSuite.java | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) rename testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/{suites => }/DomainStabilityTestCase.java (95%) diff --git a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainStabilityTestCase.java b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/DomainStabilityTestCase.java similarity index 95% rename from testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainStabilityTestCase.java rename to testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/DomainStabilityTestCase.java index 8bfe28cb60c..d532cb480e9 100644 --- a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainStabilityTestCase.java +++ b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/DomainStabilityTestCase.java @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package org.jboss.as.test.integration.domain.suites; +package org.jboss.as.test.integration.domain; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.BLOCKING; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CORE_SERVICE; @@ -61,7 +61,7 @@ public DomainStabilityTestCase(Stability desiredStability) { @BeforeClass public static void setupDomain() throws Exception { - testSupport = DomainTestSuite.createSupport(DomainStabilityTestCase.class.getSimpleName()); + testSupport = DomainTestSupport.createAndStartDefaultSupport(DomainStabilityTestCase.class.getSimpleName()); } @Before @@ -77,8 +77,10 @@ public void tearDown() throws Exception { @AfterClass public static void tearDownDomain() throws Exception { - testSupport = null; - DomainTestSuite.stopSupport(); + if (testSupport != null) { + testSupport.close(); + testSupport = null; + } } @Test diff --git a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainTestSuite.java b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainTestSuite.java index 8825fee6057..eb7b842be6a 100644 --- a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainTestSuite.java +++ b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DomainTestSuite.java @@ -58,7 +58,6 @@ ValidateOperationOperationTestCase.class, WildcardOperationsTestCase.class, ServerAuthenticationTestCase.class, - DomainStabilityTestCase.class }) public class DomainTestSuite { From 30e96b4f09cf5fb0a293a6e525eca81a03b88227 Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Mon, 13 May 2024 17:15:07 +0100 Subject: [PATCH 4/7] [WFCORE-6815] Verify the domain reloaded to the original stability when the Snapshoft is closed --- .../org/wildfly/test/snapshot/DomainSnapshot.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java b/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java index 2ea76461a8d..a69b36acf3f 100644 --- a/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java +++ b/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java @@ -26,6 +26,7 @@ import org.jboss.as.test.integration.management.util.MgmtOperationException; import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; +import org.junit.Assert; public class DomainSnapshot { /** @@ -69,6 +70,9 @@ public static AutoCloseable takeSnapshot(DomainTestSupport testSupport) { public void close() throws Exception { for (Snapshot snapshot : snapShots) { snapshot.lifecycleUtil.reload(snapshot.hostName, snapshot.stability, snapshot.hostConfig, snapshot.domainConfig); + PathAddress hostAddress = PathAddress.pathAddress(HOST, snapshot.hostName); + Stability reloadedStability = getStability(hostAddress, snapshot.lifecycleUtil.getDomainClient()); + Assert.assertSame(reloadedStability, snapshot.stability); } } }; @@ -84,13 +88,18 @@ private static Snapshot takeHostSnapShot(PathAddress hostAddress, DomainLifecycl String hostConfig = result.asString(); Path relHostConfigPath = findSnapShotRelativePath(hostConfig, configuration); - ModelNode op = Util.getReadAttributeOperation(hostAddress.append(PathAddress.pathAddress(CORE_SERVICE, HOST_ENVIRONMENT)), STABILITY); - result = DomainTestUtils.executeForResult(op, client); - Stability stability = Stability.fromString(result.asString()); + Stability stability = getStability(hostAddress, client); return new Snapshot(relDomainConfigPath, relHostConfigPath.toString(), stability, lifecycleUtil); } + private static Stability getStability(PathAddress hostAddress, DomainClient client) throws IOException, MgmtOperationException { + ModelNode result; + ModelNode op = Util.getReadAttributeOperation(hostAddress.append(PathAddress.pathAddress(CORE_SERVICE, HOST_ENVIRONMENT)), STABILITY); + result = DomainTestUtils.executeForResult(op, client); + return Stability.fromString(result.asString()); + } + private static Path findSnapShotRelativePath(String absPath, WildFlyManagedConfiguration configuration) { Path primaryConfigDir = Paths.get(configuration.getDomainDirectory()).resolve("configuration"); Path absDomainConfigPath = Paths.get(absPath); From c1859c906a55ac51ec658c3fcf88c562b30af106 Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Wed, 5 Jun 2024 15:49:33 +0100 Subject: [PATCH 5/7] [WFCORE-6815] Fix conflicts introduced by reload parameters usage --- .../management/util/DomainLifecycleUtil.java | 75 +++++++++++++++++-- .../wildfly/test/snapshot/DomainSnapshot.java | 7 +- ...bilityDomainSetupSnapshotRestoreTasks.java | 4 +- 3 files changed, 79 insertions(+), 7 deletions(-) diff --git a/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java b/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java index 9afe880b85f..b2317bbd798 100644 --- a/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java +++ b/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java @@ -4,6 +4,15 @@ */ package org.jboss.as.test.integration.domain.management.util; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADDRESS; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DOMAIN_CONFIG; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST_CONFIG; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELOAD; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELOAD_ENHANCED; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RESTART_SERVERS; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STABILITY; import static org.jboss.as.test.integration.domain.management.util.DomainTestSupport.safeClose; import java.io.File; @@ -104,7 +113,7 @@ private DomainLifecycleUtil(final WildFlyManagedConfiguration configuration, assert clientConfiguration != null : "clientConfiguration is null"; this.configuration = configuration; this.clientConfiguration = clientConfiguration; - this.address = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.HOST, configuration.getHostName())); + this.address = PathAddress.pathAddress(PathElement.pathElement(HOST, configuration.getHostName())); this.closeClientConfig = closeClientConfig; } @@ -444,17 +453,29 @@ public void reloadAdminOnly(String host, Long timeout) throws IOException, Inter */ public void reload(String host, ReloadParameters parameters) throws IOException, InterruptedException, TimeoutException { ModelNode op = new ModelNode(); - op.get(ModelDescriptionConstants.ADDRESS).add(ModelDescriptionConstants.HOST, host); - op.get(ModelDescriptionConstants.OP).set("reload"); + op.get(ADDRESS).add(HOST, host); + op.get(OP).set(RELOAD); op.get("admin-only").set(parameters.adminOnly); - op.get(ModelDescriptionConstants.RESTART_SERVERS).set(parameters.restartServers); + op.get(RESTART_SERVERS).set(parameters.restartServers); long startupTimeout; if (parameters.timeout == null) { startupTimeout = configuration.getStartupTimeoutInSeconds(); } else { startupTimeout = parameters.timeout; } - + if (parameters.hostConfig != null) { + op.get(HOST_CONFIG).set(parameters.hostConfig); + } + if (parameters.domainConfig != null) { + op.get(DOMAIN_CONFIG).set(parameters.domainConfig); + } + if (parameters instanceof ReloadEnhancedParameters) { + Stability stabilityParam = ((ReloadEnhancedParameters) parameters).stability; + if (stabilityParam != null) { + op.get(OP).set(RELOAD_ENHANCED); + op.get(STABILITY).set(stabilityParam.toString()); + } + } executeAwaitConnectionClosed(op); // Try to reconnect to the hc connect(); @@ -480,6 +501,10 @@ public static class ReloadParameters { Long timeout = null; + String hostConfig; + + String domainConfig; + /** * Sets the adminOnly * @@ -526,6 +551,46 @@ public ReloadParameters setTimeout(Long timeout) { this.timeout = timeout; return this; } + + /** + * Sets the hostConfig + * + * @param hostConfig the path to the host configuration file to use + * @return this ReloadParameters object + */ + public ReloadParameters setHostConfig(String hostConfig) { + this.hostConfig = hostConfig; + return this; + } + + /** + * Sets the domainConfig + * + * @param domainConfig the path to the domain configuration file to use + * @return this ReloadParameters object + */ + public ReloadParameters setDomainConfig(String domainConfig) { + this.domainConfig = domainConfig; + return this; + } + } + + /** + * Reload parameters to execute reload-enhanced operation + */ + public static class ReloadEnhancedParameters extends ReloadParameters { + Stability stability; + + /** + * Sets the stability + * + * @param stability the stability level to use + * @return this ReloadParameters object + */ + public ReloadParameters setStability(Stability stability) { + this.stability = stability; + return this; + } } /** diff --git a/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java b/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java index a69b36acf3f..ebbf85df58a 100644 --- a/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java +++ b/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java @@ -69,7 +69,12 @@ public static AutoCloseable takeSnapshot(DomainTestSupport testSupport) { @Override public void close() throws Exception { for (Snapshot snapshot : snapShots) { - snapshot.lifecycleUtil.reload(snapshot.hostName, snapshot.stability, snapshot.hostConfig, snapshot.domainConfig); + DomainLifecycleUtil.ReloadEnhancedParameters reloadParams = new DomainLifecycleUtil.ReloadEnhancedParameters(); + reloadParams.setStability(snapshot.stability) + .setHostConfig(snapshot.hostConfig) + .setDomainConfig(snapshot.domainConfig); + + snapshot.lifecycleUtil.reload(snapshot.hostName, reloadParams); PathAddress hostAddress = PathAddress.pathAddress(HOST, snapshot.hostName); Stability reloadedStability = getStability(hostAddress, snapshot.lifecycleUtil.getDomainClient()); Assert.assertSame(reloadedStability, snapshot.stability); diff --git a/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java b/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java index 4f29f541779..53ab62829d6 100644 --- a/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java +++ b/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java @@ -159,7 +159,9 @@ private void reloadToDesiredStability(PathAddress hostAddress, DomainLifecycleUt } //Reload the server to the desired stability level - domainLifecycleUtil.reload(hostAddress.getLastElement().getValue(), stability, null, null); + DomainLifecycleUtil.ReloadEnhancedParameters reload = new DomainLifecycleUtil.ReloadEnhancedParameters(); + reload.setStability(stability); + domainLifecycleUtil.reload(hostAddress.getLastElement().getValue(), reload); client = domainLifecycleUtil.getDomainClient(); Stability reloadedStability = readCurrentStability(hostAddress, client); Assert.assertEquals(stability, reloadedStability); From 172c712560e57c35e8fc6eddd1e7cdee12fbe3d7 Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Thu, 6 Jun 2024 13:30:08 +0100 Subject: [PATCH 6/7] [WFCORE-6815] Remove restart-servers attribute from reload-enhanced management operation --- .../controller/operations/HostProcessReloadHandler.java | 4 ++-- .../host/controller/descriptions/LocalDescriptions.properties | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/host-controller/src/main/java/org/jboss/as/domain/controller/operations/HostProcessReloadHandler.java b/host-controller/src/main/java/org/jboss/as/domain/controller/operations/HostProcessReloadHandler.java index fe2feff2ce1..3b4852e3863 100644 --- a/host-controller/src/main/java/org/jboss/as/domain/controller/operations/HostProcessReloadHandler.java +++ b/host-controller/src/main/java/org/jboss/as/domain/controller/operations/HostProcessReloadHandler.java @@ -67,9 +67,9 @@ public class HostProcessReloadHandler extends HostEnvironmentAwareProcessReloadH private static final AttributeDefinition[] SECONDARY_HC_ATTRIBUTES = new AttributeDefinition[] {ADMIN_ONLY, RESTART_SERVERS, USE_CURRENT_HOST_CONFIG, HOST_CONFIG}; - private static final AttributeDefinition[] ENHANCED_PRIMARY_HC_ATTRIBUTES = new AttributeDefinition[] {ADMIN_ONLY, RESTART_SERVERS, USE_CURRENT_DOMAIN_CONFIG, USE_CURRENT_HOST_CONFIG, DOMAIN_CONFIG, HOST_CONFIG, STABILITY}; + private static final AttributeDefinition[] ENHANCED_PRIMARY_HC_ATTRIBUTES = new AttributeDefinition[] {ADMIN_ONLY, USE_CURRENT_DOMAIN_CONFIG, USE_CURRENT_HOST_CONFIG, DOMAIN_CONFIG, HOST_CONFIG, STABILITY}; - private static final AttributeDefinition[] ENHANCED_SECONDARY_HC_ATTRIBUTES = new AttributeDefinition[] {ADMIN_ONLY, RESTART_SERVERS, USE_CURRENT_HOST_CONFIG, HOST_CONFIG, STABILITY}; + private static final AttributeDefinition[] ENHANCED_SECONDARY_HC_ATTRIBUTES = new AttributeDefinition[] {ADMIN_ONLY, USE_CURRENT_HOST_CONFIG, HOST_CONFIG, STABILITY}; private final HostControllerEnvironment environment; private final LocalHostControllerInfo hostControllerInfo; diff --git a/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties b/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties index eb4d22c2436..fd65c26527c 100644 --- a/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties +++ b/host-controller/src/main/resources/org/jboss/as/host/controller/descriptions/LocalDescriptions.properties @@ -124,7 +124,6 @@ host.reload.host-config=Use to override the name of the host config to use for t host.reload-enhanced=Reloads the Host Controller by shutting down all its services and starting again. The JVM itself is not restarted. Note however that this will lead to a full process restart for any server processes managed by this host controller. host.reload-enhanced.admin-only=Whether the Host Controller should start in running mode ADMIN_ONLY when it restarts. An ADMIN_ONLY Host Controller will start any configured management interfaces and accept management requests, but will not start servers or, if this host controller is the primary for the domain, accept incoming connections from secondary host controllers. -host.reload-enhanced.restart-servers=If true the servers will be reloaded, and if false the servers will be left running and reconnect to the Host Controller when started again. host.reload-enhanced.use-current-domain-config=Only has an effect if --read-only-domain-config was specified when starting the controller. In that case, if this parameter is set to false the reloaded controller loads the original configuration version; if null or true the current runtime version of the model is used. host.reload-enhanced.use-current-host-config=Only has an effect if --read-only-host-config was specified when starting the controller. In that case, if this parameter is set to false the reloaded controller loads the original configuration version; if null or true the current runtime version of the model is used. host.reload-enhanced.domain-config=Use to override the name of the domain config to use for the reloaded host controller. When making changes to the model after the reload, the changes will still be persisted to the original domain configuration file that was used to first boot up the host controller. This parameter is resolved the same way as the --domain-config command-line option. From 59589cbf6f9962c11e6b12d6f04c8eb4df33d67b Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Thu, 6 Jun 2024 13:31:32 +0100 Subject: [PATCH 7/7] [WFCORE-6815] Fix checkstyle errors --- .../integration/domain/management/util/DomainLifecycleUtil.java | 1 - 1 file changed, 1 deletion(-) diff --git a/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java b/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java index b2317bbd798..bb583edf178 100644 --- a/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java +++ b/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java @@ -56,7 +56,6 @@ import org.jboss.as.controller.client.helpers.ContextualModelControllerClient; import org.jboss.as.controller.client.helpers.domain.DomainClient; import org.jboss.as.controller.client.helpers.domain.ServerIdentity; -import org.jboss.as.controller.descriptions.ModelDescriptionConstants; import org.jboss.as.network.NetworkUtils; import org.jboss.as.test.shared.TestSuiteEnvironment; import org.jboss.as.version.Stability;