Foreman Provisioning non-KVM Guests on Libvirt?


Is it possible to use Foreman to provision Libvirt VM’s on a host that is not VT Enabled?

I have been doing some extensive testing of the capabilities of Foreman and Katello in a home-lab to validate it as a viable management tool for an enterprise use case.

The problem I am facing is that some of the hardware I have available in the home lab is outdated :slight_smile:
(Dell Precision T5400).

The system actually can support virtualization, however, anytime I deploy a KVM Guest with the BIOS feature for VTx enabled, the host experiences a kernel panic and reboots itself. I have gone through and replaced every DIMM and have confirmed there are no hardware faults on the system.

If I have the feature disabled, I can create and run a KVM guest on the host using Virt-Manager without issues - just a prompt that states that the VM’s may perform poorly - which I am fine with given this is for testing only.

That said - when I try to use Foreman to deploy a guest on this particular compute resource, I get the following error:

Unable to save * Failed to create a compute warriorhost.tiger.local (Libvirt) instance meass.tiger.local: Error saving the server: Call to virDomainDefineXML failed: invalid argument: could not find capabilities for arch=x86_64 domaintype=kvm

Is there a place I can configure a custom DomainXML file for this particular host to deploy VM’s that use a different Domain Type?

Expected outcome:

Create non-KVM Guests using the Foreman and Libvirt

Foreman and Proxy versions:

Foreman 3.3.1

Distribution and version:

CentOS 7.9.2009

Other relevant data:

Example XML From a working QEMU Guest

<domain type='qemu'>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    <boot dev='hd'/>

1 Like

We don’t support changing the domai_type (which defaults to kvm in fog-libvirt), but you could try the following patch:

diff --git app/models/compute_resources/foreman/model/libvirt.rb app/models/compute_resources/foreman/model/libvirt.rb
index ee2cbc38f..a693cd9c2 100644
--- app/models/compute_resources/foreman/model/libvirt.rb
+++ app/models/compute_resources/foreman/model/libvirt.rb
@@ -30,6 +30,7 @@ module Foreman::Model
     def host_compute_attrs(host)
       super.tap do |attrs|
         attrs[:arch] = host.architecture.try(:name) || "x86_64"
+        attrs[:domain_type] = 'qemu'
1 Like


Newbie question - How do I apply this patch? :slight_smile:

1 Like

Heh, you either save the above to a file on your foreman machine, then go to /usr/share/foreman and run patch -p0 < /path/to/the/saved/file, or, given this is a oneliner, you can just vi /usr/share/foreman/app/models/compute_resources/foreman/model/libvirt.rb and edit the host_compute_attrs function to have the domain_type line added after the arch line.

Afterwards you restart Foreman with systemctl restart foreman and re-try your provisioning.

1 Like

You rock! I found the file and modified the domain_type line to libvirt.rb

Works like a charm. Performance is crap lol but that was expected.

Thanks again.


1 Like