Bug 1615418

Summary: Import cluster job can be created via API right after previous import failed
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: Filip Balák <fbalak>
Component: web-admin-tendrl-apiAssignee: Jeff Brown <jefbrown>
Status: CLOSED WONTFIX QA Contact: sds-qe-bugs
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rhgs-3.4CC: nthomas, rhs-bugs, sankarshan
Target Milestone: ---Keywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-06 10:22:50 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:
Embargoed:

Description Filip Balák 2018-08-13 14:39:50 UTC
Description of problem:
It is possible to initiate cluster import via API when previous import failed and unmanage was not yet performed. Import should not be possible as stated in https://bugzilla.redhat.com/show_bug.cgi?id=1516135#c16

Version-Release number of selected component (if applicable):
tendrl-ansible-1.6.3-6.el7rhgs.noarch
tendrl-api-1.6.3-5.el7rhgs.noarch
tendrl-api-httpd-1.6.3-5.el7rhgs.noarch
tendrl-commons-1.6.3-11.el7rhgs.noarch
tendrl-grafana-plugins-1.6.3-8.el7rhgs.noarch
tendrl-grafana-selinux-1.5.4-2.el7rhgs.noarch
tendrl-monitoring-integration-1.6.3-8.el7rhgs.noarch
tendrl-node-agent-1.6.3-9.el7rhgs.noarch
tendrl-notifier-1.6.3-4.el7rhgs.noarch
tendrl-selinux-1.5.4-2.el7rhgs.noarch
tendrl-ui-1.6.3-9.el7rhgs.noarch

How reproducible:
100%

Steps to Reproduce:
1. Install WA and prepare cluster.
2. Break WA repourl on one storage machine.
3. Import cluster via UI. Import fails and import button is disabled as expected but there is a way to initiate Import job via API.
3. Execute:
curl -H 'Content-Type: application/json' -d '{"username":<admin-user>, "password": <password>}' <wa-server>/api/1.0/login
3. Execute:
curl -XPOST -H "Authorization: Bearer <token>" -H "Content-Type: application/json" -d '{ "volume_profiling_flag": "enable" }'
<wa-server>/api/1.0/clusters/<not-imported-cluster-id>/import
as described in https://github.com/Tendrl/api/blob/master/docs/clusters.adoc#import-cluster

Actual results:
Import Cluster job is created. The job fails with error: `Failed post-run: tendrl.objects.Cluster.atoms.SetupClusterAlias for flow: Import existing Gluster Cluster` after a while. This job can be created also when the issue with bad repourl is resolved. In that case the job fails with the same error.

Expected results:
There should be some message stating that user needs to resolve issue and unmanage cluster before importing again or appropriate error code should be returned.

Additional info:

Comment 3 Nishanth Thomas 2018-12-06 10:22:50 UTC
Not planning to address this issue in any of the upcoming releases.This won't occur in normal cases(operating from UI). Closing this issue