Bug 1024245

Summary: vcpucount don't check exclusive options.
Product: Red Hat Enterprise Linux 7 Reporter: Hao Liu <hliu>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, codong, dyuan, gsun, hliu, lsu, mzhan, pkrempa
Target Milestone: rc   
Target Release: 7.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.1.1-13.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 09:43:41 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 Hao Liu 2013-10-29 08:25:00 UTC
Description of problem:
vcpucount don't check exclusive options.

Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux Server release 7.0 Beta
libvirt-1.1.1-10.el7.x86_64

How reproducible:
always

Command:
# virsh vcpucount <vm-name> --config --live --current

Result:
2

Expected result:
error: --config, --live, and --current are mutually exclusive.

Comment 2 Peter Krempa 2013-10-30 13:16:28 UTC
The --live and --config flags should be considered mutually exclusive for this virsh command. However the combination of --current with those flags is legal as --current was used in a different meaning before the introduction of the modern meaning thus the meaning of the flags is dual and filtered.

I'll post a patch to forbid --live and --config here.

Comment 3 Peter Krempa 2013-11-11 09:52:49 UTC
Now fixed upstream:

commit bf45db6041c207e78e6a3185ceaf278b09e21561
Author: Peter Krempa <pkrempa>
Date:   Wed Oct 30 13:58:09 2013 +0100

    virsh-domain: Mark --live and --config mutually exclusive in vcpucount
    
    The 'vcpucount' command is a getter command for the vCPUu count. When
    one or more of the filtering flags are specified the command returns the
    value only for the selected combination. In this case the --live and
    --config combination isn't valid. This however didn't cause errors as
    the combination of flags was rejected by the libvirt API but then the
    fallback code kicked in and requested the count in a way where the clash
    of the flags didn't matter.
    
    Mark the flag combination mutually exclusive so that users aren't
    confused.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1024245

Comment 6 chentao 2013-11-26 02:34:09 UTC
Verify this bug with libvirt-1.1.1-13.el7.x86_64,the following was the verify steps.

steps:
1.Start a guest and check the vcpu.
# virsh dumpxml rhel1 | grep vcpu -A 3
  <vcpu placement='static'>2</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>

#virsh vcpucount rhel1 --live --current
2
#virsh vcpucount rhel1 --config --current
2

2.Edited the guest's xml and set the vcpu to 4,then check the vcpu
#virsh vcpucount rhel1 --live --current
2
#virsh vcpucount rhel1 --config --current
4

For libvirt-1.1.1-10.el7.x86_64:
#virsh vcpu rhel1 --config --live --current
2

#virsh vcpu rhel1 --config --live
2

For libvirt-1.1.1-13.el7.x86_64:
#virsh vcpu rhel1 --config --live --current
error: Options --live and --config are mutually exclusive

# virsh vcpucount rhel1 --config --live
error: Options --live and --config are mutually exclusive

Do the upper steps and I can get the error message,so mark this bug verifed.

Comment 7 Ludek Smid 2014-06-13 09:43:41 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.