Bug 1460086 - No basic check for the cpu flag name for tcg or cpu mode is host-passthrough guest
No basic check for the cpu flag name for tcg or cpu mode is host-passthrough ...
Status: ON_QA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.4
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Jiri Denemark
Luyao Huang
:
Depends On:
Blocks: libvirtCPUconfig
  Show dependency treegraph
 
Reported: 2017-06-08 23:28 EDT by Luyao Huang
Modified: 2017-10-10 04:07 EDT (History)
4 users (show)

See Also:
Fixed In Version: libvirt-3.8.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Luyao Huang 2017-06-08 23:28:06 EDT
Description of problem:
No basic check for the cpu flag name for tcg or cpu mode is host-passthrough  guest

Version-Release number of selected component (if applicable):
libvirt-3.2.0-9.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. tcg guest + invalid cpu flag name + check is full:

# virsh dumpxml r7
<domain type='qemu'>
...
  <cpu mode='host-model' check='full'>
    <model fallback='allow'/>
    <topology sockets='2' cores='4' threads='1'/>
    <feature policy='require' name='notexisted'/>


# virsh start r7
error: Failed to start domain r7
error: internal error: qemu unexpectedly closed the monitor: 2017-06-09T03:06:46.251886Z qemu-kvm: -chardev pty,id=charserial0: char device redirected to /dev/pts/1 (label charserial0)
2017-06-09T03:06:46.252285Z qemu-kvm: -chardev pty,id=charredir0: char device redirected to /dev/pts/2 (label charredir0)
2017-06-09T03:06:46.267520Z qemu-kvm: can't apply global Opteron_G4-x86_64-cpu.notexisted=on: Property '.notexisted' not found


2. kvm guest + host-passthrough :

  <cpu mode='host-passthrough' check='full'>
    <topology sockets='2' cores='4' threads='1'/>
    <feature policy='require' name='notexisted'/>
    <numa>
      <cell id='0' cpus='0-3' memory='512000' unit='KiB'/>
      <cell id='1' cpus='4-7' memory='512000' unit='KiB'/>
    </numa>
  </cpu>

# virsh start r7
error: Failed to start domain r7
error: internal error: qemu unexpectedly closed the monitor: 2017-06-09T03:11:13.455183Z qemu-kvm: -chardev pty,id=charserial0: char device redirected to /dev/pts/1 (label charserial0)
2017-06-09T03:11:13.455562Z qemu-kvm: -chardev pty,id=charredir0: char device redirected to /dev/pts/2 (label charredir0)
2017-06-09T03:11:13.468983Z qemu-kvm: can't apply global host-x86_64-cpu.notexisted=on: Property '.notexisted' not found

3.

Actual results:

Libvirt could still validate that the XML uses valid feature names from our cpu_map.xml.

Expected results:

libvirt catch these invalid flags and report error earlier 

Additional info:
Comment 1 Laszlo Ersek 2017-06-09 14:07:32 EDT
To anyone that lands here due to following the RHBZ URL in upstream libvirt commit 3596b1ddf912 ("qemu: report an error if usb keyboards are unsupported", 2017-06-09):

You are looking for bug 1460008 instead.
Comment 2 Jiri Denemark 2017-09-14 10:23:46 EDT
Patches sent upstream for review: https://www.redhat.com/archives/libvir-list/2017-September/msg00410.html
Comment 3 Jiri Denemark 2017-09-18 06:29:21 EDT
Fixed upstream by:

commit 6ef9c202f2a158fa5e7ad6b2a7da853da55ac395
Refs: v3.7.0-91-g6ef9c202f2
Author:     Jiri Denemark <jdenemar@redhat.com>
AuthorDate: Thu Sep 14 16:04:13 2017 +0200
Commit:     Jiri Denemark <jdenemar@redhat.com>
CommitDate: Mon Sep 18 10:40:12 2017 +0200

    cpu: Introduce virCPUValidateFeatures

    This new API may be used to check whether all features used in a CPU
    definition are valid (e.g., libvirt knows their name, their policy is
    supported, etc.). Leaving this API unimplemented in an arch subdriver
    means libvirt does not restrict CPU features usable on the associated
    architectures.

    Signed-off-by: Jiri Denemark <jdenemar@redhat.com>

commit 3f0193f7e5cc3fade291d5579354846dfba00972
Refs: v3.7.0-92-g3f0193f7e5
Author:     Jiri Denemark <jdenemar@redhat.com>
AuthorDate: Thu Sep 14 16:07:59 2017 +0200
Commit:     Jiri Denemark <jdenemar@redhat.com>
CommitDate: Mon Sep 18 10:40:12 2017 +0200

    qemu: Validate guest CPU features before starting a domain

    Signed-off-by: Jiri Denemark <jdenemar@redhat.com>

commit 20edbad7769df6bb23e1132aee186090db5e8856
Refs: v3.7.0-93-g20edbad776
Author:     Jiri Denemark <jdenemar@redhat.com>
AuthorDate: Thu Sep 14 16:09:35 2017 +0200
Commit:     Jiri Denemark <jdenemar@redhat.com>
CommitDate: Mon Sep 18 10:40:12 2017 +0200

    cpu_s390: Implement virCPUValidateFeatures

    Only feature policy is checked on s390, which was previously done in
    virCPUUpdate, but that's not the correct place for the check once we
    have virCPUValidateFeatures.

    Signed-off-by: Jiri Denemark <jdenemar@redhat.com>

commit ea9741f6009c4654ed865314dfb1fce3eec5adb1
Refs: v3.7.0-94-gea9741f600
Author:     Jiri Denemark <jdenemar@redhat.com>
AuthorDate: Thu Sep 14 16:14:40 2017 +0200
Commit:     Jiri Denemark <jdenemar@redhat.com>
CommitDate: Mon Sep 18 10:40:12 2017 +0200

    cpu_x86: Implement virCPUValidateFeatures

    The function checks whether all CPU features used in a CPU definition
    are specified in cpu_map.xml.

    https://bugzilla.redhat.com/show_bug.cgi?id=1460086

    Signed-off-by: Jiri Denemark <jdenemar@redhat.com>

Note You need to log in before you can comment on or make changes to this bug.