Bug 1648403

Summary: Running guestfish under a vmware hypervisor fails with default configuration
Product: [Community] Virtualization Tools Reporter: Derek Ditch <derek>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED NOTABUG QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: dustymabe, ptoscano, tburke
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-09-25 13:38:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Derek Ditch 2018-11-09 15:53:04 UTC
Description of problem:
When running guestfish under nested virtualization in a VMware hypervisor, the call to qemu fails. I ran into this while trying to build Fedora CoreOS and filed a bug here: https://github.com/coreos/coreos-assembler/issues/198

Version-Release number of selected component (if applicable):
guestfish 1.38.6fedora=28,release=1.fc28,libvirt

How reproducible:
100%

Steps to Reproduce:
1. Create a VM under a VMware hypervisor with nested virtualization turned on
2. Create a qemu disk image
3. Use guestfish to modify the image

Actual results:
with LIBGUESTFS_DEBUG=1, it produces the following error:

qemu-system-x86_64: error: failed to set MSR 0x38d to 0x0
qemu-system-x86_64: /builddir/build/BUILD/qemu-2.11.2/target/i386/kvm.c:1807: kvm_put_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.


Expected results:
The operation would complete as expected.

Additional info:
I worked around the bug in https://github.com/coreos/coreos-assembler/pull/199 by changing the `cpu` flag from `-cpu host` to `-cpu host,pmu=off`. In the discussion, we decided at least for our use-case, an unconditional application of this setting should meet our needs. I'm not sure if there's places where guestfish would need `pmu=on`, so maybe this could just be the default setting for all applications.

Comment 1 Richard W.M. Jones 2018-11-09 15:58:54 UTC
Yup fairly much a known bug in either VMware or QEMU:
https://bugs.launchpad.net/qemu/+bug/1661386

To work around it do:

 export LIBGUESTFS_BACKEND_SETTINGS=force_tcg

(http://libguestfs.org/guestfs.3.html#force_tcg)

Comment 2 Pino Toscano 2019-09-25 13:38:54 UTC
Old bug in QEMU, should be solved with newer versions of it.