RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1540817 - Libvirt should ignore the cachetune element which have invalid vcpus
Summary: Libvirt should ignore the cachetune element which have invalid vcpus
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.5
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Luyao Huang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-01 05:22 UTC by Luyao Huang
Modified: 2018-04-10 11:06 UTC (History)
7 users (show)

Fixed In Version: libvirt-3.9.0-12.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 11:06:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 0 None None None 2018-04-10 11:06:18 UTC

Description Luyao Huang 2018-02-01 05:22:09 UTC
Description of problem:
Libvirt should forbid start a guest with invalid vcpus in the cachetune

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

How reproducible:
100%

Steps to Reproduce:
1. edit guest and set a cachetune element which vcpus > maxvcpus:

  <vcpu placement='static' cpuset='0-2' current='2'>4</vcpu>
  <cputune>
    <cachetune vcpus='0'>
      <cache id='0' level='3' type='code' size='1' unit='MiB'/>
      <cache id='0' level='3' type='data' size='2' unit='MiB'/>
    </cachetune>
    <cachetune vcpus='1'>
      <cache id='0' level='3' type='code' size='2' unit='MiB'/>
      <cache id='0' level='3' type='data' size='1' unit='MiB'/>
    </cachetune>
    <cachetune vcpus='3'>
      <cache id='0' level='3' type='code' size='1' unit='MiB'/>
      <cache id='0' level='3' type='data' size='1' unit='MiB'/>
    </cachetune>
    <cachetune vcpus='1000'>
      <cache id='0' level='3' type='data' size='1' unit='MiB'/>
    </cachetune>
  </cputune>

2. start guest

3. check the resctrl dir, libvirt create a dir for vcpus 1000

# ll /sys/fs/resctrl/
total 0
-rw-r--r--. 1 root root 0 Jan 29 03:44 cpus
-rw-r--r--. 1 root root 0 Jan 29 03:44 cpus_list
dr-xr-xr-x. 5 root root 0 Jan 31 21:29 info
dr-xr-xr-x. 3 root root 0 Jan 31 21:29 mon_data
dr-xr-xr-x. 2 root root 0 Jan 31 21:29 mon_groups
drwxr-xr-x. 4 root root 0 Feb  1 00:18 qemu-3-vm1-vcpus_0
drwxr-xr-x. 4 root root 0 Feb  1 00:18 qemu-3-vm1-vcpus_1
drwxr-xr-x. 4 root root 0 Feb  1 00:18 qemu-3-vm1-vcpus_1000
drwxr-xr-x. 4 root root 0 Feb  1 00:18 qemu-3-vm1-vcpus_3
-rw-r--r--. 1 root root 0 Jan 31 21:28 schemata
-rw-r--r--. 1 root root 0 Jan 29 03:44 tasks

Actual results:
Libvirt allow start a guest with cachtune point to invalid vcpu

Expected results:
report error when start a guest (or forbid this when define/edit guest )

Additional info:

Comment 1 Martin Kletzander 2018-02-01 08:05:22 UTC
It should not be forbidden, but that definitions should just be removed from the XML cleanly.  The same way it is done with `vcpupin` and other tuning options.  The reasoning behind that is that if you have various tunings for a vcpu and you then remove that vcpu (lower the number of them for example) it will take care of removing relevant parts for you.  I'll look into this, thanks for such a quick testing.

Comment 2 Luyao Huang 2018-02-01 08:21:59 UTC
(In reply to Martin Kletzander from comment #1)
> It should not be forbidden, but that definitions should just be removed from
> the XML cleanly.  The same way it is done with `vcpupin` and other tuning
> options.  The reasoning behind that is that if you have various tunings for
> a vcpu and you then remove that vcpu (lower the number of them for example)

Make sense, i will change the bug's description to this, and also thanks for your clearly explanation.

> it will take care of removing relevant parts for you.  I'll look into this,
> thanks for such a quick testing.

You are welcome, that is my duty ;)

Comment 3 Martin Kletzander 2018-02-02 07:26:54 UTC
Patches posted upstream:

https://www.redhat.com/archives/libvir-list/2018-February/msg00088.html

Comment 6 Luyao Huang 2018-02-05 08:44:01 UTC
Verify this bug with libvirt-3.9.0-11.el7.x86_64:

1. try to add a cachetune which have a vcpus number >= maxvcpus:

# virsh edit vm1

  <vcpu placement='static' cpuset='0-2' current='2'>4</vcpu>
  <cputune>
    <cachetune vcpus='0'>
      <cache id='0' level='3' type='both' size='1' unit='MiB'/>
      <cache id='1' level='3' type='both' size='2' unit='MiB'/>
    </cachetune>
    <cachetune vcpus='1'>
      <cache id='0' level='3' type='both' size='2' unit='MiB'/>
      <cache id='1' level='3' type='both' size='1' unit='MiB'/>
    </cachetune>
    <cachetune vcpus='3'>
      <cache id='0' level='3' type='both' size='1' unit='MiB'/>
      <cache id='1' level='3' type='both' size='1' unit='MiB'/>
    </cachetune>
    <cachetune vcpus='4'>
      <cache id='0' level='3' type='both' size='1' unit='MiB'/>
      <cache id='1' level='3' type='both' size='1' unit='MiB'/>
    </cachetune>
    <cachetune vcpus='1000'>
      <cache id='0' level='3' type='both' size='1' unit='MiB'/>
      <cache id='1' level='3' type='both' size='1' unit='MiB'/>
    </cachetune>
  </cputune>


2. recheck xml and libvirt drop the invalid config:

# virsh dumpxml vm1
<domain type='kvm'>
  <name>vm1</name>
  <uuid>f98741e7-ddad-4be1-82c0-0ae3655d1c25</uuid>
  <memory unit='KiB'>1024000</memory>
  <currentMemory unit='KiB'>1024000</currentMemory>
  <vcpu placement='static' cpuset='0-2' current='2'>4</vcpu>
  <cputune>
    <cachetune vcpus='0'>
      <cache id='0' level='3' type='both' size='1' unit='MiB'/>
      <cache id='1' level='3' type='both' size='2' unit='MiB'/>
    </cachetune>
    <cachetune vcpus='1'>
      <cache id='0' level='3' type='both' size='2' unit='MiB'/>
      <cache id='1' level='3' type='both' size='1' unit='MiB'/>
    </cachetune>
    <cachetune vcpus='3'>
      <cache id='0' level='3' type='both' size='1' unit='MiB'/>
      <cache id='1' level='3' type='both' size='1' unit='MiB'/>
    </cachetune>
  </cputune>

Comment 8 Luyao Huang 2018-02-08 02:00:49 UTC
Retest with the same steps in comment 6 on libvirt-3.9.0-12.el7.x86_64, get the same result. Move this bug to verified.

Comment 12 errata-xmlrpc 2018-04-10 11:06:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0704


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