Project

General

Profile

Actions

Bug #33396

closed

Compute Resource cannot list the VMs if any VMs in the datacenter has config.instanceUuid set to ''

Added by Tomer Brisker almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Compute resources - VMware
Target version:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2000534

Description of problem:

When trying see the VMs from Virtual Machines tab of a Vmware Compute Resource, It shows "500 Internal Server" error.

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

Satellite 6.7 and above

How reproducible:

Under specific circumstances i.e when the value of instanceUuid of any VM in the concerned datacenter is set to ''

Steps to Reproduce:
1. Have a VM created in vCenter in a way that it's config.uuid and config.instanceUuid looks like below.

name = '/vmfs/volumes/60d169e5-cbe0d537-c0b3-94f128c38630/sandbox02/sandbox02.vmx',
guestFullName = 'Other (32-bit)',
version = 'vmx-13',
uuid = '',
instanceUuid = '',

2. Create a VMware Compute Resource in Satellite for that Datacenter where above VM resides.

3. Go to UI --> Infrastructure --> Compute Resources --> Click open the compute resource and go to the Virtual Machines tab

Actual results:

At Step 3: We can see 500 Internal Server error.

Rails debug shows following traceback in production.log

2021-08-10T16:33:16 [W|app|ea1023d4] Action failed
2021-08-10T16:33:16 [D|app|ea1023d4] Backtrace for 'Action failed' error (ActionView::Template::Error): No route matches {:action=>"show", :compute_resource_id=>#<Foreman::Model::Vmware id: 3, name: "sma7301", description: "", url: "myvcenter.example.com", user: "example\\svc-mis-satellite-ah", password: "encrypted-c0p0Wlc1cGV4MU1EdEJCWFhDdkcrcVpsRnRiTUxX...", uuid: "FR-MAR", type: "Foreman::Model::Vmware", created_at: "2019-01-14 10:56:15", updated_at: "2021-08-10 12:57:45", attrs: {:setpw=>1, :pubkey_hash=>"50addbd601d3dd8dff7e47608f4a84dbf0f2927bbc094bb27119e536fcf2f637", :display=>"vmrc"}, email: nil, caching_enabled: false, domain: nil, http_proxy_id: nil>, :controller=>"compute_resources_vms", :id=>""},
possible unmatched constraints: [:id]
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/formatter.rb:57:in `generate'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:744:in `generate'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:775:in `generate'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:822:in `url_for'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/url_for.rb:179:in `full_url_for'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/url_for.rb:169:in `url_for'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/routing_url_for.rb:91:in `url_for'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/turbolinks-2.5.4/lib/turbolinks/xhr_url_for.rb:19:in `url_for'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/helpers/url_helper.rb:202:in `link_to'
/usr/share/foreman/app/helpers/application_helper.rb:101:in `link_to_if_authorized'
/usr/share/foreman/app/views/compute_resources_vms/index/_vmware.html.erb:15:in `block in _65d7c00e9bb905a55a6f934bc60b7e1d'
/usr/share/foreman/app/views/compute_resources_vms/index/_vmware.html.erb:13:in `each'
/usr/share/foreman/app/views/compute_resources_vms/index/_vmware.html.erb:13:in `_65d7c00e9bb905a55a6f934bc60b7e1d'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/template.rb:159:in `block in render'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:170:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/template.rb:354:in `instrument_render_template'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/template.rb:157:in `render'
/opt/theforeman/tfm/root/usr/share/gems/gems/deface-1.5.3/lib/deface/action_view_extensions.rb:43:in `render'

Expected results:

The satellite should be able to bypass the problematic VMs and then provide us with the list of good VMs utilizing the compute resource connectivity.

Additional info:

Following is the code we have.

  1. grep 'vms =' /usr/share/foreman/app/services/fog_extensions/vsphere/mini_servers.rb
    vms = results.select { |result| result.obj.is_a?(RbVmomi::VIM::VirtualMachine) && result['config.template'] == templates && !result['config.instanceUuid'].nil? }

Based on discussion with the RH Engineering team, we needed to change it to look like below followed by a restart of satellite services and that fixed the issue.

  1. grep 'vms =' /usr/share/foreman/app/services/fog_extensions/vsphere/mini_servers.rb
    vms = results.select { |result| result.obj.is_a?(RbVmomi::VIM::VirtualMachine) && result['config.template'] == templates && result['config.instanceUuid'].present? }

Related issues 1 (0 open1 closed)

Related to Foreman - Bug #25295: VSphere vm with id==nil breaks listing of vmware vms in compute resourcesClosedMarkus BucherActions
Actions #1

Updated by Tomer Brisker almost 3 years ago

  • Subject changed from Compute Resource cannot list the VMs if any VMs in the datacenter has config.instanceUuid set to '' in Satellite 6.7 and above to Compute Resource cannot list the VMs if any VMs in the datacenter has config.instanceUuid set to ''
Actions #2

Updated by Tomer Brisker almost 3 years ago

  • Related to Bug #25295: VSphere vm with id==nil breaks listing of vmware vms in compute resources added
Actions #3

Updated by The Foreman Bot almost 3 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Tomer Brisker
  • Pull request https://github.com/theforeman/foreman/pull/8754 added
Actions #4

Updated by The Foreman Bot almost 3 years ago

  • Fixed in Releases 3.1.0 added
Actions #5

Updated by Tomer Brisker almost 3 years ago

  • Status changed from Ready For Testing to Closed
Actions #6

Updated by The Foreman Bot almost 3 years ago

  • Pull request https://github.com/theforeman/foreman/pull/8770 added
Actions #7

Updated by Ewoud Kohl van Wijngaarden almost 3 years ago

  • Target version set to 3.0.1
  • Triaged changed from No to Yes

Setting 3.0.1 now but can also be picked to 2.5.

Actions #8

Updated by Ondřej Ezr almost 3 years ago

  • Fixed in Releases 3.0.1 added
Actions

Also available in: Atom PDF