Bug #13455
closedUnable to create host from template on libvirt compute resource: Failed to create a compute libvirt (Libvirt) instance host: can't convert nil into String
Files
Updated by Dominic Cleal almost 9 years ago
- Category set to Compute resources - libvirt
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.
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 almost 9 years ago
- File libvirt-debug.log libvirt-debug.log added
- File production-debug.log production-debug.log added
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
Updated by Dominic Cleal almost 9 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
.
Updated by Karli Sjöberg almost 9 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
Updated by Dominic Cleal almost 9 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 ResourceDuring provision I have for network:
Managed, Primary, Provision - CheckedWhere 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.
Updated by Karli Sjöberg almost 9 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
Updated by Dominic Cleal almost 9 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.
Updated by Petr Cervenka over 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')
Updated by Petr Cervenka over 8 years ago
Updated by Anonymous about 8 years ago
Could you guys check if this is https://github.com/fog/fog-libvirt/pull/31? It's solved by installing genisoimage.
Updated by Gert-Jan Rodenburg about 8 years ago
I've got genisoimage installed on the hostmachine, still have the error.
Updated by Anonymous about 8 years ago
could you install genisoimage also on the Foreman server?
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.
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
Updated by The Foreman Bot almost 8 years ago
- Pull request https://github.com/theforeman/foreman-packaging/pull/1477 added
Updated by Dominic Cleal almost 8 years ago
- Project changed from Foreman to Packaging
- Category deleted (
Compute resources - libvirt)
Updated by Anonymous almost 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset foreman-packaging|ca6462c45abddcaf29e73c4b77cbe73bc0a26bc8.
Updated by Anonymous over 7 years ago
- Related to Refactor #19579: require fog-libvirt 0.4.0 added
Updated by The Foreman Bot over 6 years ago
- Pull request https://github.com/theforeman/foreman-packaging/pull/2612 added