[libvirt] [PATCH] docs: formatdomain: Specify the default value of 'check' attribute

Kashyap Chamarthy kchamart at redhat.com
Tue Jan 9 18:44:18 UTC 2018

On Tue, Jan 09, 2018 at 04:37:10PM +0100, Jiri Denemark wrote:
> On Tue, Jan 09, 2018 at 15:32:54 +0100, Kashyap Chamarthy wrote:


> > But doesn't tell *what* the default value is.  It is check='partial'.
> > Mention it so.


> As I said on IRC, the default differs with guest architecture ('partial'
> for x86_64, 'none' for all others). 

Yep, I missed to distinguish that detail.

> Moreover this only applies to QEMU driver. Oh and it even changes
> based on the mode attribute to make not make it easy. But this is
> really an implementation detail. Libvirt will just use a suitable
> default to stay compatible with older releases.

That's all good.  If you think nothing needs to be clarified here,
that's OK.  (Some admins who operate a lot of VMs with libvirt will
disagree with you, though.)
And as we saw on IRC, `virt-install` muddies the water in this case by
gratuitously adding a CPU parameter with check='full' (even if a user
didn't explicitly specify it) when you simply import an image and look
at the run-time guest XML:

    $> virt-install --name vm1 --ram 2048 \
        --disk path=./vm1.qcow2,format=qcow2 --nographics \
        --import --os-variant fedora27
    $> virsh dumpxml vm1 | grep check
    <cpu mode='custom' match='exact' check='full'>

(You might, fairly, argue here that: "Well, that's a bug in
`virt-install`, go complain there.")

It all comes across as messy to an unsuspecting admin.  (If a competent
admin finds it confusing, good luck to new admins who want to wrap their
head around this.)

    - - -

Background for others reading: The admin who reported this was confused
when he was creating guests with `virt-install`, which adds check='full'
(as noted earlier), and the guest throws:

    error: Failed to start domain foo.org
    error: operation failed: guest CPU doesn't match specification: extra features: vme,arat

So "somehow" QEMU added the CPU features 'vme' and 'arat' by itself, now
you have to specify them in libvirt.  So the admin ended up with a `sed`
one-liner that updates the guest XML with the missing features:

    sed -i -e "s-</cpu>-<feature policy='require' name='vme'/></cpu>-"
    sed -i -e "s-</cpu>-<feature policy='require' name='arat'/></cpu>-"

Versions: libvirt 3.2 and QEMU 2.9

More information about the libvir-list mailing list