Host UUID error after upgrading to 2.4.0

Problem:
After upgrading foreman to 2.4.0 we can no longer create hosts using libvirt compute resource. When creating the host the VM is created on libvirt side (with the correct UUID) but for some reason the UUID stored for the vm on foreman side is wrong it adds โ€œ8_โ€ in front of the UUID.
This generates an error since foreman is not able to start the VM cause it cannot find it with the incorrect UUID on libvirt.

Part of the log:

...
2021-04-23T09:53:01 [I|aud|644f05ab] Host::Base (606) create event on use_image 
2021-04-23T09:53:01 [I|aud|644f05ab] Host::Base (606) create event on image_file 
2021-04-23T09:53:01 [I|aud|644f05ab] Host::Base (606) create event on uuid 8_f193b5c0-a69c-41f6-a07e-724db2efecca
2021-04-23T09:53:01 [I|aud|644f05ab] Host::Base (606) create event on compute_resource_id 8
2021-04-23T09:53:01 [I|aud|644f05ab] Host::Base (606) create event on puppet_proxy_id 1
....
2021-04-23T09:53:03 [I|app|66957c2e] Backtrace for 'Failed retrieving libvirt vm by uuid 8_f193b5c0-a69c-41f6-a07e-724db2efecca' error (Libvirt::RetrieveError): Call to virDomainLookupByUUID failed: Invalid UUID
 66957c2e | /usr/share/foreman/vendor/ruby/2.5.0/gems/fog-libvirt-0.8.0/lib/fog/libvirt/requests/compute/list_domains.rb:9:in `lookup_domain_by_uuid'
 66957c2e | /usr/share/foreman/vendor/ruby/2.5.0/gems/fog-libvirt-0.8.0/lib/fog/libvirt/requests/compute/list_domains.rb:9:in `list_domains'
 66957c2e | /usr/share/foreman/vendor/ruby/2.5.0/gems/fog-libvirt-0.8.0/lib/fog/libvirt/models/compute/servers.rb:15:in `get'
 66957c2e | /usr/share/foreman/app/models/compute_resource.rb:183:in `find_vm_by_uuid'
 66957c2e | /usr/share/foreman/app/models/compute_resources/foreman/model/libvirt.rb:43:in `find_vm_by_uuid'
 66957c2e | /usr/share/foreman/app/controllers/hosts_controller.rb:280:in `vm'
 66957c2e | /usr/share/foreman/vendor/ruby/2.5.0/gems/actionpack-6.0.3.5/lib/action_controller/metal/basic_implicit_render.rb:

Expected outcome: Create the host and associate the vm with the correct UUID

Foreman version: 2.4.0
Proxy versions: 2.4.0

Distribution and version:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic

this seems to be caused by the proxmox plugin, created: Proxmox plugin breaks UUID creation on foreman for libvirt ยท Issue #197 ยท theforeman/foreman_fog_proxmox ยท GitHub to track this issue.

2 Likes

Thanks for getting back to us!