Bug 1688672

Summary: miq-utilities padding after $n(1) "9" became incorrect $n(2) "01"
Product: Red Hat CloudForms Management Engine Reporter: Gellert Kis <gekis>
Component: AutomateAssignee: Tina Fitzgerald <tfitzger>
Status: CLOSED WONTFIX QA Contact: Devidas Gaikwad <dgaikwad>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.10.0CC: abellott, dmetzger, duhlmann, ghubale, gmccullo, itewksbu, jcutter, jocarter, jprause, lavenel, mfeifer, mkanoor, mshriver, obarenbo, pmcgowan, tfitzger
Target Milestone: GAFlags: mfeifer: mirror+
Target Release: 5.12.0   
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: 2020-02-04 16:09:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1704905    
Attachments:
Description Flags
Automate Domain for Custom vm provisioning naming changes none

Comment 2 drew uhlmann 2019-03-15 15:49:44 UTC
I checked with Tina and we think this is working as designed.

Comment 3 Tina Fitzgerald 2019-03-15 18:35:32 UTC
I can understand the confusion, but this is currently working as designed.

The naming code checks for the first available suffix based on the prefix, and the number of digits specified.
In this case with $n(1) specified, it used 1 - 9, then found the first available 2 digit suffix which is 01.  Based on this, it's possible the next number after 9 could be anywhere up to 99, depending on the starting number for $n(2).

Comment 4 Tina Fitzgerald 2019-03-20 19:08:08 UTC
Hi Gellert,

Can I close this ticket?

Thanks,
Tina

Comment 12 Greg McCullough 2019-03-25 20:18:08 UTC
I have spent some time thinking about this topic recently and posted the follow proof-of-concept PR to further the discussion.

Gellert/Ian/Loic - I welcome comments/suggestions on how to move forward with this topic.

Comment 13 drew uhlmann 2019-03-25 20:39:34 UTC
https://github.com/ManageIQ/manageiq/pull/18590

Comment 14 Ian Tewksbury 2019-03-26 11:09:38 UTC
@Greg, I don't get what the -1 refers to or what would be other values passed in its place, but I like that it works. What were yout hinking if somsone passes in a value other then -1, such as 0,1,2,3, etc?

Comment 15 Greg McCullough 2019-03-26 13:44:30 UTC
The -1 value was just a proof-of-concept that we could parse out control parameters and still enumerate on the same naming sequence.  Meaning "$n{3}" and "$n{3, -1}" would end up using the same enumeration counter on the region.

Otherwise, I put the PR out there to ask for suggestions.  How would you want to specify that you want to use a different naming pattern?  Ignoring the PR I created.

Would we use named algorithms?
  For example, "$n{3, zero-padded}"

What other concepts or best practices could be used here?

This opens up the ability to extend the available naming patterns.  I recall seeing an RFE a long time ago asking to use hex values in the name, which could be another possible naming algorithms that gets implemented.

I will note that these changes create the undesirable side effect that we could generate duplicate names and I still need to determine if there is a solution for this.

Based on the current PR "$n{1, -1}" and "$n{2}" would overlap once the enumeration value was over 9.
"$n{1, -1}" : machine8,  machine9,  machine10
"$n{2}"     : machine08, machine09, machine10

It is a timing issue, but if provision1 uses "$n{1, -1}" and selects "machine10" because it does not exist, a second provision task could use "$n{2}" and also potentially select "machine10" if the VM name from provision1 does not exist in the database yet.

This is why you see the behavior with the existing code today.  We bump the "padding" value to ensure that the returned numbers is always unique within the region.  So when we increase from 1 to 2 digits we increase the padding value to ensure any task requesting a two digit name is guaranteed to get a unique value.  By forcing the padding to stay 1 we lose that guarantee.

Comment 16 Ian Tewksbury 2019-03-26 14:13:20 UTC
I like it. But I am one voice.

Comment 17 Greg McCullough 2019-03-26 16:05:02 UTC
Loic, Gellert - Any thoughts on the information I supplied in comment #15?

All - My comment above was asking for advice/suggestions on what you would want to see implemented.  Based on comment #9 I would expect/welcome more feedback.

Comment 23 Tina Fitzgerald 2019-06-06 20:26:10 UTC
Hi Greg,

Can we discuss?

Thanks,
Tina

Comment 24 dmetzger 2019-06-10 15:03:26 UTC
When implementing, need to clearly articulate in release notes the change in behavior. If possible, provide a configuration option to enable the old behavior for customers relying on it.

Comment 25 Tina Fitzgerald 2019-07-24 18:34:52 UTC
Hi Peter,

Can we discuss?

Thanks,
Tina

Comment 26 Peter McGowan 2019-08-02 08:58:07 UTC
Hi Tina, sorry I missed this. Sure, happy to discuss.

Comment 27 Marianne Feifer 2020-01-23 20:22:08 UTC
See https://github.com/ManageIQ/manageiq/issues/19756

Comment 34 Tina Fitzgerald 2020-04-07 18:19:17 UTC
Created attachment 1677033 [details]
Automate Domain for Custom vm provisioning naming changes