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

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Tue Sep 20 08:10:57 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.

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           | 69 ++++++++++++++++++++++++++++++++++++++++
 src/qemu/qemu_domain.h           |  5 +++
 src/qemu/qemu_driver.c           | 23 ++++++++++++--
 src/qemu/qemu_monitor.c          |  6 +++-
 src/qemu/qemu_monitor.h          |  5 +++
 src/qemu/qemu_monitor_json.c     |  3 ++
 src/qemu/qemu_monitor_text.c     |  8 ++++-
 tests/qemumonitorjsontest.c      |  8 ++---
 tools/virsh-domain.c             |  3 +-
 10 files changed, 122 insertions(+), 9 deletions(-)

-- 
1.9.1




More information about the libvir-list mailing list