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 1208434 - guest will disappear when use vcpupin set a non exist cpu then restart libvirtd
Summary: guest will disappear when use vcpupin set a non exist cpu then restart libvirtd
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-02 09:07 UTC by Luyao Huang
Modified: 2015-11-19 06:27 UTC (History)
5 users (show)

Fixed In Version: libvirt-1.2.15-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:27:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2015-04-02 09:07:27 UTC
description of problem:
guest will disappear when use vcpupin set a non exist cpu then restart libvirtd

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

How reproducible:
100%

Steps to Reproduce:
1.prepare a inactive vm:
# virsh dumpxml test3
  <vcpu placement='static' current='5'>10</vcpu>

2.use vcpupin test a non-exist guest cpu:

# virsh vcpupin test3 20 0-3 --config


3.restart libvirtd and check vm:
# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh dumpxml test3
error: failed to get domain 'test3'
error: Domain not found: no domain with matching name 'test3'

Actual results:
guest will disappear when use vcpupin set a non exist cpu then restart libvirtd

Expected results:
forbid set non-exist vcpupin to vm

infomation:

Additional info:

Comment 1 Peter Krempa 2015-04-14 07:39:28 UTC
Following upstream commits fix the issue:

commit 64985217bc57510cb9549200182be3691640e04b
Author: Peter Krempa <pkrempa>
Date:   Tue Apr 7 20:44:15 2015 +0200

    qemu: Fix condition for checking vcpu when pinning vcpus
    
    Previously we checked that the vcpu we are trying to set is in range of
    the number of threads presented by qemu. The problem is that if the VM
    is offline the count is 0. Since the condition subtracted 1 from the
    count the number would overflow and the check would never trigger.
    
    Change the condition for more sensible ones with specific error
    messages.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1208434

commit 3f9fb2b5871cbd252af592cb210bb46fd7f57d23
Author: Peter Krempa <pkrempa>
Date:   Tue Apr 7 20:09:04 2015 +0200

    conf: Refactor virDomainVcpuPinDefParseXML
    
    Refactor the code to parse the vcpupin in a similar way the iothreadpin
    code is now structured. This allows to get rid of some very strange
    conditions and error messages.
    
    Additionally since a existing bug
    ( https://bugzilla.redhat.com/show_bug.cgi?id=1208434 ) allows to add
    vcpupin definitions for vcpus that don't exist, this patch makes the
    parser to ignore all vcpupins that don't have a matching vCPU in the
    definition rather than just offlined ones.

commit 78d1b0f9b35ae7bc1b5569aeaba6a52355a647a9
Author: Peter Krempa <pkrempa>
Date:   Tue Apr 7 19:52:02 2015 +0200

    conf: Error out if iothread id is missing in iothreadpin
    
    Defining a domain with the following config:
    
    <domain ...>
      ...
      <iothreads>1</iothreads>
      <cputune>
        <iothreadpin cpuset='1'/>
    
    will result in the following config formatted back:
    <domain type='kvm'>
      ...
      <iothreads>1</iothreads>
      <cputune>
        <iothreadpin iothread='0' cpuset='1'/>
    
    After restart the VM would vanish. Since our schema requires the
    @iothread field to be present in <iothreadpin> make it required by the
    code too.

commit 0532ec3faa5f22a0aa19e2e1a66460ba9adc1496
Author: Peter Krempa <pkrempa>
Date:   Tue Apr 7 17:44:12 2015 +0200

    conf: Split up virDomainVcpuPinDefParseXML
    
    Extract part that parses iothreads into virDomainIothreadPinDefParseXML

commit 06c03b48bded39faa0d65e0775f2fa82da618865
Author: Peter Krempa <pkrempa>
Date:   Tue Apr 7 17:13:07 2015 +0200

    conf: Split out parsing of emulatorpin
    
    Split up parts of virDomainVcpuPinDefParseXML into
    virDomainEmulatorPinDefParseXML.

v1.2.14-136-g6498521

Comment 3 hongming 2015-07-13 02:45:55 UTC
Verify it as follows.

# rpm -q libvirt qemu-kvm-rhev
libvirt-1.2.17-1.el7.x86_64
qemu-kvm-rhev-2.3.0-8.el7.x86_64

# virsh dumpxml rhel7.0|grep vcpu
  <vcpu placement='static' current='4'>8</vcpu>

# virsh vcpupin rhel7.0 5 4 --config
error: CPU 4 in cpulist '4' exceed the maxcpu 4

# virsh vcpupin rhel7.0 5 3 --config
error: invalid argument: vcpu 5 is out of range of persistent cpu count 4

# virsh vcpupin rhel7.0 5 0- 3 --config
error: unexpected data '3'

# virsh vcpupin rhel7.0 5 0-3 --config
error: invalid argument: vcpu 5 is out of range of persistent cpu count 4

# virsh vcpupin rhel7.0 4 0-3 --config
error: invalid argument: vcpu 4 is out of range of persistent cpu count 4

# virsh vcpupin rhel7.0 3 3 --config

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh start rhel7.0
Domain rhel7.0 started

# virsh vcpuinfo rhel7.0
VCPU:           0
CPU:            2
State:          running
CPU time:       7.2s
CPU Affinity:   yyyy

VCPU:           1
CPU:            0
State:          running
CPU time:       1.3s
CPU Affinity:   yyyy

VCPU:           2
CPU:            1
State:          running
CPU time:       1.5s
CPU Affinity:   yyyy

VCPU:           3
CPU:            3
State:          running
CPU time:       1.3s
CPU Affinity:   ---y

Comment 4 hongming 2015-07-13 03:30:44 UTC
# cat rhel7.1.xml |grep iothread
  <iothreads>1</iothreads>
    <iothreadpin cpuset='1'/>


# virsh define rhel7.1.xml
error: Failed to define domain from rhel7.0.xml
error: XML error: missing iothread id in iothreadpin

Comment 5 hongming 2015-07-13 03:31:27 UTC
The result is expected. Move its status to VERIFIED.

Comment 7 errata-xmlrpc 2015-11-19 06:27:06 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-2202.html


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