config settings for libguestfs to use software emulation

toppur asked:

When I ran libguestfs-test-tool on an ESXI VM I got some errors which appear to get resolved when I use software emulation.

The man page for libguestfs says:

will force the direct and libvirt backends to use TCG (software emulation) instead of KVM (hardware accelerated virtualization).

However, our application has many services (run by different users) which make use of libguestfs tools, and it is painful to have to set this environment variable for each script and service. One alternative seems to be to rebuild the libguestfs library with force_tcg baked in, but I need to support platforms other than ESXI.

Is there one location I can specify this setting to force tcg? I would have thought that /etc/libguestfs-tools.conf might be the place, but that only allows a read_only attribute to be set.

My answer:

It’s an environment variable; you can simply put it into everyone’s environment, e.g. in a shell script in /etc/profile.d, or in the Environment= setting in services’ systemd units.

Of course, for performance reasons you could instead enable nested virtualization for this VM in its ESXi configuration. This would allow KVM to work inside the VM and provide better performance than software emulation.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.