Project

General

Profile

Actions

Bug #1302

closed

undefined method `vcpu' for nil:NilClass

Added by Gaël Gustin over 12 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Host creation
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi,

I'm currently testing foreman for a possible start of production, but when I try to add a Host Group, I get the following error (I'm on debian - stable repository) :

undefined method `vcpu' for nil:NilClass

ctionView::TemplateError
undefined method `vcpu' for nil:NilClass
app/views/common/_hypervisor.html.erb:10
app/views/common/_hypervisor.html.erb:1
app/views/hostgroups/_form.html.erb:53
app/views/hostgroups/_form.html.erb:1
app/views/hostgroups/new.html.erb:3
app/controllers/application_controller.rb:214:in `process_error'
app/controllers/application_controller.rb:210:in `process_error'
app/controllers/hostgroups_controller.rb:63:in `create'


Related issues 1 (0 open1 closed)

Is duplicate of Foreman - Bug #1343: undefined method `vcpu' for nil:NilClass Duplicate11/21/2011Actions
Actions #1

Updated by Ohad Levy over 12 years ago

which version of foreman? afaik, this was fixed in the 0.4 release

Actions #2

Updated by Gaël Gustin over 12 years ago

Hi,

Thank you for your answer.
Version : 0.4

I tried to find which value make that error, it's when a set "virtual machine" > "provision on" to "KVM"

Actions #3

Updated by Ohad Levy over 12 years ago

  • Status changed from New to Feedback

this is most likely related to your hypervisor setup, does browsing the hypervisor guests works ? (or other hypervisor related errors)?

you should probably get the real error message there.

Actions #4

Updated by Gaël Gustin over 12 years ago

Hi,

Ok , I search in this way.

PS :
More information in /usr/share/foreman/log :

Processing HostgroupsController#create (for 10.99.98.68 at 2011-11-16 15:19:38) [POST]
Parameters: {"commit"=>"Submit", "action"=>"create", "authenticity_token"=>"X5fHEXIfqpwycUyeMB+LlHX/GzXJ+oHN494eZJmKh4w=", "hostgroup"=>{"architecture_id"=>"1", "subnet_id"=>"1", "puppetproxy_id"=>"", "name"=>"Monitoring", "puppetmaster_name"=>"", "domain_id"=>"1", "hypervisor_id"=>"1", "root_pass"=>"[FILTERED]", "medium_id"=>"5", "ptable_id"=>"3", "environment_id"=>"2", "parent_id"=>"", "puppetclass_ids"=>[""], "operatingsystem_id"=>"1"}, "controller"=>"hostgroups"}
Failed to save: Puppetmaster can't be blank, Memory can't be blank, Vcpu can't be blank, Storage pool can't be blank, Disk size can't be blank, Network type can't be blank, Interface can't be blank, Name has already been taken
Rendering template within layouts/application
Rendering hostgroups/new

ActionView::TemplateError (undefined method `vcpu' for nil:NilClass) on line #10 of app/views/common/_hypervisor.html.erb:
7:
8: <% if @hypervisor ||= item.try(:hypervisor) ->
9: <
= selectable_f f, :memory, select_memory(item) >
10: <
= text_f f, :vcpu, :value => (item.vcpu || @guest.vcpu), :label => "VCPU" >
11: <
= text_f f, :disk_size, :value => volume_size(item), :help_inline => "in GB" >
12: <
= selectable_f f, :storage_pool, @hypervisor.storage_pools >
13: <
= selectable_f f, :network_type, Hypervisor::NETWORK_TYPES %>

app/views/common/_hypervisor.html.erb:10
app/views/common/_hypervisor.html.erb:1
app/views/hostgroups/_form.html.erb:53
app/views/hostgroups/_form.html.erb:1
app/views/hostgroups/new.html.erb:3
app/controllers/application_controller.rb:214:in `process_error'
app/controllers/application_controller.rb:210:in `process_error'
app/controllers/hostgroups_controller.rb:63:in `create'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

app/views/common/_hypervisor.html.erb:10
app/views/common/_hypervisor.html.erb:1
app/views/hostgroups/_form.html.erb:53
app/views/hostgroups/_form.html.erb:1
app/views/hostgroups/new.html.erb:3
app/controllers/application_controller.rb:214:in `process_error'
app/controllers/application_controller.rb:210:in `process_error'
app/controllers/hostgroups_controller.rb:63:in `create'
Rendering template within layouts/application
Rendering common/500 (500)

Actions #5

Updated by Ohad Levy over 12 years ago

does browsing your hypervisor guests give yields errors? it seems to be an issue with your hypervisor setup.

the log sadly does not provide sufficient information.

Actions #6

Updated by Ohad Levy over 12 years ago

  • Status changed from Feedback to Duplicate
Actions #7

Updated by Ohad Levy over 12 years ago

  • Status changed from Duplicate to Feedback
Actions #8

Updated by Jakob N over 12 years ago

Hi,

the following error is shown:

NoMethodError
undefined method `find_volume_by_name' for nil:NilClass
/usr/share/foreman/vendor/plugins/virt/lib/virt/volume.rb:66:in `fetch_volume'
/usr/share/foreman/vendor/plugins/virt/lib/virt/volume.rb:14:in `initialize'
/usr/share/foreman/vendor/plugins/virt/lib/virt/guest.rb:18:in `new'
/usr/share/foreman/vendor/plugins/virt/lib/virt/guest.rb:18:in `initialize'
/usr/share/foreman/vendor/plugins/virt/lib/virt/host.rb:75:in `new'
/usr/share/foreman/vendor/plugins/virt/lib/virt/host.rb:75:in `find_guest_by_id'
/usr/share/foreman/vendor/plugins/virt/lib/virt/host.rb:74:in `map'
/usr/share/foreman/vendor/plugins/virt/lib/virt/host.rb:74:in `find_guest_by_id'
/usr/share/foreman/vendor/plugins/virt/lib/virt/host.rb:20:in `running_guests'
/usr/share/foreman/vendor/plugins/virt/lib/virt/host.rb:19:in `map'
/usr/share/foreman/vendor/plugins/virt/lib/virt/host.rb:19:in `running_guests'
/usr/share/foreman/vendor/plugins/virt/lib/virt/host.rb:15:in `guests'
/usr/share/foreman/app/models/hypervisor/guest.rb:6:in `all'
/usr/share/foreman/app/models/hypervisor.rb:34:in `guests'
/usr/share/foreman/app/models/hypervisor.rb:86:in `query'
/usr/share/foreman/app/models/hypervisor.rb:34:in `guests'
/usr/share/foreman/app/controllers/hypervisors/guests_controller.rb:9:in `index'

Back

I have one vm running with /usr/bin/kvm -S -M pc-0.12 -enable-kvm -m 384 -smp 1,sockets=1,cores=1,threads=1 -name vader -uuid b7318f79-1423-2662-37fd-e8c239cb2979 -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/vader.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -no-reboot -boot n -drive file=/srv/kvm/Platte.img,if=none,id=drive-ide0-0-0,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -device rtl8139,vlan=0,id=net0,mac=52:54:00:41:0e:8e,bus=pci.0,addr=0x3 -net tap,fd=49,vlan=0,name=hostnet0 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4

Actions #9

Updated by Ohad Levy over 12 years ago

Jakob N wrote:

Hi,

the following error is shown:
[...]

Do you have a storage pool defined?

Actions #10

Updated by Jakob N over 12 years ago

Thanks! Now I can select a value for memory, vcpu, ... This wasn't possible before.

Now I get "Failed to create Libirt instance foo.bar.de: Call to function virDomainDefineXML failed"

Processing HostsController#create (for 188.99.90.164 at 2011-11-21 22:39:33) [POST]
  Parameters: {"commit"=>"Submit", "action"=>"create", "authenticity_token"=>"q1H6OIoPPm4VugfGJVzBfzdto/O158CvGbuiO7mhits=", "controller"=>"hosts", "host"=>{"comment"=>"", "architecture_id"=>"2", "subnet_id"=>"1", "managed"=>"true", "puppetproxy_id"=>"", "name"=>"foo", "host_parameters_attributes"=>{"0"=>{"name"=>"", "nested"=>"", "value"=>"", "_destroy"=>""}}, "sp_mac"=>"", "powerup"=>"1", "network_type"=>"bridge", "puppetmaster_name"=>"puppet", "disk_size"=>"8", "memory"=>"1048576", "sp_name"=>"", "domain_id"=>"1", "storage_pool"=>"virtimages", "enabled"=>"1", "root_pass"=>"[FILTERED]", "build"=>"1", "medium_id"=>"3", "interface"=>"tap53", "hypervisor_id"=>"1", "hostgroup_id"=>"", "ptable_id"=>"1", "ip"=>"x.x.x.x", "environment_id"=>"1", "model_id"=>"", "disk"=>"", "sp_ip"=>"", "vcpu"=>"1", "puppetclass_ids"=>[""], "operatingsystem_id"=>"1"}}
Adding Libvirt instance storage for foo.bar.de
Adding Libvirt instance for foo.bar.de
Failed to create Libirt instance foo.bar.de: Call to function virDomainDefineXML failed
Rolling back due to a problem: Settings up libvirt instance foo.bar.de     2     failed     foo.bar.desetLibvirt
Removing Libvirt instance storage for foo.bar.de
Failed to save: Failed to create Libirt instance foo.bar.de: Call to function virDomainDefineXML failed
Rendering template within layouts/application
Rendering hosts/new
Completed in 1318ms (View: 743, DB: 23) 
Actions #11

Updated by Ohad Levy over 12 years ago

Can you confirm this is still an issue with latest 0.4.1 or develop branch?

what do you see in your hypervisor logs?

Actions #12

Updated by apoeleh apoeleh about 12 years ago

It is a echt air and inspires everyone to theorise it completly. This is indeed rale gripping and achievement the readers. I revalue your thoughts.......
Ultimate White Pages

Actions #13

Updated by Benjamin Papillon over 11 years ago

Hello,

Foreman changed a lot since your issue was reported. Do you still have the problem? Can you provide us with an update regarding this ticket ?

Thanks!

Actions #14

Updated by Benjamin Papillon over 11 years ago

  • Tracker changed from Support to Bug
Actions #15

Updated by Gaël Gustin over 11 years ago

Hello,

The problem is solved for me, you can close this ticket.

Regards,

Actions #16

Updated by Benjamin Papillon over 11 years ago

  • Status changed from Feedback to Closed

Thanks for the feedback, I'm closing the ticket

Actions

Also available in: Atom PDF