Bug 1488313

Summary: [NoMethodError]: undefined method `root_disk_size' for nil:NilClass')] when provisioning VM using service catalog
Product: Red Hat CloudForms Management Engine Reporter: Sachin <sacpatil>
Component: ProvisioningAssignee: Greg McCullough <gmccullo>
Status: CLOSED NOTABUG QA Contact: Dave Johnson <dajohnso>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 5.8.0CC: greartes, jhardy, obarenbo, sacpatil
Target Milestone: GA   
Target Release: cfme-future   
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: 2017-09-05 14:48:18 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:
Bug Depends On:    
Bug Blocks: 1465087    
Attachments:
Description Flags
dialog none

Description Sachin 2017-09-05 06:43:46 UTC
Created attachment 1322074 [details]
dialog

Description of problem:

When service dialog as 'instance_type' has one of the field the provision fails throwing error
~~~
[----] I, [2017-09-04T11:53:09.309923 #15662:9e9134]  INFO -- : Q-task_id([miq_provision_78000000000013]) Starting Phase <provision_error>
[----] E, [2017-09-04T11:53:09.330479 #15662:9e9134] ERROR -- : Q-task_id([miq_provision_78000000000013]) MIQ(ManageIQ::Providers::Openstack::CloudManager::Provision#provision_error) [[NoMethodError]: undefined 
method `root_disk_size' for nil:NilClass] encountered during phase [prepare_volumes]
[----] E, [2017-09-04T11:53:09.330592 #15662:9e9134] ERROR -- : Q-task_id([miq_provision_78000000000013]) /var/www/miq/vmdb/app/models/manageiq/providers/openstack/cloud_manager/provision/volume_attachment.rb:38
:in `default_volume_attributes'
/var/www/miq/vmdb/app/models/manageiq/providers/openstack/cloud_manager/provision/volume_attachment.rb:3:in `create_requested_volumes'
/var/www/miq/vmdb/app/models/manageiq/providers/cloud_manager/provision/state_machine.rb:14:in `prepare_volumes'
~~~

This error is then caught by AE's miq_provision.message when lead to automation failure

~~~
[----] I, [2017-09-04T11:54:12.780168 #15654:9e9134]  INFO -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> Method exited with rc=MIQ_OK
[----] I, [2017-09-04T11:54:12.780715 #15654:9e9134]  INFO -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> Followed  Relationship [miqaedb:/Cloud/VM/Provisioning/StateMachines/Methods/CheckProv
isioned#create]
[----] I, [2017-09-04T11:54:12.780871 #15654:9e9134]  INFO -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> Processed  State=[CheckProvisioned] with Result=[error]
[----] W, [2017-09-04T11:54:12.781035 #15654:9e9134]  WARN -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> Error in State=[CheckProvisioned]
[----] I, [2017-09-04T11:54:12.781300 #15654:9e9134]  INFO -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> In State=[CheckProvisioned], invoking [on_error] method=[update_provision_status(statu
s => '[NoMethodError]: undefined method `root_disk_size' for nil:NilClass')]
[----] I, [2017-09-04T11:54:13.169452 #15654:9e9134]  INFO -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> Updated namespace [Cloud/VM/Provisioning/StateMachines/VMProvision_vm/update_provision
_status  ManageIQ/Cloud/VM/Provisioning/StateMachines]
[----] I, [2017-09-04T11:54:13.182414 #15654:9e9134]  INFO -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> Invoking [inline] method [/ManageIQ/Cloud/VM/Provisioning/StateMachines/VMProvision_VM
/update_provision_status] with inputs [{"status"=>"[NoMethodError]: undefined method `root_disk_size"}]
[----] I, [2017-09-04T11:54:13.183281 #15654:9e9134]  INFO -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> <AEMethod [/ManageIQ/Cloud/VM/Provisioning/StateMachines/VMProvision_VM/update_provisi
on_status]> Starting 
[----] I, [2017-09-04T11:54:13.295651 #15662:9e9134]  INFO -- : MIQ(AuthUseridPassword#validation_successful) [ExtManagementSystem] [78000000000003], previously valid/invalid on: [2017-09-04 15:53:53 UTC]/[], pr
evious status: [Valid]
[----] I, [2017-09-04T11:54:13.311464 #15662:9e9134]  INFO -- : MIQ(MiqQueue.put) Message id: [78000000006167],  id: [], Zone: [default], Role: [], Server: [], Ident: [generic], Target id: [], Instance id: [], T
ask id: [], Command: [MiqEvent.raise_evm_event], Timeout: [600], Priority: [100], State: [ready], Deliver On: [], Data: [], Args: [["ManageIQ::Providers::Openstack::CloudManager", 78000000000003], "ems_auth_vali
d", {}]
[----] I, [2017-09-04T11:54:13.311777 #15662:9e9134]  INFO -- : MIQ(MiqQueue#delivered) Message id: [78000000006137], State: [ok], Delivered in [1.068428702] seconds
[----] I, [2017-09-04T11:54:13.324619 #15662:9e9134]  INFO -- : MIQ(MiqGenericWorker::Runner#get_message_via_drb) Message id: [78000000006138], MiqWorker id: [78000000000002], Zone: [default], Role: [ems_operati
ons], Server: [], Ident: [generic], Target id: [], Instance id: [78000000000004], Task id: [], Command: [ExtManagementSystem.authentication_check_types], Timeout: [600], Priority: [100], State: [dequeue], Delive
r On: [2017-09-04 15:54:07 UTC], Data: [], Args: [[], {:attempt=>1}], Dequeued in: [65.351350225] seconds
[----] I, [2017-09-04T11:54:13.324766 #15662:9e9134]  INFO -- : MIQ(MiqQueue#deliver) Message id: [78000000006138], Delivering...
[----] I, [2017-09-04T11:54:13.333349 #15662:9e9134]  INFO -- : MIQ(ManageIQ::Providers::Openstack::CloudManager#with_provider_connection) Connecting through ManageIQ::Providers::Openstack::CloudManager: [rhosp1
1-quickvm]
[----] I, [2017-09-04T11:54:13.762503 #15654:9db174]  INFO -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> Validating Notification type: automate_user_error
[----] I, [2017-09-04T11:54:13.763836 #15654:9db174]  INFO -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> Calling Create Notification type: automate_user_error subject type: MiqRequest id: 780
00000000006 options: {:message=>"VM Provision Error: [EVM] VM [changeme] Step [CheckProvisioned] Status [[NoMethodError]: undefined method `root_disk_size] Message [[NoMethodError]: undefined method `root_disk_s
ize' for nil:NilClass] "}
[----] I, [2017-09-04T11:54:13.811391 #15654:9e9134]  INFO -- : Q-task_id([miq_provision_78000000000013]) <AutomationEngine> <AEMethod [/ManageIQ/Cloud/VM/Provisioning/StateMachines/VMProvision_VM/update_provisi
on_status]> Ending
~~~


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

How reproducible:
Always

Steps to Reproduce:
1. Create a service catalog of type openstack using attached service dialog
2. Try to order catalog


Actual results:
Provision fails with error

Expected results:
Should be able to provision VM from service dialog with field 'instance_type'

Additional info:
Service dialog attached

Comment 3 Dave Johnson 2017-09-05 06:45:18 UTC
Please assess the impact of this issue and update the severity accordingly.  Please refer to https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity for a reminder on each severity's definition.

If it's something like a tracker bug where it doesn't matter, please set it to Low/Low.

Comment 4 Sachin 2017-09-05 06:53:33 UTC
Set severity to medium, but this bug blocks testing of BZ#1481446

Comment 5 Greg McCullough 2017-09-05 14:48:18 UTC
The dialog is setting the instance_type field to a string when it needs to reference the id object instance_type (flavor) in the database.  

I would recommend creating a dynamic field to collect these values or if you want to use this static dialog field you will need to modify the automate to translate this value into the proper database id value.


Field type definition from the attached dialog:
      - name: instance_type
        description: Flavor
        data_type: string
        notes: 
        notes_display: 
        display: edit
        display_method: 
        display_method_options: {}
        required: true
        required_method: 
        required_method_options: {}
        default_value: 
        values:
        - - 
          - "<Choose>"
        - - m1.tiny
          - m1.tiny
        - - m1.small
          - m1.small
        - - m1.medium
          - m1.medium