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 1058509

Summary: CreateResourceRunner treats CreateResourceStatus.INVALID_CONFIGURATION and INVALID_ARTIFACT as successful statuses
Product: [JBoss] JBoss Operations Network Reporter: Larry O'Leary <loleary>
Component: Plugin ContainerAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED NOTABUG QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: unspecified    
Version: JON 3.2CC: ksuzumur, lzoubek, tsegismo
Target Milestone: ---   
Target Release: JON 3.3.1   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1181068 (view as bug list) Environment:
Last Closed: 2015-01-12 10:27:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Larry O'Leary 2014-01-27 23:23:13 UTC
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:

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");
    var cacheContainer = ResourceManager.findResourcesByCriteria(resCrit).get(0);

    var resTypeCrit = new ResourceTypeCriteria();
    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?

Comment 2 Libor Zoubek 2015-01-12 10:20:26 UTC
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.

Comment 3 Libor Zoubek 2015-01-12 10:27:42 UTC
Closing as NOTABUG, Bug 1181068 has been filed instead