Bug 1293241

Summary: libvirt should forbid set 0,^0 in cpuset instead of generate a xml which have broken settings
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.2CC: dyuan, mzhan, pkrempa, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.3.2-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:49:51 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 Luyao Huang 2015-12-21 08:03:38 UTC
Description of problem:
libvirt should forbid set 0,^0 in cpuset instead of generate a xml which have broken settings

Version-Release number of selected component (if applicable):
libvirt-1.2.17-13.el7_2.2.x86_64

How reproducible:
100%

Steps to Reproduce:
1.prepare a inactive guest:

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     RHEL71-lhuang                  shut off


2. edit xml and add vcpupin/emulatorpin like this:

  <cputune>
    <vcpupin vcpu='0' cpuset='0,^0'/>
  </cputune>

# virsh edit RHEL71-lhuang
Domain RHEL71-lhuang XML configuration edited.


3. recheck the xml:

# virsh dumpxml RHEL71-lhuang
...
  <cputune>
    <vcpupin vcpu='0' cpuset=''/>
  </cputune>
...

4. restart libvirtd guest will disappear since xml have broken setting:

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

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


Actual results:
when set 0,^0 in cpuset in emulatorpin/vcpupin element, libvirt generate a xml which have broken settings

Expected results:

like iothread, output error:

# virsh edit RHEL71-lhuang
error: unsupported configuration: Invalid value of 'cpuset': 0,^0
Failed. Try again? [y,n,i,f,?]: 


Additional info:

Comment 1 Peter Krempa 2016-01-27 16:31:46 UTC
Fixed upstream:

commit 31b782a147b9b4a9aa758d8eba9fba5b72a6abb1
Author: Peter Krempa <pkrempa>
Date:   Wed Jan 6 15:34:13 2016 +0100

    conf: disallow empty cpusets for vcpu pinning when parsing XML
    
    They are disallowed in the pinning API and as default cpuset.

v1.3.1-66-g7639417

Comment 3 Luyao Huang 2016-06-02 07:34:19 UTC
Verify this bug with libvirt-1.3.4-1.el7.x86_64:

1. prepare a guest:

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     rhel72-test                    shut off

2. add empty cpuset in guest xml

# virsh edit rhel72-test

  <cputune>
    <vcpupin vcpu='0' cpuset='0,^0'/>
  </cputune>

error: unsupported configuration: Invalid value of 'cpuset': 0,^0
Failed. Try again? [y,n,i,f,?]:

Comment 5 errata-xmlrpc 2016-11-03 18:49:51 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/RHSA-2016-2577.html