QEMU virtual CPUs can assume a halted state, which - depending on
the architecture - can indicate whether a CPU is in use by the
guest operating system.

A new VCPU state halted is introduced in preparation of the
support in the QEMU driver (and optionally others where deemed

Signed-off-by: Viktor Mihajlovski <mihaj...@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bw...@linux.vnet.ibm.com>
Signed-off-by: Boris Fiuczynski <fiu...@linux.vnet.ibm.com>
V3 Changes:
- textual representation of halted state changed to 'running (halted)'
- virsh help/man page updated with description of VCPU states and scope

 include/libvirt/libvirt-domain.h |  1 +
 tools/virsh-domain.c             |  3 ++-
 tools/virsh.pod                  | 57 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 2342820..1172e16 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1682,6 +1682,7 @@ typedef enum {
     VIR_VCPU_OFFLINE    = 0,    /* the virtual CPU is offline */
     VIR_VCPU_RUNNING    = 1,    /* the virtual CPU is running */
     VIR_VCPU_BLOCKED    = 2,    /* the virtual CPU is blocked on resource */
+    VIR_VCPU_HALTED     = 3,    /* the virtual CPU is halted */
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index b19f499..6aaf0bb 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -181,7 +181,8 @@ VIR_ENUM_IMPL(virshDomainVcpuState,
-              N_("blocked"))
+              N_("blocked"),
+              N_("running (halted)"))
 static const char *
 virshDomainVcpuStateToString(int state)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index f38aacf..6284e47 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2529,6 +2529,63 @@ vCPUs, the running time, the affinity to physical 
 With I<--pretty>, cpu affinities are shown as ranges.
+An example output is
+ $ virsh vcpuinfo fedora
+ VCPU:           0
+ CPU:            0
+ State:          running
+ CPU time:       7,0s
+ CPU Affinity:   yyyy
+ VCPU:           1
+ CPU:            1
+ State:          running (halted)
+ CPU time:       0,7s
+ CPU Affinity:   yyyy
+The State field displays the current operating state of a virtual CPU
+=over 4
+=item B<offline>
+The virtual CPU is offline and not usable by the domain.
+This state is not supported by all hypervisors.
+=item B<running>
+The virtual CPU is available to the domain and is operating.
+=item B<blocked>
+The virtual CPU is available to the domain but is waiting for a resource.
+This state is not supported by all hypervisors, in which case I<running>
+may be reported instead.
+=item B<running (halted)>
+The virtual CPU is available to the domain but is currently halted.
+The meaning of halted depends on the CPU architecture. E.g., on i386
+this would mean that the CPU is idle, whereas on s390 this designates
+a disabled wait state. This state is not supported by all hypervisors,
+in which case I<running> may be reported instead.
+=item B<no state>
+The virtual CPU state could not be determined. This could happen if
+the hypervisor is newer than virsh.
+=item B<N/A>
+There's no information about the virtual CPU state available. This can
+be the case if the domain is not running or the hypervisor does
+not report the virtual CPU state.
 =item B<vcpupin> I<domain> [I<vcpu>] [I<cpulist>] [[I<--live>]
 [I<--config>] | [I<--current>]]

libvir-list mailing list

Reply via email to