[libvirt] [PATCH V3 0/4] qemu: report actual vcpu state in virVcpuInfo

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Wed Oct 12 12:06:14 UTC 2016


Currently, the virVcpuInfo returned by virDomainGetVcpus() will always
report a state of VIR_VCPU_RUNNING for each defined domain vcpu even if
the vcpu is currently in the halted state.

As the monitor interface is in fact reporting the accurate state, it is
rather easy to transport this information with the existing API.

This is done by
- adding a new state of VIR_VCPU_HALTED
- extending the monitor to pass back the halted state for the vcpus
- adding a new field to the private domain vcpu object reflecting the
  halted state for the vcpu
- modifying the driver code to report the vcpu state based on the halted
  indicator
- extending virsh vcpuinfo to also display the halted state

The vcpu state is however not recorded in the internal XML format, since
the state can change asynchronously (without notification).

V2 is a rebase on top of Peter Krempa's CPU hotplug modernization.

V3 tries to address the review comments by John and Peter.

I noticed Peter has posted (we had a tendency for mid-air collisions lately)
https://www.redhat.com/archives/libvir-list/2016-October/msg00498.html

I've applied the patches on top of mine and have seen no
issues so far.

Viktor Mihajlovski (4):
  domain: Add new VCPU state "halted"
  qemu: Add monitor support for CPU halted state
  qemu: Add domain support for VCPU halted state
  qemu: Ensure reported VCPU state is current in driver API

 include/libvirt/libvirt-domain.h |  1 +
 src/qemu/qemu_domain.c           | 66 ++++++++++++++++++++++++++++++++++++++++
 src/qemu/qemu_domain.h           |  5 +++
 src/qemu/qemu_driver.c           | 15 +++++++--
 src/qemu/qemu_monitor.c          |  6 +++-
 src/qemu/qemu_monitor.h          |  3 ++
 src/qemu/qemu_monitor_json.c     |  3 ++
 src/qemu/qemu_monitor_text.c     |  8 ++++-
 tests/qemumonitorjsontest.c      |  8 ++---
 tools/virsh-domain.c             |  3 +-
 tools/virsh.pod                  | 57 ++++++++++++++++++++++++++++++++++
 11 files changed, 166 insertions(+), 9 deletions(-)

-- 
1.9.1




More information about the libvir-list mailing list