Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WFLY-11117 Executing legacy operations in mod_cluster subsystem #11726

Merged
merged 3 commits into from Nov 9, 2018

Conversation

rhusar
Copy link
Member

@rhusar rhusar commented Oct 9, 2018

@rhusar
Copy link
Member Author

rhusar commented Oct 9, 2018

@honza-kasik Do you want to pretest this?

@honza-kasik
Copy link
Contributor

@rhusar Did a manual pretest and it seems to me, that issue is fixed. Thanks!

return translateProxyPath(context, context.getCurrentAddress().getParent());
}

static PathAddress translateProxyPath(OperationContext context, PathAddress address) throws OperationFailedException {
Set<Resource.ResourceEntry> children = context.readResourceFromRoot(address).getChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be context.readResourceFromRoot(address, false).....

This isn't a flaw in this PR but might as well fix it. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks for spotting this.

ServiceName serviceName = ProxyConfigurationResourceDefinition.Capability.SERVICE.getServiceName(proxyAddress);
return context.getServiceRegistry(false).getService(serviceName);
return new ActiveServiceSupplier<ModClusterServiceMBean>(context.getServiceRegistry(false), serviceName).get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a lot of the uses of this method, this should be context.getServiceRegistry(true).

It doesn't need to be for the getService(context) != null checks, but for the other ones if the handler is changing any state it should be 'true'.

     * <strong>Note:</strong> It is very important that the {@code modify} parameter accurately reflect whether the
     * caller intends to make any modifications to any object reachable, directly or indirectly, from the returned
     * {@link ServiceRegistry}. This includes modifying any {@link ServiceController},
     * {@link org.jboss.msc.service.Service}, {@link org.jboss.msc.value.Value} or any object reachable from a value.
     *
     * @param modify {@code true} if the operation may be modifying any object reachable directly or indirectly from
     *                           the returned {@link ServiceRegistry}, {@code false} otherwise

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed (not sure what it is for though and I assume there would be other usages of this incorrectly passing false, assuming its modifications to the registry itself, not the object internal state).

@@ -172,15 +171,15 @@ public ModelNode execute(ExpressionResolver expressionResolver, ModelNode operat
public ModelNode execute(ExpressionResolver expressionResolver, ModelNode operation, ModClusterServiceMBean service) {
boolean enabled = service.enable();

return new ModelNode().get(ModelDescriptionConstants.RESULT).set(enabled);
return new ModelNode(enabled);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these enums don't override 'apply' and thus don't configure an OperationDescription that describe any reply at all. OTOH that maybe gives you freedom to change the undocumented reply type. OTOH, it's not a correct description.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was not the intention. Opened https://issues.jboss.org/browse/WFLY-11246 to address these.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed now in master.

@rhusar
Copy link
Member Author

rhusar commented Oct 31, 2018

@bstansberry Please update your review, thanks! :-)

@rhusar
Copy link
Member Author

rhusar commented Nov 7, 2018

@bstansberry Thanks!

@bstansberry bstansberry added the ready-for-merge Only for use by those with merge permissions! label Nov 8, 2018
@bstansberry
Copy link
Contributor

Sorry it took so long!

jamezp added a commit that referenced this pull request Nov 8, 2018
LegacyMetricOperationsRegistration#translateProxyPath need not read resource recursively
jamezp added a commit to jamezp/wildfly that referenced this pull request Nov 8, 2018
LegacyMetricOperationsRegistration#translateProxyPath need not read resource recursively
@jamezp jamezp merged commit 2fc297e into wildfly:master Nov 9, 2018
@rhusar rhusar deleted the WFLY-11117 branch November 9, 2018 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Only for use by those with merge permissions!
Projects
None yet
4 participants