Ask Your Question

Foreman : "Fog::Compute::Vsphere::NotFound" message when I try to edit a host

asked 2016-09-12 03:19:25 -0500

Imagin0s gravatar image


In the context of my work, we have recently migrated a dozen servers from a vcenter to another : pwcenter101 => pavcenter101

Naturally, I have done the changes in foreman in "Infrastructure" > "Compute resources" and changed ; - vcenter : pwcenter101 => pavcenter101 - thumbprint When I click on "test the connection", there is no error message.

The problem is now that I am trying to edit a host from the new vcenter, I get the following message "Fog::Compute::Vsphere::NotFound"

Here below is the complete ruby stacktrace found in production.log :

2016-09-12 10:14:20 [app] [I] | | Started GET "/hosts/" for at 2016-09-12 10:14:20 +0200 2016-09-12 10:14:20 [app] [I] Processing by HostsController#edit as HTML 2016-09-12 10:14:20 [app] [I] Parameters: {"id"=>""} 2016-09-12 10:14:20 [app] [I] Rendered hosts/progress.html.erb (0.3ms) 2016-09-12 10:14:21 [app] [I] Rendered configgroups/configgroup.html.erb (48.3ms) 2016-09-12 10:14:21 [app] [I] Rendered configgroups/configgroupsselection.html.erb (63.7ms) 2016-09-12 10:14:21 [app] [I] Rendered puppetclasses/selectedClasses.html.erb (0.0ms) 2016-09-12 10:14:21 [app] [I] Rendered puppetclasses/classesingroups.html.erb (0.0ms) 2016-09-12 10:14:22 [app] [I] Rendered puppetclasses/classes.html.erb (751.9ms) 2016-09-12 10:14:22 [app] [I] Rendered puppetclasses/classselection.html.erb (1128.6ms) 2016-09-12 10:14:22 [app] [I] Rendered nic/baseform.html.erb (27.5ms) 2016-09-12 10:14:22 [app] [I] Rendered nic/virtualform.html.erb (2.3ms) 2016-09-12 10:14:22 [app] [I] Rendered computeresourcesvms/form/vmware/network.html.erb (524.3ms) 2016-09-12 10:14:22 [app] [I] Rendered nic/providerspecificform.html.erb (530.4ms) 2016-09-12 10:14:22 [app] [I] Rendered nic/manageds/managed.html.erb (563.3ms) 2016-09-12 10:14:22 [app] [I] Rendered hosts/interfaces.html.erb (565.9ms) 2016-09-12 10:14:22 [app] [I] Rendered hosts/form.html.erb (1766.0ms) 2016-09-12 10:14:22 [app] [I] Rendered hosts/edit.html.erb within layouts/application (1771.8ms) 2016-09-12 10:14:22 [app] [W] Action failed | Fog::Compute::Vsphere::NotFound: Fog::Compute::Vsphere::NotFound | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-1.34.0/lib/fog/vsphere/requests/compute/getdatacenter.rb:7:in get_datacenter' | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-1.34.0/lib/fog/vsphere/models/compute/datacenters.rb:15:inget' | /usr/share/foreman/app/models/computeresources/foreman/model/vmware.rb:431:in dc' | /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:76:innetworks' | /usr/share/foreman/app/views/computeresourcesvms/form/vmware/network.html.erb:1:in _app_views_compute_resources_vms_form_vmware__network_html_erb__3489032629212292611_81610780' | /opt/rh/ruby193/root/usr/share/gems/gems/actionpack-3.2.8/lib/action_view/template.rb:145:inblock in render' | /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/activesupport/notifications.rb:125:in instrument' | /opt/rh/ruby193/root/usr/share/gems/gems ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-09-14 02:51:29 -0500

domcleal gravatar image

The UUIDs that Foreman tracks the VMs with may have changed during the migration, or it isn't even able to see the VMs on the new host if they are unchanged.

Check if you can view VMs correctly under Infrastructure > Compute resources > your vCenter CR > Virtual Machines tab. If so, then you need to disassociate and optionally re-associate VMs in Foreman for it to find their new UUIDs. This isn't a fully reliable process (see below).

Disassociation changes the Foreman hosts to essentially be bare metal hosts, so it no longer has any knowledge of the VM. When the host edited, then it won't raise that error contacting vSphere, and when it is deleted, no VM will be deleted as it's disassociated. Disassociate hosts either from the button on the host edit page or from the host list using the checkboxes and Select Action dropdown menu.

Hosts can be associated again by navigating back to the compute resource, then clicking the Associate VMs button in the top-right corner. This searches for hosts and VMs with the same registered MAC address (in the case of vSphere) and links them together. If successful, the host edit should now show VM details again and when deleting a host, the corresponding VM will be deleted. If it doesn't associate, it's likely that the MAC address registered in Foreman doesn't match.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2016-09-12 03:19:25 -0500

Seen: 65 times

Last updated: Sep 14 '16