Bug 1259072

Summary: Infinite loop when trying to modify or add a district.
Product: OpenShift Container Platform Reporter: Eric Rich <erich>
Component: InstallerAssignee: Rory Thrasher <rthrashe>
Status: CLOSED ERRATA QA Contact: Ma xiaoqiang <xiama>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.2.0CC: aos-bugs, erich, jokerman, mmccomas, rthrashe, xtian, yanpzhan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 16:36:53 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 Eric Rich 2015-09-01 22:16:54 UTC
Description of problem:

Select an action from below:
1. Add a district
2. Modify a district
Type a selection and press <return>: 1

What is the name of the district? medium_district

What gear size will be associated with this district?:
1. small
2. medium
Type a selection and press <return>: 2

Currently there are no Node hosts associated with this district.

Choose a Node host to add to this district:
1. ose-node1.paas.it (current district: small_district)
Type a selection and press <return>: 
Ambiguous choice.  Please choose one of ["1", "ose-node1.paas.it
(current district: small_district)"].
?  0
You must choose one of ["1", "ose-node1.paas.it (current district:
small_district)"].
?  1

There is only one Node associated with the small_district district. If
you move it to another district, this district will be automatically
deleted. Is it okay to proceed? (y/n/q) n

---------------

I only have 1 node defined, however I would like to add a medium district with no nodes as part of the install.

Comment 1 Eric Rich 2015-09-01 22:23:33 UTC
Simply hitting ctrl+c in the loop allows me to achieve the desired effect, when I review the deployment information from a subsequent run. 

+-----------------+-----------+-------------------+
| District        | Gear Size | Nodes             |
+-----------------+-----------+-------------------+
| small_district  | small     | ose-node1.paas.it |
| medium_district | medium    |                   |
+-----------------+-----------+-------------------+

Comment 3 Rory Thrasher 2015-11-02 16:25:10 UTC
Is the desired effect to create a district without ANY node?  Or is it to create a new district and node combination?

Would creating an option to add a new node (to be paired with the new district) solve this?  For example, something like:


Currently there are no Node hosts associated with this district.

Choose a Node host to add to this district:
1. ose-node1.paas.it (current district: small_district)
2. Create a new node for this district
Type a selection and press <return>:

Comment 4 Eric Rich 2015-11-02 16:53:55 UTC
Correct I would like to create a district with out a node! 

In short the big complaint here is that we don't explain "why we are in the loop". There is no feedback to the user that explains what is / is not possible.

Comment 5 Rory Thrasher 2015-11-09 16:22:20 UTC
https://github.com/openshift/openshift-extras/pull/537


PR adds a check for the condition which will result in this possible loop.  The condition is when each district has exactly one node. The script will offer an alternative path to create a node before creating a district.  Users can still continue into the loop area if they want to move a node and destroy the old district.


In the case where each district has exactly one node and the user attempts to add a district, an additional question should ask the user if they want to create a node to be associated with the new district.  If the user chooses that option, they should be taken through the add node process to add a node to an existing district, so that when the add district process is run, there is an extra node that can be moved, avoiding the loop.

If the user chooses to continue without creating a new node, they should end up needing to delete a district in order to move a node to the new district.

This question should not appear if attempting to add a district where there are more nodes than there are districts.

Comment 6 Yanping Zhang 2015-11-10 08:58:38 UTC
Rory, could you provide your code in a url that QE can run oo-install anainst to verify the bug? Similar to https://install.openshift.com/ose-2.2. Thanks!

Comment 7 Rory Thrasher 2015-11-10 19:20:25 UTC
Yanping,

This should run oo-install with my changes.  Let me know how well it works.


sh <(curl -s https://ooinstall-thrasherredhat.rhcloud.com/bug1259072)

Comment 8 Yanping Zhang 2015-11-11 04:15:44 UTC
Tested with 
sh <(curl -s https://ooinstall-thrasherredhat.rhcloud.com/bug1259072)
Steps to test:
1.Prepare 3 hosts.
2.Run sh <(curl -s https://ooinstall-thrasherredhat.rhcloud.com/bug1259072) on one host. 
3.When configure one node in default destrict,then add district:
3.1 When choose "1. Create a new Node to be associated with the new district
", it will process to add new node to the new district.
3.2 When choose "2. Continue process and delete an existing district to free a Node", it will process to move a node to the new district and delete the old district without node automatically.
3.3,When press CTRL+C as answer to adding new node or moving node to district, it will exit and no new district is created.
4.When configure 2 nodes in default destrict, then add district:
It displays:
<--snip-->
Currently there are no Node hosts associated with this district.

Choose a Node host to add to this district:
1. node1.hosts.ose22.com (current district: Default)
2. node2.hosts.ose22.com (current district: Default)
Type a selection and press <return>: 
<--snip-->
User could choose one node and move to the new district.
But there is no option for user to create a new Node with the new district.

From the test, now user can add district smoothly. 
Is it possible to add an option for step 4 scenario? such as "Create a new Node to be associated with the new district", since user would like to preserve the original 2 nodes in the default district but not move them.

Comment 9 Rory Thrasher 2015-11-11 16:17:22 UTC
+1

I can definitely make the option to add a node available whenever a district is created.  I'll add that and get back to you.

Comment 10 Rory Thrasher 2015-11-11 22:21:54 UTC
Updated PR: https://github.com/openshift/openshift-extras/pull/537
Updated oo-install code: sh <(curl -s https://ooinstall-thrasherredhat.rhcloud.com/bug1259072)


When attempting to add a district, script should always ask if user wants to create a node first.  Users will be able to accept and create a node, or continue without creating a node, meaning they must move a node from an existing district.


In the case where each district has exactly one node, the menu question will emphasize that a district will be destroyed.  Users will be able to accept and create a new node, or continue without creating a node, meaning they must delete a district to move a node to the new district.


The question "Choose a Node host to add to this district" should now mention that users can respond with 'q' to exit the action.  Responding with 'q' should exit that function and return to the deployment configuration options menu.

Comment 11 Yanping Zhang 2015-11-12 10:24:13 UTC
Tested on sh <(curl -s https://ooinstall-thrasherredhat.rhcloud.com/bug1259072).
Steps to test:
1.Prepare 3 hosts.
2.Run sh <(curl -s https://ooinstall-thrasherredhat.rhcloud.com/bug1259072) on one host. 
3.When create new district no matter how many nodes exist, user could choose to create a new node or move a node.
4.When choose "q" for question "Choose a Node host to add to this district", it jump back to deployment configuration menu successfully.

Since the bug has been fixed, so move it to Verified.

Comment 12 Bernie Hoefer 2015-11-12 22:09:03 UTC
Thank you for changing oo-install so the customer can accomplish his goal -- "to add a medium district with no nodes as part of the install."  Looking at the output:

  Choose a Node host to add to this district
  Remember, you can always respond with 'q' to exit

...I wonder if it needs to explicitly state that the district will be created without a node.  I can see where a user may think answering "q" will cancel the district creation process.

Comment 13 Rory Thrasher 2015-11-13 16:59:03 UTC
Sorry for the confusion - some of the conversation for how to fix this bug happened offline and wasn't accurately reported to this bugzilla report.

The fix is NOT intended to allow users to create empty districts.  After a few discussions, it was determined that empty districts were not a desired outcome of oo-install, so the ability to abort with control-c (or responding with 'q') was deemed a separate bug (see https://bugzilla.redhat.com/show_bug.cgi?id=1278933).  

The purpose of this fix is to avoid the infinite loop.  When users attempt to create a district, they are asked if they want to create a node first that can be paired with the district.  If declining would put them in the situation where they are forced to delete an existing district or continue in the infinite loop, users are warned that they will have to delete an existing district.  Finally, if a user does find themselves in the loop, they are reminded that there is a hidden menu option 'q' to exit out of the loop.

Comment 14 Bernie Hoefer 2015-11-13 18:50:51 UTC
(In reply to Rory Thrasher from comment #13)
===
> The fix is NOT intended to allow users to create empty districts.  After
> a few discussions, it was determined that empty districts were not
> a desired outcome of oo-install,
===

Thanks for the clarification.  In looking over the support case notes, I think that might be fine, but I've reached out to the customer to make sure.

Comment 15 Bernie Hoefer 2016-01-07 16:10:47 UTC
(In reply to Bernie Hoefer from comment #14)
===
> Thanks for the clarification.  In looking over the support case notes, I
> think that might be fine, but I've reached out to the customer to make sure.
===

The customer closed the case without commenting on this, so please continue with focus just on the infinite loop issue, ignoring the empty districts subject.  Thanks.

Comment 17 errata-xmlrpc 2016-05-12 16:36:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1065