Bug 1251962

Summary: kvm-setup.service should include Before=libvirtd.service
Product: Red Hat Enterprise Linux 7 Reporter: Andrea Bolognani <abologna>
Component: qemu-kvm-rhevAssignee: Laurent Vivier <lvivier>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.2CC: knoel, lvivier, michen, mrezanin, ngu, qzhang, shuyu, virt-maint, xuhan, zhengtli
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.3.0-18.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-04 16:53:46 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 Andrea Bolognani 2015-08-10 12:13:00 UTC
Description of problem:

  libvirtd reads some information about the system at startup only;
  this include the CPU topology.

  If the configuration is changed after that moment, the information
  reported will be incomplete or inaccurate.


Version-Release number of selected component (if applicable):

  qemu-kvm-rhev-2.3.0-16.el7.ppc64le


How reproducible:

  Always.


Steps to Reproduce:

  1. Boot the system
  2. Run 'virsh capabilities' as root


Actual results:

  The output contains partial information for the secondary threads, eg.

    <cpus num='40'>
      <cpu id='80' socket_id='16' core_id='2088' siblings='80'/>
      <cpu id='81'/>
      <cpu id='82'/>
      <cpu id='83'/>
      <cpu id='84'/>
      <cpu id='85'/>
      <cpu id='86'/>
      <cpu id='87'/>
      <cpu id='88' socket_id='16' core_id='2096' siblings='88'/>
      <cpu id='89'/>
      <cpu id='90'/>
      <cpu id='91'/>
      <cpu id='92'/>
      <cpu id='93'/>
      <cpu id='94'/>
      <cpu id='95'/>
      <cpu id='96' socket_id='16' core_id='2144' siblings='96'/>
      <cpu id='97'/>
      <cpu id='98'/>
      <cpu id='99'/>
      <cpu id='100'/>
      <cpu id='101'/>
      <cpu id='102'/>
      <cpu id='103'/>
      <cpu id='104' socket_id='16' core_id='2152' siblings='104'/>
      <cpu id='105'/>
      <cpu id='106'/>
      <cpu id='107'/>
      <cpu id='108'/>
      <cpu id='109'/>
      <cpu id='110'/>
      <cpu id='111'/>
      <cpu id='112' socket_id='16' core_id='2160' siblings='112'/>
      <cpu id='113'/>
      <cpu id='114'/>
      <cpu id='115'/>
      <cpu id='116'/>
      <cpu id='117'/>
      <cpu id='118'/>
      <cpu id='119'/>
    </cpus>


Expected results:

  The output only contains information about the primary threads, eg.

    <cpus num='5'>
      <cpu id='80' socket_id='16' core_id='2088' siblings='80'/>
      <cpu id='88' socket_id='16' core_id='2096' siblings='88'/>
      <cpu id='96' socket_id='16' core_id='2144' siblings='96'/>
      <cpu id='104' socket_id='16' core_id='2152' siblings='104'/>
      <cpu id='112' socket_id='16' core_id='2160' siblings='112'/>
    </cpus>


Additional info:

  I have added the required information as an override:

    $ sudo systemctl cat kvm-setup.service
    # /usr/lib/systemd/system/kvm-setup.service
    [Unit]
    Description=Perform system configuration to prepare system to run KVM guests
    # Offlining CPUs can cause irqbalance to throw warnings if it's running
    Before=irqbalance.service

    [Service]
    Type=oneshot
    EnvironmentFile=-/etc/sysconfig/kvm
    ExecStart=/usr/lib/systemd/kvm-setup
    [Install]
    WantedBy=multi-user.target

    # /etc/systemd/system/kvm-setup.service.d/override.conf
    [Unit]
    Before=libvirtd.service

  and this change is enough to fix the issue.

  The additional Before= entry should be added to kvm-setup.service so
  that the sysadmin won't have to perform these steps manually.

Comment 2 Miroslav Rezanina 2015-08-14 16:22:40 UTC
Fix included in qemu-kvm-rhev-2.3.0-18.el7

Comment 4 Shuang Yu 2015-08-25 02:53:10 UTC
Reproduce this issue with "qemu-kvm-rhev-2.3.0-16.el7.ppc64le"

Steps:

1.Boot the system

2.[root@ibm-p8-rhevm-11 ~]# virsh capabilities

3.[root@ibm-p8-rhevm-11 ~]#systemctl cat kvm-setup.service

Actual result:

After step2:
[root@ibm-p8-rhevm-11 ~]# virsh capabilities

<cpus num='40'>
            <cpu id='120' socket_id='17' core_id='2208' siblings='120'/>
            <cpu id='121'/>
            <cpu id='122'/>
            <cpu id='123'/>
            <cpu id='124'/>
            <cpu id='125'/>
            <cpu id='126'/>
            <cpu id='127'/>
            <cpu id='128' socket_id='17' core_id='2216' siblings='128'/>
            <cpu id='129'/>
            <cpu id='130'/>
            <cpu id='131'/>
            <cpu id='132'/>
            <cpu id='133'/>
            <cpu id='134'/>
            <cpu id='135'/>
            <cpu id='136' socket_id='17' core_id='2224' siblings='136'/>
            <cpu id='137'/>
            <cpu id='138'/>
            <cpu id='139'/>
            <cpu id='140'/>
            <cpu id='141'/>
            <cpu id='142'/>
            <cpu id='143'/>
            <cpu id='144' socket_id='17' core_id='2272' siblings='144'/>
            <cpu id='145'/>
            <cpu id='146'/>
            <cpu id='147'/>
            <cpu id='148'/>
            <cpu id='149'/>
            <cpu id='150'/>
            <cpu id='151'/>
            <cpu id='152' socket_id='17' core_id='2288' siblings='152'/>
            <cpu id='153'/>
            <cpu id='154'/>
            <cpu id='155'/>
            <cpu id='156'/>
            <cpu id='157'/>
            <cpu id='158'/>
            <cpu id='159'/>
          </cpus>

After step3:
[root@ibm-p8-rhevm-11 ~]#systemctl cat kvm-setup.service
# /usr/lib/systemd/system/kvm-setup.service
[Unit]
Description=Perform system configuration to prepare system to run KVM guests
# Offlining CPUs can cause irqbalance to throw warnings if it's running
Before=irqbalance.service

[Service]
Type=oneshot
EnvironmentFile=-/etc/sysconfig/kvm
ExecStart=/usr/lib/systemd/kvm-setup

[Install]
WantedBy=multi-user.target

Comment 5 Shuang Yu 2015-08-25 02:55:26 UTC
Verify this bug with "qemu-kvm-rhev-2.3.0-18.el7.ppc64le"

Steps:

1.Boot the system

2.[root@ibm-p8-rhevm-11 ~]# virsh capabilities

3.[root@ibm-p8-rhevm-11 ~]#systemctl cat kvm-setup.service

Actual result:

After step2:
[root@ibm-p8-rhevm-11 ~]# virsh capabilities
<cpus num='5'>
            <cpu id='80' socket_id='16' core_id='2080' siblings='80'/>
            <cpu id='88' socket_id='16' core_id='2096' siblings='88'/>
            <cpu id='96' socket_id='16' core_id='2144' siblings='96'/>
            <cpu id='104' socket_id='16' core_id='2152' siblings='104'/>
            <cpu id='112' socket_id='16' core_id='2160' siblings='112'/>
          </cpus>

After step3:
[root@ibm-p8-rhevm-11 ~]#systemctl cat kvm-setup.service
# /usr/lib/systemd/system/kvm-setup.service
[Unit]
Description=Perform system configuration to prepare system to run KVM guests
# Offlining CPUs can cause irqbalance to throw warnings if it's running
Before=irqbalance.service
# libvirtd reads CPU topology at startup, so change it before
Before=libvirtd.service

[Service]
Type=oneshot
EnvironmentFile=-/etc/sysconfig/kvm
ExecStart=/usr/lib/systemd/kvm-setup

[Install]
WantedBy=multi-user.target

Comment 6 Qunfang Zhang 2015-08-25 08:12:29 UTC
Setting to VERIFIED according to comment 4 and comment 5.

Comment 8 errata-xmlrpc 2015-12-04 16:53:46 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://rhn.redhat.com/errata/RHBA-2015-2546.html