Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1181068 - Properly implement CreateChildResourceFacet when creating Cache resource
Summary: Properly implement CreateChildResourceFacet when creating Cache resource
Keywords:
Status: ASSIGNED
Alias: None
Product: JBoss Data Grid 6
Classification: JBoss
Component: JON Plugin
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 6.5.0
Assignee: William Burns
QA Contact: Martin Gencur
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-12 10:25 UTC by Libor Zoubek
Modified: 2018-12-06 18:10 UTC (History)
11 users (show)

Doc Type: Bug Fix
Doc Text:
Clone Of: 1058509
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 702083 None None None Never

Comment 1 Larry O'Leary 2015-01-12 17:12:43 UTC
Based on description this seems like a JBoss Data Grid management plug-in bug. Therefore it needs to be in the Data Grid bug tracker. For visibility the original description is:

Based on bellow, JDG plugin incorrectly returns CreateResourceStatus.INVALID_CONFIGURATION or CreateResourceStatus.INVALID_ARTIFACT in case invalid/incomplete configuration has been passed and does not create the resource.

CreateResourceStatus.INVALID_CONFIGURATION javadoc says:

The resource was created, however there were errors configuring it. The likely cause is that one or more values in the configuration failed plugin-side validation. The resource will appear as created and will be discovered,
 owever it may not function correctly until the configuration errors are corrected.

In case plugin knows it is not able to create resource because of invalid plugin configuration or any other error, it must return CreateResourceStatus.FAILURE with apropriate mesage.

+++ This bug was initially created as a clone of Bug #1058509 +++

Description of problem:
CreateResourceRunner treats CreateResourceStatus.INVALID_CONFIGURATION and CreateResourceStatus.INVALID_ARTIFACT as successful creation requests. This seems to be invalid as such a request returning this state seems to indicate that the creation was probably aborted due to invalid configuration.

If a CLI request is made and a required property value is omitted, the plug-in may set its CreateResourceReport status to CreateResourceStatus.INVALID_CONFIGURATION and set the error message to indicate which required property value was missing. However, due to CreateResourceRunner treating this status as a success, the error message is lost and the user is never notified of the actual failure.

Version-Release number of selected component (if applicable):
4.9.0.JON320GA (734bd56)

How reproducible:
Always

Steps to Reproduce:
1. Install and start JDG 6.2 server using clustered.xml.
2. Install and start JON 3.2 system.
3. Import JDG 6.2 server into inventory.
4. Configure JDG connection settings.
5. Run the following JON CLI commands:J

    var resCrit = new ResourceCriteria();
    resCrit.addFilterResourceTypeName("Cache Container");
    resCrit.addFilterName("clustered");
    resCrit.setStrict(true);
    var cacheContainer = ResourceManager.findResourcesByCriteria(resCrit).get(0);

    var resTypeCrit = new ResourceTypeCriteria();
    resTypeCrit.addFilterName("Cache");
    resTypeCrit.fetchResourceConfigurationDefinition(true);
    resTypeCrit.fetchPluginConfigurationDefinition(true);
    resTypeCrit.setStrict(true);
    var cacheResType = ResourceTypeManager.findResourceTypesByCriteria(resTypeCrit).get(0);

    var cacheConfiguration = new Configuration();
    cacheConfiguration.setSimpleValue("mode", "SYNC");
    cacheConfiguration.setSimpleValue("segments", "90");
    cacheConfiguration.setSimpleValue("owners", "2");
    cacheConfiguration.setSimpleValue("start", "EAGER");
    cacheConfiguration.setSimpleValue("remote-timeout", "60000");
    #cacheConfiguration.setSimpleValue("_flavor", "distributed-cache");

    var newCacheName = "MyCache";
    ResourceFactoryManager.createResource(res.getId(), cacheResType.getId(), newCacheName, null, cacheConfiguration, 60000);


Actual results:
Creation of child resource will fail and report:

    Plugin did not indicate a resource name for this request.

Expected results:
Creation of child resource will fail and report:

    No flavor given

Additional info:
CreateResourceRunner.isSuccessStatus(CreateResourceStatus status) seems to be the issue here. Perhaps a missing key and name should only be an issue if CreateResourceStatus.SUCCESS is set on the report. In cases where CreateResourceStatus.SUCCESS is not the status of the create report then the original error message from the report should be retained?

It isn't clear to me why we would ever want a non-SUCCESS status to mean success? Perhaps we have some plug-ins that return failure to indicate that something was missing but still proceed with the creation of the resource?

--- Additional comment from Libor Zoubek on 2015-01-12 05:20:26 EST ---

This is a plugin issue.

CreateResourceStatus.INVALID_CONFIGURATION javadoc says:

The resource was created, however there were errors configuring it. The likely cause is that one or more values in the configuration failed plugin-side validation. The resource will appear as created and will be discovered,
 owever it may not function correctly until the configuration errors are corrected.

In case plugin knows it is not able to create resource because of invalid plugin configuration or any other error, it must return CreateResourceStatus.FAILURE with apropriate mesage.


Note You need to log in before you can comment on or make changes to this bug.