Using Libvirt image based provisioning error

When attempting to provision using a qcow2 image file I receive the following error message:

Failed to create a compute (Libvirt) instance Call to virStorageVolCreateXML failed: XML error: malformed owner element**

Expected outcome:
Successful VM provisioning from the base image.

Foreman and Proxy versions:
Foreman 3.0.1

Foreman and Proxy plugin versions:
Katello 4.2

Distribution and version:
CentOS7 fully up to date

Other relevant data:

Hello and welcome.

I do not recommend libvirt compute resource for production deployments, it is meant more for development scenarios. With that, I need you to share the XML request that goes into libvirt, there is some kind of parsing error there.

Also, state libvirt version ( and OS.

I’m not the original poster, but I recently encountered this same problem when I tried, for the first time, to provision a host from a QCOW2 image on my KVM/QEMU compute resource from Satellite 6.10.1. (Which uses foreman-

I enabled debug logging on my KVM/QEMU server and will upload the relevant section of its /var/log/libvirt/libvirtd.log along with my satellite’s /var/log/foreman/production.log, shortly. But from me looking at it, it appears that it does not like the XML having a blank owner section:

In my satellite’s Hosts —> Create Host —> Virtual Machine tab, there is no “owner” setting.

Oops, I get a Sorry, new users can not upload attachments message when I try to upload my log files. Their sizes (libvirtd.log is 823 kB and production.log is 32 kB) are likely too big for me to copy & paste into a comment.

Please instruct me on how to get them to you, @lzap . Thanks!

Just FYI, I took the XML appearing in the log file and tried to use it via the virsh vol-create command on my KVM/QEMU server. It considered both the blank owner and group entries as “malformed elements”.

It also errored on my format type being “raw”, stating: error: this function is not supported by the connection driver: backing storage not supported for raw volumes.

Making those changes, I was able to get it to work. So the question becomes how to get Satellite to not leave the owner and group elements blank.

# cat volume.xml
<volume type='file'>
  <allocation unit="G">0</allocation>
  <capacity unit="G">10</capacity>
    <format type="qcow2"/>
      <format type="qcow2"/>

# virsh vol-create default volume.xml
Vol rhel84-010.testnet.localdomain-disk1 created from volume.xml
1 Like

Yes, thanks for the update.

If we were not using Ruby Fog library, we could actually use direct libvirt API and perhaps use Foreman templating system to actually build the whole XML so users could customize pretty much anything…

But we have fog. :slight_smile:

Thanks for the reply, @lzap . It sounds like you are saying there is no solution at this time. Any fix would require the replacement of the Ruby Fog library. (GitHub - fog/fog-libvirt: libvirt provider for fog)

Am I understanding that correctly? I don’t think I am, because I would think that we just need to change whatever it is in Satellite that puts together the request to Ruby Fog to not leave the owner and group values blank.

Well, yeah, Foreman uses a library that exposes only few options that can be utilized. Looking into that, it looks like it sets owner/group everytime even if its possible unset (null/nil):

How about this, I haven’t tried this but can you try to locate this file and updated it accordingly as in this patch:

If this works for you, we can merge this and release a new version of the library and include it in the future version of Foreman/Satellite. Get back to me with the result, thanks.

Thank you, @lzap . It worked! Doing this:

# cp -p /opt/theforeman/tfm/root/usr/share/gems/gems/fog-libvirt-0.9.0/lib/fog/libvirt/models/compute/templates/volume.xml.erb /opt/theforeman/tfm/root/usr/share/gems/gems/fog-libvirt-0.9.0/lib/fog/libvirt/models/compute/templates/volume.xml.erb_backup

# vi /opt/theforeman/tfm/root/usr/share/gems/gems/fog-libvirt-0.9.0/lib/fog/libvirt/models/compute/templates/volume.xml.erb

# diff /opt/theforeman/tfm/root/usr/share/gems/gems/fog-libvirt-0.9.0/lib/fog/libvirt/models/compute/templates/volume.xml.erb_backup /opt/theforeman/tfm/root/usr/share/gems/gems/fog-libvirt-0.9.0/lib/fog/libvirt/models/compute/templates/volume.xml.erb
<             <owner><%= owner %></owner>
<             <group><%= group %></group>
>             <% if owner -%>
>               <owner><%= owner %></owner>
>             <% end -%>
>             <% if group -%>
>               <group><%= group %></group>
>             <% end -%>

…resulted in an XML block being sent to my KVM/QEMU server that did not have the owner or group elements. The virtual machine got built. Thank you!

1 Like

Okay, that should be hopefully included in fog-libvirt-0.9.1 soonish. Until then, apply the patch until it gets into Satellite 7.1 (7.0 is already in the testing). Thanks for a quick check!