Bug 770939 - virsh vcpucount option --current has some problem
Summary: virsh vcpucount option --current has some problem
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.3
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-30 11:24 UTC by weizhang
Modified: 2012-01-03 18:25 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-01-03 18:25:18 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description weizhang 2011-12-30 11:24:53 UTC
Description of problem:
The vcpucount option {--current --live --config} must be used with {--maximum --active}
virsh vcpucount test --live
error: when using --live, either --maximum or --active must be specified

# virsh vcpucount test --config
error: when using --config, either --maximum or --active must be specified

# virsh vcpucount test --current
error: when using --current, either --maximum or --active must be specified

But for --current --config and --current --live, it will not report error
# virsh vcpucount test --live --current
3

# virsh vcpucount test --config --current
1

It seems that the libvirt consider --current as --active

# virsh vcpucount test
maximum      config         2
maximum      live           4
current      config         1
current      live           3


Version-Release number of selected component (if applicable):
kernel-2.6.32-223.el6.x86_64
libvirt-0.9.9-0rc1.el6.x86_64
qemu-kvm-0.12.1.2-2.213.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. virsh vcpucount test --config --current
2. virsh vcpucount test --live --current
3.
  
Actual results:
no error message


Expected results:
Step 1 and 2 should report error like
error: when using --live, either --maximum or --active must be specified

Additional info:

Comment 2 Eric Blake 2012-01-03 18:25:18 UTC
Closing as not a bug.  The existing behavior is intentional, for backwards compatibility, per this commit in 0.9.4:

commit 4b7a8e9c0da01be1251fe0a92a5eb802e891044f
Author: Eric Blake <eblake>
Date:   Mon Jul 18 16:01:48 2011 -0600

    virsh: make vcpucount use --current consistently
    
    Rename the existing --current flag to the new name --active,
    while adding a new flag --current to expose the new
    VIR_DOMAIN_AFFECT_CURRENT flag of virDomainGetVcpusFlags.
    
    For backwards compability, the output does not change (even
    though the label "current" no longer matches the spelling of
    the option that would trigger that number in isolation), and
    we accept "--current --live" as an undocumented synonym for
    "--active --live" to avoid breaking any existing clients.
    
    * tools/virsh.c (cmdVcpucount): Add --active flag, and rearrange
    existing flag handling to expose VIR_DOMAIN_AFFECT_CURRENT support.
    * tools/virsh.pod (vcpucount): Document this.

I don't think it is worth littering the man page to document the backwards-compatible usage, since we should be encouraging new scripts to only use the new usage; but at the same time, the code must not reject that older usage style, so as not to break existing clients.


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