Project

General

Profile

Bug #2612

VirtualMachine Tab empty when trying to create VM using fog 1.8.0-3 or 1.11.1

Added by Ronny M almost 6 years ago. Updated almost 6 years ago.

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

Description

  1. VMWare Esxi 5.0.0 managed by VSphere (VMware vCenter Server 5.0.0.16964)
  2. CentOS release 6.2 (Final)
  3. Foreman 1.2 RC1 without passenger/ssl

VirtualMachine TAB empty when trying to create Vmware VM with foreman 1.2 RC1. ((Using old Fog 1.8.0-3 (in RC1 yum repo) and newer fog-1.11-1 from http://koji.katello.org)

In /var/log/foreman/production.log.

Started GET "/hosts/user.jpg" for 192.168.88.1 at 2013-06-04 09:47:14 -0700
Processing by HostsController#show as HTML
Parameters: {"id"=>"user.jpg"}
Rendered common/404.html.erb within layouts/application (0.7ms)
Rendered home/_user_dropdown.html.erb (1.2ms)
Read fragment views/tabs_and_title_records-1 (0.2ms)
Rendered home/_topbar.html.erb (1.3ms)
Filter chain halted as :find_by_name rendered or redirected
Completed 404 Not Found in 12ms (Views: 6.1ms | ActiveRecord: 0.9ms)

Started POST "/hosts/compute_resource_selected" for 192.168.88.1 at 2013-06-04 09:47:18 -0700
Processing by HostsController#compute_resource_selected as */*
Parameters: {"architecture_id"=>"", "compute_resource_id"=>"1", "operatingsystem_id"=>""}
Rendered compute_resources_vms/form/_vmware.html.erb (162.0ms)
Rendered hosts/_compute.html.erb (201.9ms)
Operation FAILED: undefined method `init' for #<Class:0x000000081328d0>
Rendered common/500.html.erb (11.0ms)
Completed 500 Internal Server Error in 226ms (Views: 13.3ms | ActiveRecord: 0.0ms)
Connecting to database specified by database.yml

cat /usr/share/foreman-installer/foreman_installer/answers.yaml
---
foreman:
ssl: false
passenger: false
foreman_proxy:
dns: true
dhcp: true
puppetca: true
tftp: true
puppetrun: true
puppetmaster: true
puppet: true

Attached debug log (test with fog-1.11.1):

foreman-debug-Dh54X.tar.xz foreman-debug-Dh54X.tar.xz 85.4 KB Ronny M, 06/04/2013 02:58 PM
foreman-vmware.png View foreman-vmware.png 162 KB Ronny M, 06/04/2013 03:03 PM
compute_resource_vmware_show_existing_vm.png View compute_resource_vmware_show_existing_vm.png 127 KB Ronny M, 06/04/2013 03:14 PM
production.log production.log 78.2 KB Ronny M, 06/04/2013 03:25 PM
production-debug.log production-debug.log 66.5 KB Ronny M, 06/04/2013 03:33 PM
production-fog-1.8.0-3.log production-fog-1.8.0-3.log 34.9 KB Ronny M, 06/05/2013 03:36 PM
production-foreman1.1-fog-1.9.0.log production-foreman1.1-fog-1.9.0.log 4.98 KB Ronny M, 06/05/2013 03:43 PM
production_debug_foreman1.2_RC2.log production_debug_foreman1.2_RC2.log 23.9 KB Ronny M, 06/10/2013 06:00 AM
fog-1.9.0-foreman1.1-stable.txt fog-1.9.0-foreman1.1-stable.txt 9.05 KB fog 1.9.0 foreman-1.1-stable Ronny M, 06/10/2013 02:58 PM
fog-1.11.1-foreman1.2-RC2.txt fog-1.11.1-foreman1.2-RC2.txt 3.47 KB fog 1.11.1 foreman-1.2-RC2 Ronny M, 06/10/2013 02:58 PM
fog-1.8.0-3-foreman-1.2-RC1 fog-1.8.0-3-foreman-1.2-RC1 3.52 KB Ronny M, 06/10/2013 03:15 PM
production_rbvmomi-1.6.0-1.log production_rbvmomi-1.6.0-1.log 64.6 KB Ronny M, 06/11/2013 01:35 PM
Foreman vmware Compute resource vmware show existing vm

Related issues

Related to Foreman - Bug #2680: Unable to provisioning host using UI - vSphere 4.1.0Closed2013-06-192013-06-20

Associated revisions

Revision 467ea135 (diff)
Added by Dominic Cleal almost 6 years ago

fixes #2612 - move Task into Orchestration namespace due to RbVmomi conflict

Revision 5ea23ddd (diff)
Added by Dominic Cleal almost 6 years ago

fixes #2612 - move Task into Orchestration namespace due to RbVmomi conflict
(cherry picked from commit 467ea135da2b2309d306fd7e97d5c52a9ab00dbe)

History

#2 Updated by Dominic Cleal almost 6 years ago

  • Category set to Compute resources
  • Status changed from New to Need more information
  • Target version set to 1.2.0

Can you try enabling debug logging and then attach /var/log/foreman/production.log again please? It should create a long stack trace in the log file when you attempt selecting the compute resource.

Enabling debug logging: http://projects.theforeman.org/wiki/foreman/Troubleshooting#How-do-I-enable-debugging

#4 Updated by Ohad Levy almost 6 years ago

any chance you can turn on debugging (see in troubleshooting) and paste the same output?

#6 Updated by Ohad Levy almost 6 years ago

hmm.. did you restart and tried to do the same action again? I cant see it in the logs?

#8 Updated by Ronny M almost 6 years ago

Ohad Levy wrote:

hmm.. did you restart and tried to do the same action again? I cant see it in the logs?

Yes, but had not uploaded the log yet :)

#9 Updated by Ohad Levy almost 6 years ago

which kind of vmware are you do you have clusters support? (the trace shows it fails listing the clusters).

do you have any localization version of vmware etc? did it ever worked with foreman?

#10 Updated by Ronny M almost 6 years ago

Ohad Levy wrote:

which kind of vmware are you do you have clusters support? (the trace shows it fails listing the clusters).

do you have any localization version of vmware etc? did it ever worked with foreman?

VMWare Esxi 5.0.0 managed by VSphere (VMware vCenter Server 5.0.0.16964) First list of the BUG Desription :)
Cluster is named thuis. (dutch for home) My whole setup is running on wmware-workstation 9.0.2
Same setup does work with foreman 1.1

#11 Updated by Ronny M almost 6 years ago

Ronny M wrote:

Ohad Levy wrote:

which kind of vmware are you do you have clusters support? (the trace shows it fails listing the clusters).

do you have any localization version of vmware etc? did it ever worked with foreman?

VMWare Esxi 5.0.0 managed by VSphere (VMware vCenter Server 5.0.0.16964) First list of the BUG Desription :)
Cluster is named thuis. (dutch for home) My whole setup is running on wmware-workstation 9.0.2
Same setup does work with foreman 1.1

Foreman 1.1 uses fog-1.9.0. Foreman 1.2 tested with fog-1.8.0-3 (in rc1 yum repo an with 1.1.11-3)

#12 Updated by Ronny M almost 6 years ago

Added debug log using fog-1.8.0-3.

#13 Updated by Dominic Cleal almost 6 years ago

Thanks for the log files, that's very useful.

#14 Updated by Dominic Cleal almost 6 years ago

  • Status changed from Need more information to New

#15 Updated by Ronny M almost 6 years ago

Added log using foreman 1.1 with fog 1.9.0 (which does work). The same action with foreman 1.2 doesn't work.

#16 Updated by Ronny M almost 6 years ago

Tested also with foreman 1.2 RC2.

Now a empty screen with only the following error on the virtual machine TAB when trying to create a new host:

Error loading virtual machine information: Internal Server Error

Attached also the debug log when this error occurred.

#17 Updated by Ronny M almost 6 years ago

I'm not an expert but it looks like it's fog related.

fog 1.9.0 installed with foreman 1.1-stable is able to list servers when using fog on linux prompt. (attachment: fog-1.9.0-foreman1.1-stable)
fog 11.1.1 installed with foreman 1.2 RC2 results in: (Object doesn't support #inspect) for same command to list servers. (attachment: fog-1.11.1-foreman1.2-RC2)

attached for both situations.

#18 Updated by Ronny M almost 6 years ago

Ronny M wrote:

I'm not an expert but it looks like it's fog related.

fog 1.9.0 installed with foreman 1.1-stable is able to list servers when using fog on linux prompt. (attachment: fog-1.9.0-foreman1.1-stable)
fog 11.1.1 installed with foreman 1.2 RC2 results in: (Object doesn't support #inspect) for same command to list servers. (attachment: fog-1.11.1-foreman1.2-RC2)

attached examples/logs for both situations.

#19 Updated by Ronny M almost 6 years ago

Also tested with foreman-1.2 RC1 fog-1.8.0-3.

This time fog returns an empty list.

f.servers

<Fog::Compute::Vsphere::Servers
[]
>

attached example/log with name: fog-1.8.0-3-foreman-1.2-RC1

#20 Updated by Ronny M almost 6 years ago

Although it doesn't list servers it does see vmware templates. (Also in the foreman GUI: Provisioning => Compute resources => vmware => Virtual machines)

#21 Updated by Ohad Levy almost 6 years ago

what is the version of rbvmomi gem? it looks like we might have the wrong version in 1.2 vs 1.1?

#22 Updated by Ronny M almost 6 years ago

ruby193-rubygem-rbvmomi-1.2.3-7.el6.noarch

#23 Updated by Dominic Cleal almost 6 years ago

  • Status changed from New to Assigned
  • Assignee set to Dominic Cleal

Thanks, we think this is far too old, as even 1.1 shipped 1.5.1. I'm trying to build a new version at the moment, will let you know when it's available to test.

#24 Updated by Ronny M almost 6 years ago

The above version is of foreman 1.2 RC2

foreman 1.1-stable has rubygem-rbvmomi-1.5.1-1.el6.noarch

So you might be right the one in 1.2 is older then the one in 1.1.

#25 Updated by Ronny M almost 6 years ago

Ok, it will test it as soon as the new version is availible

#26 Updated by Dominic Cleal almost 6 years ago

  • Status changed from Assigned to Feedback

Here's the updated RPM, just download and upgrade it, then restart Foreman (or httpd if using passenger).

http://koji.katello.org/koji/getfile?taskID=39206&name=ruby193-rubygem-rbvmomi-1.6.0-1.el6.noarch.rpm

Let me know how you get on.

#27 Updated by Ronny M almost 6 years ago

Virtual Machine Tab now shows VM Settings/Details.
But during creation of the VM I get the following error

Unable to save
Failed to create a compute vmware (VMWare) instance bla4.local.domain: failed to create vm: unexpected type Task (Task/Object/Foreman::Util/PSON::Pure::Generator::GeneratorMethods::Object/GettextI18nRails::HtmlSafeTranslations/FastGettext::Translation/PP::ObjectMixin/ActiveSupport::Dependencies::Loadable/JSON::Ext::Generator::GeneratorMethods::Object/Kernel/BasicObject)

Although there is an error the VM is created in VMWARE but not powered up.
VM Is also not created as host in foreman.

Attached debug log: production_rbvmomi-1.6.0-1

#28 Updated by Peter Gustafsson almost 6 years ago

I'm hitting the same issue using foreman 1.2 rc.2 and vmware ESXi, 5.1.0,914609. I have updated rbvmomi as above and can now se VM Settings/Details. But when creating a new VM i get.

Failed to create a compute vmware (VMWare) instance rhidm.example.com: failed to create vm: unexpected type Task (Task/Object/Foreman::Util/PSON::Pure::Generator::GeneratorMethods::Object/GettextI18nRails::HtmlSafeTranslations/FastGettext::Translation/PP::ObjectMixin/ActiveSupport::Dependencies::Loadable/JSON::Ext::Generator::GeneratorMethods::Object/Kernel/BasicObject)

#29 Updated by Dominic Cleal almost 6 years ago

  • Status changed from Feedback to New
  • Assignee deleted (Dominic Cleal)
  • Priority changed from Normal to High

#30 Updated by Ronny M almost 6 years ago

Although not all of the following rpm's are installed in both foreman 1.1 and 1.2, the ones in foreman 1.2 are also older then the onces in foreman 1.1
Not sure if this is what causes the problems but expected newer rpm's in foreman 1.2

  1. foreman 1.1:
    rubygem-ffi-1.0.11-1.el6.x86_64.rpm
    rubygem-json-1.6.8-1.el6.x86_64.rpm
    rubygem-net-ldap-0.3.1-1.el6.noarch.rpm
    rubygem-pg-0.13.2-2.el6.x86_64.rpm
    rubygem-rest-client-1.6.7-1.el6.noarch.rpm
  1. foreman 1.2:
    ruby193-rubygem-ffi-1.0.9-10.el6.x86_64.rpm
    ruby193-rubygem-json-1.5.4-29.el6.x86_64.rpm
    ruby193-rubygem-net-ldap-0.2.2-5.el6.noarch.rpm
    ruby193-rubygem-pg-0.12.2-8.el6.x86_64.rpm
    ruby193-rubygem-rest-client-1.6.1-4.el6.noarch.rpm

#31 Updated by Ronny M almost 6 years ago

Any plans to build newer versions for the 1.2 RC2 rpm's mentioned above?

I'm happily willing to test them as soon as they come available.

#32 Updated by Ronny M almost 6 years ago

Any plans to build newer versions for the 1.2 RC2 rpm's mentioned above?

I'm happily willing to test them as soon as they come available.

#33 Updated by Dominic Cleal almost 6 years ago

I hadn't planned on building them as they don't look directly related. Amos is planning to look at this on an RPM build to see if he can reproduce it, if any of them look like likely suspects then we'll try some rebuilds.

#34 Updated by Dominic Cleal almost 6 years ago

  • Status changed from New to Assigned
  • Assignee set to Dominic Cleal

Reproduced this issue now.

#35 Updated by Dominic Cleal almost 6 years ago

I think this is due to a bug in rbvmomi 1.6.0, as I went and built the latest release when we found it was out of date above. I've applied a patch from upstream that was committed since the release and it seems to help on my local development setup, here's a test RPM build for you to try:

http://koji.katello.org/koji/getfile?taskID=39976&name=ruby193-rubygem-rbvmomi-1.6.0-2.git.18.e7f3436.el6.noarch.rpm

If that doesn't help, I could go back and build 1.5.1, but I'd like to avoid that as it means yum downgrades or epoch numbers.

My RHEL 6 instance is now getting the error "failed to create vm: undefined method `resourcePool' for nil:NilClass", so I'll look into this next.

#36 Updated by Ronny M almost 6 years ago

Doesn't work for me either. With Folder on: "VM Folder" I get the following error on my first attempt to create a new VM after updating rvbcomi to 1.6.0-2.

Unable to save
Failed to create a compute vmware (VMWare) instance test300.local.domain: failed to create vm: undefined method `resourcePool' for nil:NilClass

But when I try to create another VM with different name and ip after above error occurred I get the following error again:

Unable to save
Failed to create a compute vmware (VMWare) instance test400.local.domain: failed to create vm: unexpected type Task (Task/Object/Foreman::Util/PSON::Pure::Generator::GeneratorMethods::Object/GettextI18nRails::HtmlSafeTranslations/FastGettext::Translation/PP::ObjectMixin/ActiveSupport::Dependencies::Loadable/JSON::Ext::Generator::GeneratorMethods::Object/Kernel/BasicObject)

But With Folder on: "vm/Servers" during a first attempt after updating the rpm I get the following error right away:

Unable to save
Failed to create a compute vmware (VMWare) instance hallo.local.domain: failed to create vm: unexpected type Task (Task/Object/Foreman::Util/PSON::Pure::Generator::GeneratorMethods::Object/GettextI18nRails::HtmlSafeTranslations/FastGettext::Translation/PP::ObjectMixin/ActiveSupport::Dependencies::Loadable/JSON::Ext::Generator::GeneratorMethods::Object/Kernel/BasicObject)

#37 Updated by Dominic Cleal almost 6 years ago

  • Status changed from Assigned to Ready For Testing

Ignore that, I think it was a red herring. Sorry for wasting your time testing that Ronny.

Comparing the rbvmomi deserialisation behaviour in the test harness to the error, I think it's loading the wrong "Task" class. We're probably hitting this now because of the switch from Ruby 1.8 to 1.9.

Compare and contrast the ancestors of the RbVmomi::VIM::Task class with those in the error message:

2.0.0p0 :015 > self.class.const_get('RbVmomi::VIM::Task').ancestors
 => [RbVmomi::VIM::Task, RbVmomi::VIM::ExtensibleManagedObject, RbVmomi::BasicTypes::ManagedObject, RbVmomi::BasicTypes::ObjectWithMethods, RbVmomi::BasicTypes::ObjectWithProperties, RbVmomi::BasicTypes::Base, Object, Metaclass::ObjectMethods, Mocha::ObjectMethods, Foreman::Util, PSON::Pure::Generator::GeneratorMethods::Object, GettextI18nRails::HtmlSafeTranslations, FastGettext::Translation, V8::Conversion::Object, PP::ObjectMixin, ActiveSupport::Dependencies::Loadable, JSON::Ext::Generator::GeneratorMethods::Object, Kernel, BasicObject] 
2.0.0p0 :010 > self.class.const_get('Task').ancestors
 => [Task, Object, Metaclass::ObjectMethods, Mocha::ObjectMethods, Foreman::Util, PSON::Pure::Generator::GeneratorMethods::Object, GettextI18nRails::HtmlSafeTranslations, FastGettext::Translation, V8::Conversion::Object, PP::ObjectMixin, ActiveSupport::Dependencies::Loadable, JSON::Ext::Generator::GeneratorMethods::Object, Kernel, BasicObject] 

Since Task isn't namespaced, the const_get in rbvmomi is often(?!) hitting ours. The error we see in above (Ronny's comment 27) is a printout of the ancestors as rbvmomi can't find the RbVmomi::BasicTypes::ManagedObject ancestors because it's found our Task class.

PR: https://github.com/theforeman/foreman/pull/730/files

#38 Updated by Ronny M almost 6 years ago

Dominic,

You are right.

I applied you pull request into my setup and know creating a VM does work :)

#39 Updated by Dominic Cleal almost 6 years ago

Ronny M wrote:

I applied you pull request into my setup and know creating a VM does work :)

Thank you for testing!

#40 Updated by Ronny M almost 6 years ago

Ronny M wrote:

Dominic,

You are right.

I applied you pull request into my setup and now creating a VM does work :)

#41 Updated by Ronny M almost 6 years ago

Oeps sorry,

Correcting a typo in my comment duplicated my comment :(

#42 Updated by Dominic Cleal almost 6 years ago

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

Also available in: Atom PDF