Bug 1332576 - creating a provision request for a vmware instance.
Summary: creating a provision request for a vmware instance.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.5.0
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: GA
: 5.6.0
Assignee: Greg McCullough
QA Contact: Dave Johnson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-03 14:03 UTC by James Beal
Modified: 2017-12-05 15:39 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-03 14:40:44 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description James Beal 2016-05-03 14:03:34 UTC
Description of problem:

This is a mirror of support ticket 01626487, created on request by the dev's in https://gitter.im/ManageIQ/manageiq/automate

We are provisioning a machine from a service catalog item by creating a provisioning request and calling 

request = $evm.execute('create_provision_request', *args)
 
with the following array:

["1.1", "name=ubuntu_14_04_4_WTSI_20160330|request_type=template", "vm_name=jb23vmware|number_of_vms=1", "user_name=staff1_osato.com|owner_first_name=staff1|owner_last_name=Osato.com|owner_email=jb23.uk", nil, "arbitary_information_for_cloud_init=[]|extra_disk_sizes=0", nil, nil]

This fails validation with :

[---] E, [2016-04-29T16:43:56.253047 #1259:317f0b8] ERROR -- : Q-task_id([service_template_provision_task_1431]) MIQ(ManageIQ::Providers::Vmware::InfraManager::ProvisionWorkflow#validate_values) <Provision failed for the following reasons:
'Network/vLan' is required>
[----] E, [2016-04-29T16:43:56.253152 #1259:317f0b8] ERROR -- : Q-task_id([service_template_provision_task_1431]) MIQ(MiqProvisionVirtWorkflow.from_ws_ver_1_x) <Provision failed for the following reasons:
'Network/vLan' is required>

I know for example in openstack that I set "cloud_network=" in ws_values ( arg6 ) what is the equivalent rune for vmware ?


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

5.5.2.4.20160127105142_395c086 


How reproducible:

Consistently

Steps to Reproduce:
From a console:
args=["1.1", "name=ubuntu_14_04_4_WTSI_20160330|request_type=template", "vm_name=test009|number_of_vms=1", "user_name=staff1_osato.com|owner_first_name=staff1|owner_last_name=Osato.com|owner_email=jb23.uk", nil, "dvs=vxw-dvs-25-virtualwire-6-sid-5000-Osato_Chemical|is_dvs=true", nil, nil]
$evm.execute('create_provision_request', *args)

Actual results:

  Configuration Inst Including Associations (0.1ms - 1rows)
  ResourcePool Inst Including Associations (0.1ms - 1rows)
  ResourcePool Inst Including Associations (0.0ms - 1rows)
  PxeServer Inst Including Associations (0.0ms - 0rows)
  PxeServer Inst Including Associations (0.0ms - 0rows)
  PxeServer Inst Including Associations (0.0ms - 0rows)
RuntimeError: Provision failed for the following reasons:
'Network/vLan' is required
	from /var/www/miq/vmdb/app/models/miq_request_workflow.rb:1487:in `validate_values'
	from /var/www/miq/vmdb/app/models/miq_provision_virt_workflow.rb:1245:in `from_ws_ver_1_x'
	from /var/www/miq/vmdb/app/models/miq_provision_virt_workflow.rb:1009:in `from_ws'
	from /var/www/miq/vmdb/lib/miq_automation_engine/service_models/miq_ae_service_methods.rb:134:in `create_provision_request'
	from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service.rb:250:in `execute'
	from (irb):72
	from /opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands/console.rb:110:in `start'
	from /opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands/console.rb:9:in `start'
	from /opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:68:in `console'
	from /opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
	from /opt/rh/cfme-gemset/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'

Expected results:

I am not certain what the correct string to place in the ws_values to specify the dvs ( Or indeed exactly the string to specify the dvs).


Additional info:

We can create a vmware system from a dialog box and the provision request looks like:

irb(main):018:0> vm.miq_provision MiqProvision Inst Including Associations (84.2ms - 1rows) => #<MiqAeServiceManageIQ_Providers_Vmware_InfraManager_Provision:0x2fb7cbc @object=#<ManageIQ::Providers::Vmware::InfraManager::Provision id: 1425, description: "Provision from [ubuntu_14_04_4_WTSI_20160330] to [...", state: "finished", request_type: "template", userid: "staff1_osato.com", options: {:initial_pass=>true, :service_template_request=>false, :miq_request_dialog_name=>"miq_provision_vmware_dialogs_template", :requester_enabled=>["disabled"], :purpose_enabled=>["disabled"], :current_tab_key=>:network, :owner_phone=>nil, :owner_country=>nil, :owner_phone_mobile=>nil, :owner_title=>nil, :owner_first_name=>"staff1", :owner_manager=>nil, :owner_address=>nil, :owner_company=>nil, :owner_last_name=>"Osato.com", :owner_manager_mail=>nil, :owner_city=>nil, :owner_department=>nil, :owner_load_ldap=>nil, :owner_manager_phone=>nil, :owner_state=>nil, :owner_office=>nil, :owner_zip=>nil, :owner_email=>"jb23.uk", :request_notes=>nil, :vm_tags=>[], :customization_template_script=>nil, :dns_servers=>nil, :sysprep_organization=>nil, :sysprep_password=>nil, :sysprep_server_license_mode=>["perServer", "Per server"], :ldap_ous=>[nil, nil], :sysprep_timezone=>[nil, "(GMT-12:00) International Date Line West"], :dns_suffixes=>nil, :sysprep_product_id=>nil, :sysprep_identification=>["domain", "Domain"], :sysprep_per_server_max_connections=>"5", :sysprep_computer_name=>nil, :sysprep_workgroup_name=>"WORKGROUP", :sysprep_spec_override=>[false, 0], :addr_mode=>["dhcp", "DHCP"], :linux_host_name=>"jbtest10", :sysprep_domain_admin=>nil, :sysprep_change_sid=>[true, 1], :sysprep_domain_name=>[nil, nil], :sysprep_upload_file=>nil, :gateway=>nil, :ip_addr=>nil, :linux_domain_name=>nil, :sysprep_domain_password=>nil, :sysprep_auto_logon=>[true, 1], :sysprep_enabled=>[nil, nil], :sysprep_delete_accounts=>[false, 0], :sysprep_upload_text=>nil, :wins_servers=>nil, :subnet_mask=>nil, :sysprep_full_name=>nil, :sysprep_auto_logon_count=>[1, "1"], :root_password=>nil, :hostname=>nil, :placement_cluster_name=>[nil, nil], :cluster_filter=>[nil, nil], :host_filter=>[nil, nil], :ds_filter=>[nil, nil], :rp_filter=>[nil, nil], :placement_auto=>[true, 1], :placement_folder_name=>[3, "vm"], :placement_rp_name=>[2, "RP-Osato-Chemical"], :placement_dc_name=>[nil, nil], :number_of_vms=>[1, "1"], :vm_description=>nil, :vm_prefix=>nil, :src_vm_id=>[229, "ubuntu_14_04_4_WTSI_20160330"], :vm_name=>"jbtest10", :pxe_server_id=>[nil, nil], :host_name=>nil, :provision_type=>["vmware", "VMware"], :linked_clone=>[nil, nil], :snapshot=>[nil, nil], :vm_filter=>[nil, nil], :schedule_type=>["immediately", "Immediately on Approval"], :vm_auto_start=>[false, 0], :schedule_time=>2016-04-19 15:27:00 UTC, :retirement=>[0, "Indefinite"], :retirement_warn=>[604800, "1 Week"], :vlan=>["dvs_vxw-dvs-25-virtualwire-6-sid-5000-Osato_Chemical", "vxw-dvs-25-virtualwire-6-sid-5000-Osato_Chemical (sciaas-dvs)"], :mac_address=>nil, :disk_format=>["unchanged", "Default"], :cpu_limit=>-1, :memory_limit=>-1, :number_of_sockets=>1, :cores_per_socket=>[1, "1"], :cpu_reserve=>0, :vm_memory=>1024, :memory_reserve=>0, :network_adapters=>[1, "1"], :start_date=>"4/19/2016", :start_hour=>"15", :start_min=>"27", :name=>"Extended ", :description=>"Extended", :long_description=>"", :provision_cost=>nil, :display=>true, :catalog_id=>6, :available_catalogs=>[["Administration", 1], ["Database services", 5], ["Hardware requests", 2], ["High Throughput Computing", 3], ["RedHat", 7], ["VMware Servers", 6], ["Web services", 4]], :retire_fqname=>"", :reconfigure_fqname=>"", :fqname=>"/Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogItemInitialization_VMware", :available_dialogs=>{1=>"azure-single-vm-from-user-image", 2=>"OSE Installer", 3=>"New telephone", 5=>"Create New Customer", 6=>"access_keypair", 7=>"Single compute node provision", 8=>"Single head node provision", 9=>"General server node provision", 10=>"Mysql server node provision", 11=>"PostgreSQL server node provision", 12=>"Irods server node provision", 13=>"JB23-extradisk-play-General server node provision", 4=>"Not used Single compute provision", 15=>"Generic Button Dialog", 14=>"Generic Server", 17=>"VMware VM with firewall profile", 16=>"simple_osp_instance", 18=>"Webserver with Wordpress node provision", 19=>"Upload ssh public key", 20=>"Webserver with Drupal node provision", 21=>"Extended Generic Server"}, :st_prov_type=>"vmware", :service_type=>"atomic", :dialog_id=>21, :selected=>"aei-551", "provision"=>"aei-551", :placement_host_name=>[3, "b12-sciaas-01.sciaas.sanger.ac.uk"], :placement_ds_name=>[1, "vol_5a01"], :src_vm_nics=>["Network adapter 1"], :src_vm_lans=>[], :customize_enabled=>["enabled"], :src_ems_id=>[1, "vmware"], :requester_group=>"Osato_Chemicals", :delivered_on=>nil, :pass=>0, :miq_force_unique_name=>[true, 1], :service_guid=>"cb725eb2-0e1a-11e6-857f-00505682e053", :service_resource_id=>134, :owner_group=>"Osato_Chemicals", :dns_domain=>nil, :vm_target_name=>"jbtest10", :vm_target_hostname=>"jbtest10", :dialog_vm_name=>"jbtest10", :service=>"Bronze", :dialog_service=>"Bronze", :flavor=>"Small", :dialog_flavor=>"Small", :disk_size_gb=>"0", :vm_notes=>"Owner: staff1 Osato.com\nEmail: jb23.uk\nSource: ubuntu_14_04_4_WTSI_20160330", :ws_values=>{:disk_size_gb=>0}, :dest_host=>[3, "b12-sciaas-01.sciaas.sanger.ac.uk"], :dest_storage=>[1, "vol_5a01"], :networks=>[{:network=>"vxw-dvs-25-virtualwire-6-sid-5000-Osato_Chemical", :mac_address=>nil, :is_dvs=>true}], :requested_network_adapter_count=>1}, created_on: "2016-04-29 14:58:12", updated_on: "2016-04-29 15:05:15", message: "VM Provisioning completed", status: "Ok", type: "ManageIQ::Providers::Vmware::InfraManager::Provisi...", miq_request_id: 1080, source_id: 229, source_type: "VmOrTemplate", destination_id: 479, destination_type: "VmOrTemplate", miq_request_task_id: 1424, phase: "finish", phase_context: {}, tenant_id: 1>, @virtual_columns=["placement_auto", "provision_type", "region_description", "region_number"], @associations=["destination", "eligible_clusters", "eligible_customization_templates", "eligible_folders", "eligible_hosts", "eligible_iso_images", "eligible_pxe_images", "eligible_pxe_servers", "eligible_resource_pools", "eligible_storages", "eligible_windows_images", "miq_provision_request", "miq_request", "miq_request_task", "miq_request_tasks", "source", "tenant", "vm", "vm_template"]>

The redhat support engineer has added:

 It appears you are passing two dvs switches but the vm being provisioned only has one network adapter.

[----] I, [2016-05-02T16:16:31.100258 #1259:101b994] INFO -- : Q-task_id([miq_provision_1437]) MIQ(ManageIQ::Providers::Vmware::InfraManager::Provision#build_config_spec_dvs) Setting target network device to Device Name:<vxw-dvs-25-virtualwire-6-sid-5000-Osato_Chemical> Device:<{"key"=>"4000", "deviceInfo"=>{"label"=>"Network adapter 1", "summary"=>"DVSwitch: 5e f6 02 50 0d 5b f0 ca-a6 41 d6 f1 22 a1 03 92"}, "backing"=>{"port"=>{"switchUuid"=>"5e f6 02 50 0d 5b f0 ca-a6 41 d6 f1 22 a1 03 92", "portgroupKey"=>"dvportgroup-82", "portKey"=>"1313", "connectionCookie"=>"1851515009"}}, "connectable"=>{"startConnected"=>"true", "allowGuestControl"=>"true", "connected"=>"false", "status"=>"untried"}, "slotInfo"=>{"pciSlotNumber"=>"32"}, "controllerKey"=>"100", "unitNumber"=>"7", "addressType"=>"assigned", "macAddress"=>"00:50:56:82:b7:68", "wakeOnLanEnabled"=>"true", "resourceAllocation"=>{"reservation"=>"0", "share"=>{"shares"=>"50", "level"=>"normal"}, "limit"=>"-1"}, "uptCompatibilityEnabled"=>"false"}> 
[----] I, [2016-05-02T16:16:31.142949 #1259:101b994] INFO -- : Q-task_id([miq_provision_1437]) MIQ(ManageIQ::Providers::Vmware::InfraManager::Provision#build_config_spec_dvs) portgroupName: vxw-dvs-25-virtualwire-6-sid-5000-Osato_Chemical, portgroupKey: dvportgroup-82, switchUuid: 5e f6 02 50 0d 5b f0 ca-a6 41 d6 f1 22 a1 03 92 
[----] W, [2016-05-02T16:16:31.143106 #1259:101b994] WARN -- : Q-task_id([miq_provision_1437]) MIQ(ManageIQ::Providers::Vmware::InfraManager::Provision#build_customization_spec) VM Customization will be skipped. Sysprep customization option set to [] 
[----] I, [2016-05-02T16:16:31.143315 #1259:101b994] INFO -- : Q-task_id([miq_provision_1437]) MIQ(ManageIQ::Providers::Vmware::InfraManager::Provision#log_clone_options) Provisioning [ubuntu_14_04_4_WTSI_20160330] to [case-01626487] 

Only network adapter 

[----] I, [2016-05-02T16:16:31.171027 #1259:101b994] INFO -- : Q-task_id([miq_provision_1437]) MIQ(ManageIQ::Providers::Vmware::InfraManager::Provision#log_clone_options) Prov Options: [:networks][0][:network](String) = "vxw-dvs-25-virtualwire -6-sid-5000-Osato_Chemical" 
[----] I, [2016-05-02T16:16:31.171098 #1259:101b994] INFO -- : Q-task_id([miq_provision_1437]) MIQ(ManageIQ::Providers::Vmware::InfraManager::Provision#log_clone_options) Prov Options: [:networks][0][:mac_address](NilClass) = nil 
[----] I, [2016-05-02T16:16:31.171200 #1259:101b994] INFO -- : Q-task_id([miq_provision_1437]) MIQ(ManageIQ::Providers::Vmware::InfraManager::Provision#log_clone_options) Prov Options: [:networks][0][:is_dvs](TrueClass) = true

Comment 2 Greg McCullough 2016-05-03 14:40:44 UTC
The issue is the “vlan” value is being passed in the additional_values parameter which are passed along with the request but not processed unless you have automate methods that use them.

The vlan value should be passed in the “vm_fields” parameter (3rd parameter).

Example:
"vm_name=test009|number_of_vms=1|vlan=dvs_vxw-dvs-25-virtualwire-6-sid-5000-Osato_Chemical"

Also, no need to pass the is_dvs setting.


Note You need to log in before you can comment on or make changes to this bug.