]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh-domain: Refactor cmdVcpucount and fix output on inactive domains
authorPeter Krempa <pkrempa@redhat.com>
Mon, 15 Apr 2013 09:07:23 +0000 (11:07 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 19 Apr 2013 12:02:10 +0000 (14:02 +0200)
commit642261a866ef43fe0606d995a09cadc2da208f34
tree02b9d57834f04cdf68dfc9873d085502c4047e24
parent88c6159ca763a3cc507e553f849a3bf1b12f73b3
virsh-domain: Refactor cmdVcpucount and fix output on inactive domains

This patch factors out the vCPU count retrieval including fallback means
into vshCPUCountCollect() and removes the duplicated code to retrieve
individual counts.

The --current flag (this flag is assumed by default) now works also with
--maximum or --active without the need to explicitly specify the state
of the domain that is requested.

This patch also fixes the output of "virsh vcpucount domain" on inactive
domains:

Before:
$ virsh vcpucount domain
maximum      config         4
error: Requested operation is not valid: domain is not running
current      config         4
error: Requested operation is not valid: domain is not running

After:
$virsh vcpucount domain
maximum      config         4
current      config         4

.. and for transient domains too:

Before:
$ virsh vcpucount transient-domain
error: Requested operation is not valid: cannot change persistent config of a transient domain
maximum      live           3
error: Requested operation is not valid: cannot change persistent config of a transient domain
current      live           1

After:
$ virsh vcpucount transient-domain
maximum      live           3
current      live           1
tools/virsh-domain.c