Project

General

Profile

Bug #13455

Unable to create host from template on libvirt compute resource: Failed to create a compute libvirt (Libvirt) instance host: can't convert nil into String

Added by Chris Lord over 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:

Description

Pastebin of stacktrace from /var/log/foreman/production.log
http://pastebin.com/vdpu7AzK

production-debug.log production-debug.log 89 KB Karli Sjöberg, 03/19/2016 06:41 PM
libvirt-debug.log libvirt-debug.log 446 KB Karli Sjöberg, 03/19/2016 06:41 PM
Screenshot 2016-08-31 21.20.18.png View Screenshot 2016-08-31 21.20.18.png 48.4 KB Petr Cervenka, 08/31/2016 09:20 AM
Screenshot%202016 08 31%2021.20.18

Related issues

Related to Foreman - Refactor #19579: require fog-libvirt 0.4.0Closed2017-05-17

Associated revisions

Revision ca6462c4 (diff)
Added by Michael Moll over 3 years ago

Fixes #13455 - Require genisoimage for -libvirt

Revision 843c1234 (diff)
Added by Michael Moll over 3 years ago

Fixes #13455 - Recommend genisoimage for -libvirt

History

#1 Updated by Dominic Cleal over 4 years ago

  • Category set to Compute resources - libvirt

#2 Updated by Dominic Cleal over 4 years ago

Underlying errors:

2016-01-29T10:29:08 [app] [W] Unhandled Libvirt error
 | Fog::Errors::Error: Error saving the server: undefined method `Error' for Fog::Errors:Module
| /usr/share/foreman/vendor/ruby/1.9.1/gems/fog-libvirt-0.0.3/lib/fog/libvirt/models/compute/server.rb:67:in `rescue in save'
 | /usr/share/foreman/vendor/ruby/1.9.1/gems/fog-libvirt-0.0.3/lib/fog/libvirt/models/compute/server.rb:60:in `save'
| /usr/share/foreman/app/models/compute_resources/foreman/model/libvirt.rb:125:in `create_vm'
 | /usr/share/foreman/app/models/concerns/orchestration/compute.rb:76:in `setCompute'
| /usr/share/foreman/app/models/concerns/orchestration.rb:168:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:113:in `block in process'
| /usr/share/foreman/app/models/concerns/orchestration.rb:105:in `each'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:105:in `process'
| /usr/share/foreman/app/models/concerns/orchestration.rb:35:in `on_save'

Possibly the fog-core errors file isn't loaded or something for that not to be defined.

As a workaround you might want to try checking the Libvirt server's logs for the error thrown, as this is a bug in Foreman/Fog's error reporting.

#3 Updated by Chris Lord over 4 years ago

Any suggestions for logs to check?

I've checked /var/log/libvirt/libvirtd.log and /var/log/syslog and there was no output. The only time I get output is if I try to reuse a host name, which causes it to complain that the storage volume already exists.

Thank you for your help.

#4 Updated by Karli Sjöberg over 4 years ago

Me to! Foreman 1.10.2.

Create a template and enable "User data", associate "user_data" template with operating system, select "user_data" template for operating system, create new host from libvirt compute resource and choose "Image Based" in "Operating System" tab results in this error. Changing from "user_data" to "finish" and provision with SSH works.

Attached production.log from foreman server and libvirtd.log from hypervisor, both in debug mode. Trying to provision new host "blah.inparadise.se". No mention of any "blah" in libvirt at all. There is SSH login from foreman server though (172.16.1.11).

/K

#5 Updated by Dominic Cleal over 4 years ago

The broken error handling (undefined method `Error') is a severe problem that'll prevent us investigating this much. I don't know why that's happening from the code, and I can't reproduce it.

A couple of thoughts from things I've seen:

Do you have a "default" pool, and what directory is it at? There's a bug in fog-libvirt (we're tracking under #13778) where it assumes the pool is at /var/lib/libvirt/images/, so when it creates an ISO image in the real 'default' location, it specifies the wrong path when creating the VM.

Is there a cloud-init disk in the pool already for the host you're building? You may need to delete it, then call virsh pool-refresh default.

#6 Updated by Karli Sjöberg over 4 years ago

@Dominic
I think you need a couple of things for this problem to manifest. I´ll go over my setup. I have:
Smart-proxies - TFTP, DNS, Puppet, PuppetCA (and not DHCP as it cannot be managed)
Subnet - IPAM (Internal DB), Boot mode DHCP, Proxies DHCP (None), TFTP, DNS
Domain - DNS Proxy
Libvirt Compute Resource

During provision I have for network:
Managed, Primary, Provision - Checked

Where the "Managed" part says:
"Should this interface be managed via DHCP and DNS smart proxy and should it be configured during provisioning?"

"DHCP and DNS". Could it be that "Managed" really needs them both or is it ok with just DNS? What does the code say about that?

Anyway, yes I had the standard "default" pool. I tried removing it but it didn´t matter.

@Chris:
How similar is your setup compared to mine?

/K

#7 Updated by Dominic Cleal over 4 years ago

Karli Sjöberg wrote:

@Dominic
I think you need a couple of things for this problem to manifest. I´ll go over my setup. I have:
Smart-proxies - TFTP, DNS, Puppet, PuppetCA (and not DHCP as it cannot be managed)
Subnet - IPAM (Internal DB), Boot mode DHCP, Proxies DHCP (None), TFTP, DNS
Domain - DNS Proxy
Libvirt Compute Resource

During provision I have for network:
Managed, Primary, Provision - Checked

Where the "Managed" part says:
"Should this interface be managed via DHCP and DNS smart proxy and should it be configured during provisioning?"

"DHCP and DNS". Could it be that "Managed" really needs them both or is it ok with just DNS? What does the code say about that?

None of this is likely to be relevant, the error is in creating a VM, not to do with DNS or DHCP. The text means that Managed must be ticked for DNS and DHCP to be managed, not that you require DNS and DHCP to have a Managed interface.

Anyway, yes I had the standard "default" pool. I tried removing it but it didn´t matter.

No, it must exist - and at the moment, in /var/lib/libvirt/images.

#8 Updated by Karli Sjöberg over 4 years ago

Oh, OK, I misunderstood. Well, if that´s the case then I had it before, so that´s not it then, right?

/K

#9 Updated by Dominic Cleal over 4 years ago

Indeed, I don't have any more ideas at the moment and still can't see why the error during error reporting is happening.

#10 Updated by Petr Cervenka almost 4 years ago

Hi

Having exactly same issue on Ubuntu with same setup , Cloud Image, with user_data, have default pool and even have symlinks to /var/lib/libvirt/images still happening.. log is very useless as it just says (undefined method `Error')

#12 Updated by Anonymous over 3 years ago

Could you guys check if this is https://github.com/fog/fog-libvirt/pull/31? It's solved by installing genisoimage.

#13 Updated by Gert-Jan Rodenburg over 3 years ago

I've got genisoimage installed on the hostmachine, still have the error.

#14 Updated by Anonymous over 3 years ago

could you install genisoimage also on the Foreman server?

#15 Updated by Anonymous over 3 years ago

What's the status here?

#16 Updated by Anonymous over 3 years ago

  • Legacy Backlogs Release (now unused) set to 189

I just ran again into this. While the exception is fixed in fog-libvirt's current master, I'll open PR to have foreman-libvirt recommend genisoimage, which will solve this effectively.

#17 Updated by The Foreman Bot over 3 years ago

  • Assignee set to Anonymous
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman-packaging/pull/1476 added

#18 Updated by The Foreman Bot over 3 years ago

  • Pull request https://github.com/theforeman/foreman-packaging/pull/1477 added

#19 Updated by Dominic Cleal over 3 years ago

  • Project changed from Foreman to Packaging
  • Category deleted (Compute resources - libvirt)

#20 Updated by Anonymous over 3 years ago

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

#21 Updated by Anonymous about 3 years ago

#22 Updated by The Foreman Bot about 2 years ago

  • Pull request https://github.com/theforeman/foreman-packaging/pull/2612 added

Also available in: Atom PDF