Project

General

Profile

Actions

Bug #13455

closed

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 almost 9 years ago. Updated over 6 years ago.

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

Description

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


Files

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

Related issues 1 (0 open1 closed)

Related to Foreman - Refactor #19579: require fog-libvirt 0.4.0Closed05/17/2017Actions
Actions #1

Updated by Dominic Cleal almost 9 years ago

  • Category set to Compute resources - libvirt
Actions #2

Updated by Dominic Cleal almost 9 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.

Actions #3

Updated by Chris Lord almost 9 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.

Updated by Karli Sjöberg over 8 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

Actions #5

Updated by Dominic Cleal over 8 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.

Actions #6

Updated by Karli Sjöberg over 8 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.

@Christian Holzheimer:
How similar is your setup compared to mine?

/K

Actions #7

Updated by Dominic Cleal over 8 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.

Actions #8

Updated by Karli Sjöberg over 8 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

Actions #9

Updated by Dominic Cleal over 8 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.

Actions #10

Updated by Petr Cervenka about 8 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')

Actions #12

Updated by Anonymous almost 8 years ago

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

Actions #13

Updated by Gert-Jan Rodenburg almost 8 years ago

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

Actions #14

Updated by Anonymous almost 8 years ago

could you install genisoimage also on the Foreman server?

Actions #15

Updated by Anonymous almost 8 years ago

What's the status here?

Actions #16

Updated by Anonymous almost 8 years ago

  • Translation missing: en.field_release 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.

Actions #17

Updated by The Foreman Bot almost 8 years ago

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

Updated by The Foreman Bot almost 8 years ago

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

Updated by Dominic Cleal almost 8 years ago

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

Updated by Anonymous almost 8 years ago

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

Updated by Anonymous over 7 years ago

Actions #22

Updated by The Foreman Bot over 6 years ago

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

Also available in: Atom PDF