Project

General

Profile

Bug #4590

Can't create new VMware virtual machine : missing required parameter uuid

Added by Alexandre Ellert over 5 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Compute resources
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Creating "New host" with compute ressources VMware result in a error at step "Set up compute instance".
In the web UI, it shows : RuntimeError - missing required parameter uuid

The bug is present with foreman 1.4.1 with at least Vsphere 5.0 and 5.1.
Downgrade to foreman 1.4.0 fix the problem.

Dominic says the error is "coming from the SCSI controller selection added in 1.4.1"

I hope it will be fixed in 1.4.2


Related issues

Related to Foreman - Feature #3496: SCSI Controller type selection for vSphereClosed2013-10-25
Has duplicate Foreman - Bug #5584: Missing UUID parameters VMWare 5.5 (Foreman1.2)Duplicate2014-05-06

Associated revisions

Revision 7e27bdf3 (diff)
Added by Dominic Cleal about 5 years ago

fixes #4590 - convert VMware SCSI controller type during creation

Revision 0b6c5e1d (diff)
Added by Dominic Cleal about 5 years ago

fixes #4590 - convert VMware SCSI controller type during creation

(cherry picked from commit 7e27bdf3a593f0e2ac0661f4a3c9a9bb3ab6227c)

Conflicts:
app/models/compute_resources/foreman/model/vmware.rb
test/unit/compute_resources/vmware_test.rb

Revision 0ea0fd18 (diff)
Added by Dominic Cleal about 5 years ago

fixes #4590 - convert VMware SCSI controller type during creation

(cherry picked from commit 7e27bdf3a593f0e2ac0661f4a3c9a9bb3ab6227c)

History

#1 Updated by Dominic Cleal over 5 years ago

  • Assignee deleted (Dominic Cleal)

Stack trace from logs:

Failed to create a compute removed (VMWare) instance removed: missing required parameter uuid
 /usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/connection.rb:49:in `emit_request'
/usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/connection.rb:42:in `each'
/usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/connection.rb:42:in `emit_request'
/usr/share/foreman/vendor/ruby/1.8/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `call'
/usr/share/foreman/vendor/ruby/1.8/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `_nested_structures'
/usr/share/foreman/vendor/ruby/1.8/gems/builder-3.0.4/lib/builder/xmlbase.rb:63:in `tag!'
/usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/connection.rb:40:in `emit_request'
/usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/connection.rb:83:in `call'
/usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/trivial_soap.rb:66:in `soap_envelope'
/usr/share/foreman/vendor/ruby/1.8/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `call'
/usr/share/foreman/vendor/ruby/1.8/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `_nested_structures'
/usr/share/foreman/vendor/ruby/1.8/gems/builder-3.0.4/lib/builder/xmlbase.rb:63:in `tag!'
/usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/trivial_soap.rb:65:in `soap_envelope'
/usr/share/foreman/vendor/ruby/1.8/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `call'
/usr/share/foreman/vendor/ruby/1.8/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `_nested_structures'
/usr/share/foreman/vendor/ruby/1.8/gems/builder-3.0.4/lib/builder/xmlbase.rb:63:in `tag!'
/usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/trivial_soap.rb:64:in `soap_envelope'
/usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/connection.rb:82:in `call'
/usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/basic_types.rb:203:in `_call'
/usr/share/foreman/vendor/ruby/1.8/gems/rbvmomi-1.6.0/lib/rbvmomi/basic_types.rb:74:in `FindByUuid'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/vsphere/requests/compute/get_virtual_machine.rb:18:in `get_vm_ref'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/vsphere/requests/compute/get_vm_first_scsi_controller.rb:10:in `get_vm_first_scsi_controller_raw'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/vsphere/requests/compute/get_vm_first_scsi_controller.rb:7:in `get_vm_first_scsi_controller'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/vsphere/models/compute/server.rb:220:in `scsi_controller'
/usr/share/foreman/app/models/concerns/fog_extensions/vsphere/server.rb:36:in `scsi_controller_type='
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/core/attributes.rb:146:in `send'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/core/attributes.rb:146:in `merge_attributes'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/core/attributes.rb:141:in `each'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/core/attributes.rb:141:in `merge_attributes'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/core/model.rb:20:in `initialize'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/vsphere/models/compute/server.rb:52:in `initialize'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/core/collection.rb:116:in `new'
/usr/share/foreman/vendor/ruby/1.8/gems/fog-1.19.0/lib/fog/core/collection.rb:116:in `new'
/usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:105:in `new_vm'
/usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:117:in `create_vm'
/usr/share/foreman/app/models/concerns/orchestration/compute.rb:62:in `setCompute'

It appears that setting the scsi_controller is causing a retrieval that fails:

https://github.com/theforeman/foreman/blob/develop/app/models/concerns/fog_extensions/vsphere/server.rb#L35-L37

This calls scsi_controller which causes a lookup in Fog to vSphere for the scsi_controller of the current VM (as identified by id).

#2 Updated by Dominic Cleal over 5 years ago

  • Related to Feature #3496: SCSI Controller type selection for vSphere added

#3 Updated by Stefan c over 5 years ago

I can confirm that the same issue happened to me on VMware 4.1 and Foreman 1.4.1.
As Dominic Cleal was saying to me in irc, it is possibly related to my foreman vmware compute user not being able to see the distributed vswitch in Vmware.
I will update this ticket once I get full admin permissions to Vmware for the foreman compute cluster user.
This is the stacktrace that I get, the error in logs and UI is failed to create vm: undefined method `uuid' for nil:NilClass:
https://gist.github.com/stefancocora/9668826

#4 Updated by James Conner over 5 years ago

I can confirm that I'm seeing the same issue with Foreman 1.4.1 and Vsphere 5.5. For me it seems to be same scsi_controller_type issue that Domonic is seeing.

RuntimeError
missing required parameter uuid
app/models/concerns/fog_extensions/vsphere/server.rb:36:in `scsi_controller_type='
app/models/compute_resources/foreman/model/vmware.rb:105:in `new_vm'
app/models/concerns/orchestration/compute.rb:24:in `compute_object'
app/views/hosts/_compute.html.erb:1:in `_app_views_hosts__compute_html_erb___1796274211_70115543473140'
app/views/hosts/_unattended.html.erb:2:in `_app_views_hosts__unattended_html_erb___1230911890_70115544936680'
app/views/hosts/_form.html.erb:91:in `_app_views_hosts__form_html_erb___1642109057_70115543637280'
app/helpers/layout_helper.rb:218:in `form_for'
app/views/hosts/_form.html.erb:7:in `_app_views_hosts__form_html_erb___1642109057_70115543637280'
app/models/taxonomy.rb:56:in `as_taxonomy'
app/models/concerns/foreman/thread_session.rb:143:in `as_location'
app/models/taxonomy.rb:55:in `as_taxonomy'
app/models/concerns/foreman/thread_session.rb:108:in `as_org'
app/models/taxonomy.rb:54:in `as_taxonomy'
app/views/hosts/_form.html.erb:5:in `_app_views_hosts__form_html_erb___1642109057_70115543637280'
app/views/hosts/new.html.erb:7:in `_app_views_hosts_new_html_erb___1934921432_70115542850000'
app/controllers/application_controller.rb:282:in `process_error'
app/controllers/hosts_controller.rb:94:in `create'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call' 

#5 Updated by Stefan c over 5 years ago

I can confirm that I was getting this error failed to create vm: undefined method `uuid' for nil:NilClass: because Foreman's user couldn't access the VMware distributed virtual switch.
Once I've got permission to get to that part this error went away.
Ofcourse another error came out related to InvalidProperty: but that is another story

#6 Updated by Alexandros Tsourakis over 5 years ago

I confirm this with Foreman 1.4.2 and VMware 5.1.

It also occurs when trying to create or edit a Compute Profile:

RuntimeError
missing required parameter uuid
app/models/concerns/fog_extensions/vsphere/server.rb:36:in `scsi_controller_type='
app/models/compute_resources/foreman/model/vmware.rb:105:in `new_vm'
app/models/compute_attribute.rb:21:in `new_vm'
app/models/compute_attribute.rb:26:in `pretty_vm_attrs'
app/models/compute_attribute.rb:32:in `update_name'
app/controllers/compute_attributes_controller.rb:10:in `create'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

It doesn't seem to be a permissions issue in my case. I tried with admin access to vSphere but still the same.

#7 Updated by Dominic Cleal over 5 years ago

Very similar errors, but Stefan's case was in the networking code so is unrelated. This is an issue in Foreman and/or Fog rather than permissions.

#8 Updated by Travis Burrell over 5 years ago

Confirming same error for 1.4.2 & vSphere 5.1 update 2.

RuntimeError
missing required parameter uuid
app/models/concerns/fog_extensions/vsphere/server.rb:36:in `scsi_controller_type='
app/models/compute_resources/foreman/model/vmware.rb:105:in `new_vm'
app/models/concerns/orchestration/compute.rb:21:in `compute_object'
app/views/hosts/_compute.html.erb:1:in `_app_views_hosts__compute_html_erb__1891142222_70023025250160'
app/views/hosts/_unattended.html.erb:2:in `_app_views_hosts__unattended_html_erb___145426765_70023026613480'
app/views/hosts/_form.html.erb:91:in `_app_views_hosts__form_html_erb__1729657159_70023025903020'
app/helpers/layout_helper.rb:218:in `form_for'
app/views/hosts/_form.html.erb:7:in `_app_views_hosts__form_html_erb__1729657159_70023025903020'
app/models/taxonomy.rb:56:in `as_taxonomy'
app/models/concerns/foreman/thread_session.rb:143:in `as_location'
app/models/taxonomy.rb:55:in `as_taxonomy'
app/models/concerns/foreman/thread_session.rb:108:in `as_org'
app/models/taxonomy.rb:54:in `as_taxonomy'
app/views/hosts/_form.html.erb:5:in `_app_views_hosts__form_html_erb__1729657159_70023025903020'
app/views/hosts/new.html.erb:7:in `_app_views_hosts_new_html_erb___1050982719_70023025365760'
app/controllers/application_controller.rb:287:in `process_error'
app/controllers/hosts_controller.rb:94:in `create'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call' 

#9 Updated by Dmytro Dondyk over 5 years ago

Getting the same error with 1.4.2 and vsphere 5.5
is there a work around for this?

RuntimeError
missing required parameter uuid
app/models/concerns/fog_extensions/vsphere/server.rb:36:in `scsi_controller_type='
app/models/compute_resources/foreman/model/vmware.rb:105:in `new_vm'
app/models/concerns/orchestration/compute.rb:21:in `compute_object'
app/views/hosts/_compute.html.erb:1:in `_app_views_hosts__compute_html_erb__1927501353_70289390738340'
app/views/hosts/_unattended.html.erb:2:in `_app_views_hosts__unattended_html_erb___674433531_70289393996580'
app/views/hosts/_form.html.erb:91:in `_app_views_hosts__form_html_erb__1711599656_70289393091600'
app/helpers/layout_helper.rb:218:in `form_for'
app/views/hosts/_form.html.erb:7:in `_app_views_hosts__form_html_erb__1711599656_70289393091600'
app/models/taxonomy.rb:56:in `as_taxonomy'
app/models/concerns/foreman/thread_session.rb:143:in `as_location'
app/models/taxonomy.rb:55:in `as_taxonomy'
app/models/concerns/foreman/thread_session.rb:108:in `as_org'
app/models/taxonomy.rb:54:in `as_taxonomy'
app/views/hosts/_form.html.erb:5:in `_app_views_hosts__form_html_erb__1711599656_70289393091600'
app/views/hosts/new.html.erb:7:in `_app_views_hosts_new_html_erb__308404150_70289391525100'
app/controllers/application_controller.rb:287:in `process_error'
app/controllers/hosts_controller.rb:94:in `create'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

#10 Updated by Travis Burrell over 5 years ago

Dmytro Dondyk wrote:

Getting the same error with 1.4.2 and vsphere 5.5
is there a work around for this?

I was able to downgrade to 1.4.0 & the issue went away.

#11 Updated by Jean-Christophe Counio over 5 years ago

Any chance to fixed in 1.5.0 ? It's a big blocker for people using VmWare if we want to upgrade > 1.4.0

#12 Updated by Dominic Cleal over 5 years ago

  • Legacy Backlogs Release (now unused) set to 4

#13 Updated by Dmitri Dolguikh over 5 years ago

I think what is happening is:
- scsi_controller_type attribute is passed in during compute resource creation (defined in app/views/compute_resources_vms/form/_vmware.html.erb form)
- during instantiation of Fog::Compute::Vsphere::Server, when attributes are being initialized, scsi_controller_type setter is being called (defined in FogExtensions::Vsphere::Server)
- It in turn calls Fog::Compute::Vsphere::Server#scsi_controller method, which attempts to retrieve controller configuration from the server, as it hasn't been initialized yet
- The call fails, as the image id is nil for the new image.

This might fix the issue (I have no access to vmware to test it) https://github.com/witlessbird/foreman/tree/4590. The fix above relies on a certain order of initialization, however, and it's possible for this data to get overwritten. I think that a better approach would be to remove scsi_controller_type attribute from FogExtensions::Vsphere::Server and merge controller type data into scsi_controller hash in the controller.

#14 Updated by Nate Walck over 5 years ago

I applied the patch on 1.4.1 (found here: https://github.com/witlessbird/foreman/commit/4efcc0d138.patch ), restarted apache and get the same errors as before.

I see this behavior when editing the large compute profile as well as trying to create a new host using any of the compute profiles.

The error I get when editing the compute profile can be found here: https://www.dropbox.com/s/5j9fopqj29j6anr/Screenshot%202014-04-17%2011.03.44.png

And the error when creating a new host:
https://www.dropbox.com/s/f9gmwkj8czzchql/Screenshot%202014-04-17%2010.50.24.png

I'll try any other patches as they become available.

#15 Updated by Dominic Cleal about 5 years ago

Nate reported on IRC that this now seems to be working. Dmitri, do you want to submit that as a PR and we'll see how it goes?

#16 Updated by Nate Walck about 5 years ago

This is still an intermittent issue for me. It worked great for ~7 builds and then started exhibiting one of three behaviors. They are as follows:

  1. It actually trys to provision, but errors out with 'missing requires parameter uuid' - Stacktrace: https://gist.github.com/25190d4a032575b658a5
  2. It fails to load the compute profiles while configuring the new host (before clicking submit to provision it). Screenshot: https://www.dropbox.com/s/skfmusqj4v6yik2/Screenshot%202014-04-22%2009.23.36.png
  3. The third behavior is that it provisions and works 100%.

It is of note that the error found in the stack trace is identical, regardless of which error it is (both Internal server error and missing uuid show the same stacktrace in the debug log).

I've done precisely the same workflow every time I've tested it.

Prereqs: Have a hostgroup setup with all vmware settings specified.

  1. Click New Host
  2. Select your provisioning hostgroup
  3. Select 'VMWare' under 'Deploy On' (Leave the default compute profile)
  4. Enter the hostname
  5. Check 'Virtual Machine' Section to confirm computer profile loaded. 50% of the time, it says ''Error loading virtual machine information: Internal Server Error, the other 50% it shows the profile.
  6. Click Submit
  7. Starts spinning up the machine, but throws 'missing required parameter uuid'.

Let me know if you need any additional information.

#17 Updated by Nate Walck about 5 years ago

Also, I am on Foreman 1.4.1 and Running vCenter + ESXi 5.5.

#18 Updated by Nate Walck about 5 years ago

One last update!

When I enable debugging, provisioning works 80% of the time. When I disable debugging in production.rb, provisioning works 0% of the time. It is a guaranteed failure. I am not sure what the different between debug and non-debug is, but this is behavior we noticed.

#19 Updated by Dominic Cleal about 5 years ago

  • Target version set to 1.8.3

#20 Updated by Nate Walck about 5 years ago

I updated to 1.5.0 RC2 and noticed it was lacking the patch provided by Dmitri.

Will 1.5.0 stable have the patch included? In the meantime, I've applied the patch to 1.5.0 RC2 to see if it increases success rate with VM provisioning on VMWare.

#21 Updated by Nate Walck about 5 years ago

Confirmed that this patch does not completely fix the issue. When selecting "VMWare" from the "Deploy On" menu, I get the following in the log, almost instantly:

Started POST "/hosts/compute_resource_selected" for SOME_IP at Mon Apr 28 22:12:16 -0700 2014
Processing by HostsController#compute_resource_selected as */*
  Parameters: {"utf8"=>"✓", "host"=>{"environment_id"=>"1", "architecture_id"=>"1", "build"=>"1", "managed"=>"true", "ip"=>"", "hostgroup_id"=>"24", "type"=>"Host::Managed", "overwrite"=>"false", "progress_report_id"=>"[FILTERED]", "domain_id"=>"1", "mac"=>"", "operatingsystem_id"=>"2", "provision_method"=>"build", "ptable_id"=>"7", "compute_profile_id"=>"1", "model_id"=>"", "comment"=>"", "puppet_ca_proxy_id"=>"1", "puppetclass_ids"=>[""], "realm_id"=>"", "is_owned_by"=>"13-Users", "name"=>"", "compute_resource_id"=>"1", "interfaces_attributes"=>{"new_interfaces"=>{"ip"=>"", "type"=>"Nic::Managed", "_destroy"=>"false", "mac"=>"", "domain_id"=>"", "provider"=>"IPMI", "name"=>""}}, "root_pass"=>"[FILTERED]", "puppet_proxy_id"=>"5", "subnet_id"=>"1", "medium_id"=>"5", "disk"=>"", "enabled"=>"1"}, "authenticity_token"=>"REDACTED"}
  Rendered hosts/_compute.html.erb (295.2ms)
Operation FAILED: missing required parameter uuid
  Rendered common/500.html.erb (4.4ms)
Completed 500 Internal Server Error in 315.3ms (Views: 5.0ms | ActiveRecord: 0.0ms)

#22 Updated by Dominic Cleal about 5 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Dominic Cleal

Yeah, since your early tests suggested it wasn't a reliable fix I didn't push for its inclusion in RC2.

I've created another test patch - would you mind testing it Nate? Unfortunately I can't reproduce this issue, but I can confirm the SCSI controller type is still set on new host creation.

https://github.com/theforeman/foreman/pull/1409 (and https://github.com/theforeman/foreman/pull/1409.patch)

#23 Updated by Dominic Cleal about 5 years ago

https://github.com/domcleal/foreman/commit/518a39c10.patch is patch against Foreman 1.4 (the one in comment 22 is against 1.5). Nate's reported promising results so far.

#24 Updated by Nicholas O'Connor about 5 years ago

I can confirm that this patch worked in my environment. vCenter 5.5 ESXi 5.5. Foreman 1.4 puppet 3.5.1

#25 Updated by Nate Walck about 5 years ago

I meant to update this sooner.

The patch provided works great! It completely fixed the problem as far as I can tell and VMWare provisioning is now rock solid when it comes to creating a new host and modifying compute profiles.

Thanks again for the patch!

#26 Updated by Dominic Cleal about 5 years ago

  • Has duplicate Bug #5584: Missing UUID parameters VMWare 5.5 (Foreman1.2) added

#27 Updated by Dominic Cleal about 5 years ago

  • Legacy Backlogs Release (now unused) changed from 4 to 17

To be released in 1.4.4 and 1.5.0.

#28 Updated by Dominic Cleal about 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#29 Updated by Checheta Yan over 3 years ago

Spam removed by Redmine administrator

Also available in: Atom PDF