Bug 1724631

Summary: There are flavors for ec2 provider that cannot be provisioned
Product: Red Hat CloudForms Management Engine Reporter: Matouš Mojžíš <mmojzis>
Component: ProvidersAssignee: Adam Grare <agrare>
Status: CLOSED CURRENTRELEASE QA Contact: Matouš Mojžíš <mmojzis>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.11.0CC: agrare, dmetzger, jfrey, jhardy, jocarter, obarenbo, simaishi, smallamp
Target Milestone: GA   
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: cloud:provider:flavor
Fixed In Version: 5.11.0.23 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-13 14:54:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: AWS Target Upstream Version:
Embargoed:
Attachments:
Description Flags
evm.log for c5n provision none

Description Matouš Mojžíš 2019-06-27 12:51:34 UTC
Description of problem:


Version-Release number of selected component (if applicable):
5.11.0.10

How reproducible:
Always

Steps to Reproduce:
1. Add an ec2 provider
2. Provision instance
3. In flavor selection check flavor types

Actual results:
There are flavor types like a1, c3 without suffix which have no memory.
These types can be selected for provision and provision fails then.

Expected results:
If these types are needed like family of types or something like that then:
1) It shouldn't be able to select for provisioning
2) All flavor type families should have this type

Additional info:

Comment 2 Adam Grare 2019-06-27 12:53:14 UTC
Can you provide the backtrace from the failure?

Comment 4 Alexander Zagaynov 2019-07-12 14:50:30 UTC
"c3" is an obsolete ("previous generation") instance type: https://aws.amazon.com/ec2/previous-generation/
And it is marked this way in MiQ: https://github.com/ManageIQ/manageiq-providers-amazon/blob/805354461da8c9b520ff782653516cea86a253be/db/fixtures/aws_instance_types.yml#L241

It is also marked as "DEPRECATED": https://github.com/ManageIQ/manageiq-providers-amazon/blob/805354461da8c9b520ff782653516cea86a253be/db/fixtures/aws_instance_types.yml#L243
And should be excluded from "AVAILABLE_TYPES": https://github.com/ManageIQ/manageiq-providers-amazon/blob/805354461da8c9b520ff782653516cea86a253be/app/models/manageiq/providers/amazon/instance_types.rb#L19

However, `instance_types` method uses `ALL_TYPES` constant, and just removes specifically disabled types: https://github.com/ManageIQ/manageiq-providers-amazon/blob/805354461da8c9b520ff782653516cea86a253be/app/models/manageiq/providers/amazon/instance_types.rb#L23
I don't know, do we have any such "creation protection" feature in UI or not, but if not - it seems to me to be the RFE, which should be probably addressed to UI team.

Adam, maybe you know - do we handle such "obsoleteness" somehow?
Why are those constants needed if they seems to be unused?

Comment 5 Alexander Zagaynov 2019-07-12 14:52:49 UTC
Matous, can you please try to provision "a1" instance type, which is "current generation" currently: https://github.com/ManageIQ/manageiq-providers-amazon/blob/805354461da8c9b520ff782653516cea86a253be/db/fixtures/aws_instance_types.yml#L6 ?
What logs will say?

Comment 6 Matouš Mojžíš 2019-07-14 19:36:01 UTC
Alex, 

it doesn't matter which instance type I try to provision when it has no suffix.
The problem is that there are instance types that don't exist in AWS, because they have no suffix.
I tried with c5n instance type (I had no images for arm architecture to test a1 instances) which should be fresh enough.

Comment 7 Matouš Mojžíš 2019-07-14 19:36:25 UTC
Created attachment 1590556 [details]
evm.log for c5n provision

Comment 8 Alexander Zagaynov 2019-07-17 15:26:22 UTC
PR: https://github.com/ManageIQ/manageiq-providers-amazon/pull/546

Comment 9 Alexander Zagaynov 2019-09-03 17:27:12 UTC
PR: https://github.com/ManageIQ/manageiq-providers-amazon/pull/554

Comment 10 Alexander Zagaynov 2019-09-03 20:19:22 UTC
merged

Comment 11 CFME Bot 2019-09-03 20:31:09 UTC
New commit detected on ManageIQ/manageiq-providers-amazon/ivanchuk:

https://github.com/ManageIQ/manageiq-providers-amazon/commit/799ec026e1382b3d0cc78867881afa6836a5e3e4
commit 799ec026e1382b3d0cc78867881afa6836a5e3e4
Author:     Adam Grare <agrare>
AuthorDate: Tue Sep  3 15:12:44 2019 -0400
Commit:     Adam Grare <agrare>
CommitDate: Tue Sep  3 15:12:44 2019 -0400

    Merge pull request #554 from AlexanderZagaynov/BZ-1724686_metal_type_names

    add metal to names and remove dedicated

    (cherry picked from commit caaa4e5eed895184f85c5e551bf3d3a128077477)

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1724686
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1724631

 db/fixtures/aws_instance_types.yml | 794 +-
 spec/models/manageiq/providers/amazon/aws_refresher_spec_counts.rb | 2 +-
 spec/models/manageiq/providers/amazon/cloud_manager/stubbed_refresher_spec.rb | 2 +-
 3 files changed, 20 insertions(+), 778 deletions(-)

Comment 12 Matouš Mojžíš 2019-09-06 09:47:26 UTC
Verified in 5.11.0.23. All the EC2 instance types in CFME are provisionable.