Description of problem: Soap request against a 5.3.2 system. Resource- /provision_requests Json: { "version": "1.1", "template_fields": { "guid": "795c9f7a-b38f-11e4-ae5a-0050568f13b1" }, "vm_fields": { "number_of_sockets": 1, "cores_per_socket": 1, "vm_memory": "1024", "vlan": "dev", "vm_name": "jcarter-soap-test", "instance_type": "m3.medium", "request_type": "template" }, "requester": { "user_name": "admin", "owner_first_name": "Josh", "owner_last_name": "Carter", "owner_email": "jocarter", "auto_approve": true }, "tags": { }, "additional_values": { }, "ems_custom_attributes": { }, "miq_custom_attributes": { } } Return {"results": [{ "approval_state": "pending_approval", "created_on": "2015-02-13T15:37:20Z", "description": "Provision from [RHEL-5.6_GA-x86_64-4-Access2] to [jcarter-soap-test]", "destination_id": null, "destination_type": null, "fulfilled_on": null, "id": 12000000000005, "message": "VM Provisioning - Request Created", "options": { "use_pre_dialog": false, "request_type": "template", "miq_request_dialog_name": "miq_provision_amazon_dialogs_template", "customize_enabled": ["disabled"], "owner_phone": null, "owner_country": null, "owner_phone_mobile": null, "owner_title": null, "owner_first_name": "Josh", "owner_manager": null, "owner_address": null, "owner_company": null, "owner_last_name": "Carter", "owner_manager_mail": null, "owner_city": null, "owner_department": null, "owner_load_ldap": null, "owner_manager_phone": null, "owner_state": null, "owner_office": null, "owner_zip": null, "owner_email": "jocarter", "request_notes": null, "vm_tags": [], "placement_auto": [ true, 1 ], "placement_availability_zone": [ null, null ], "cloud_network": [ 0, null ], "cloud_subnet": [ null, null ], "security_groups": [ null, null ], "floating_ip_address": [ 0, null ], "number_of_vms": [ 1, "1" ], "vm_description": null, "vm_prefix": null, "src_vm_id": [ 12000000000119, "RHEL-5.6_GA-x86_64-4-Access2" ], "vm_name": "jcarter-soap-test", "schedule_type": [ "immediately", "Immediately on Approval" ], "schedule_time": "2015-02-14T10:37:19-05:00", "retirement": [ 0, "Indefinite" ], "retirement_warn": [ 604800, "1 Week" ], "instance_type": 0, "guest_access_key_pair": [ null, null ], "monitoring": [ "basic", "Basic" ], "dns_servers": null, "dns_suffixes": null, "addr_mode": [ "dhcp", "DHCP" ], "linux_host_name": null, "gateway": null, "linux_domain_name": null, "subnet_mask": null, "customization_template_script": null, "root_password": null, "hostname": null, "src_vm_nics": [], "src_vm_lans": [], "src_ems_id": [ 12000000000001, "gss-aws" ], "auto_approve": false, "ws_values": {}, "ws_ems_custom_attributes": {}, "ws_miq_custom_attributes": {}, "delivered_on": null }, "request_state": "pending", "request_type": "template", "requester_id": 12000000000001, "requester_name": "Administrator", "source_id": 12000000000119, "source_type": "template", "status": "Ok", "updated_on": "2015-02-13T15:37:21Z", "userid": "admin" }]} Error in the evm.log that stops the provision [----] I, [2015-02-13T15:37:57.792316 #2277:d4803c] INFO -- : Q-task_id([miq_provision_12000000000005]) <AutomationEngine> Followed Relationship [miqaedb:/System/Request/UI_PROVISION_INFO#create] [----] I, [2015-02-13T15:37:57.796376 #2277:d4803c] INFO -- : Q-task_id([miq_provision_12000000000005]) MIQ(MiqProvisionAmazon.automatic_placement) Getting most suitable availability_zone for new instance...Complete, Availability Zone Id: [], Name: [] [----] I, [2015-02-13T15:37:57.796633 #2277:d4803c] INFO -- : Q-task_id([miq_provision_12000000000005]) Starting Phase <prepare_provision> [----] I, [2015-02-13T15:37:57.830951 #2277:d4803c] INFO -- : Q-task_id([miq_provision_12000000000005]) Starting Phase <provision_error> [----] E, [2015-02-13T15:37:57.845251 #2277:d4803c] ERROR -- : Q-task_id([miq_provision_12000000000005]) MIQ(MiqProvisionAmazon#provision_error) [[NoMethodError]: undefined method `name' for nil:NilClass] encountered during phase [prepare_provision] [----] E, [2015-02-13T15:37:57.845393 #2277:d4803c] ERROR -- : Q-task_id([miq_provision_12000000000005]) /var/www/miq/vmdb/app/models/miq_provision_amazon/cloning.rb:27:in `prepare_for_clone_task' /var/www/miq/vmdb/app/models/miq_provision/state_machine.rb:13:in `prepare_provision' /var/www/miq/vmdb/app/models/miq_request_task/state_machine.rb:26:in `signal' /var/www/miq/vmdb/app/models/miq_provision_cloud/state_machine.rb:9:in `determine_placement' /var/www/miq/vmdb/app/models/miq_request_task/state_machine.rb:26:in `signal' /var/www/miq/vmdb/app/models/miq_provision_cloud/state_machine.rb:3:in `create_destination' /var/www/miq/vmdb/app/models/miq_request_task/state_machine.rb:26:in `signal' /var/www/miq/vmdb/app/models/miq_provision/state_machine.rb:4:in `run_provision' /var/www/miq/vmdb/app/models/miq_request_task/state_machine.rb:26:in `signal' /var/www/miq/vmdb/app/models/miq_provision.rb:76:in `do_request' /var/www/miq/vmdb/app/models/miq_request_task.rb:190:in `execute' /var/www/miq/vmdb/app/models/miq_queue.rb:361:in `block in deliver' /opt/rh/ruby193/root/usr/share/ruby/timeout.rb:69:in `timeout' /var/www/miq/vmdb/app/models/miq_queue.rb:357:in `deliver' /var/www/miq/vmdb/lib/workers/queue_worker_base.rb:107:in `deliver_queue_message' /var/www/miq/vmdb/lib/workers/queue_worker_base.rb:135:in `deliver_message' /var/www/miq/vmdb/lib/workers/queue_worker_base.rb:152:in `block in do_work' /var/www/miq/vmdb/lib/workers/queue_worker_base.rb:146:in `loop' /var/www/miq/vmdb/lib/workers/queue_worker_base.rb:146:in `do_work' /var/www/miq/vmdb/lib/workers/worker_base.rb:317:in `block in do_work_loop' /var/www/miq/vmdb/lib/workers/worker_base.rb:314:in `loop' /var/www/miq/vmdb/lib/workers/worker_base.rb:314:in `do_work_loop' /var/www/miq/vmdb/lib/workers/worker_base.rb:135:in `run' /var/www/miq/vmdb/lib/workers/worker_base.rb:123:in `start' /var/www/miq/vmdb/lib/workers/worker_base.rb:23:in `start_worker' /var/www/miq/vmdb/lib/workers/bin/worker.rb:5:in `<top (required)>' /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.17/lib/rails/commands/runner.rb:52:in `eval' /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.17/lib/rails/commands/runner.rb:52:in `<top (required)>' /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.17/lib/rails/commands.rb:64:in `require' /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.17/lib/rails/commands.rb:64:in `<top (required)>' script/rails:6:in `require' script/rails:6:in `<main>' [----] I, [2015-02-13T15:37:57.888417 #2277:d4803c] INFO -- : Q-task_id([miq_provision_12000000000005]) Starting Phase <finish> Unable to recreate the problem using the lifecycle provision dialog. Version-Release number of selected component (if applicable): 5.3.2 How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
instance_type is expecting the id of the instance_type from the db. So the lookup is failing and not setting a value.
Madhu - This should be easy to reproduce through either soap or rest web-services. I am thinking we should do a lookup by value and then display name for these fields. I can point you to the code where this data is processed to get you started.
The Rest API now supports returning the instance_types (flavors) which, if available, can be used to pass the required value. The other way to resolve this issue is to pass the "instance_type" name through the "additional_values" parameter which are available to automate methods. Here is an example of the logic you could use to set the instance_type within an automate method with the name passed through additional_values: prov = $evm.root["miq_provision"] ws_values = prov.options.fetch(:ws_values, {}) if prov.get_option(:instance_type).nil? && ws_values.key?(:instance_type) instance_type = prov.eligible_instance_types.detect {|flavor| flavor.name.downcase == ws_values[:instance_type].downcase} prov.set_instance_type(instance_type) if instance_type end
Alberto Do we have a REST API sample to get the flavors and set the instance type field. "vm_fields": { "number_of_sockets": 1, "cores_per_socket": 1, "vm_memory": "1024", "vlan": "dev", "vm_name": "inui-test-20150212081330", "instance_type": "m3.medium", <-- this would have to be the flavor id "request_type": "template" },
Hi Madhu, Yes, with 5.4 (currently available on upstream), they will be able to query the flavors via GET /api/flavors?expand=resources so as an example of the flavor resource would be returned as follows: { "href": "http://localhost:3000/api/flavors/46", "id": 46, "ems_id": 5, "name": "t2.medium", "description": "T2 Medium", "cpus": 2, "cpu_cores": 1, "memory": 4294967296, "ems_ref": "t2.medium", "type": "FlavorAmazon", "supports_32_bit": false, "supports_64_bit": true, "enabled": true, "supports_hvm": true, "supports_paravirtual": false, "block_storage_based_only": true } Giving them the id they need. Alberto
Verified using 5.4.0.1 build.
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://rhn.redhat.com/errata/RHBA-2015-1100.html