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

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Thu Jul 14 14:35:37 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
- adding a monitor function 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).

Viktor Mihajlovski (5):
  domain: Add new VCPU state "halted"
  qemu: Add monitor APIs for the detection of halted VCPUs
  tests: Add testcase for qemuMonitorJSONGetCPUState
  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           |  82 ++++++++++++++++++++++++++++++
 src/qemu/qemu_domain.h           |   4 ++
 src/qemu/qemu_driver.c           |  23 ++++++++-
 src/qemu/qemu_monitor.c          |  22 ++++++++
 src/qemu/qemu_monitor.h          |   2 +
 src/qemu/qemu_monitor_json.c     |  52 +++++++++++++++++--
 src/qemu/qemu_monitor_json.h     |   2 +
 src/qemu/qemu_monitor_text.c     |  54 ++++++++++++++++----
 src/qemu/qemu_monitor_text.h     |   2 +
 tests/qemumonitorjsontest.c      | 106 ++++++++++++++++++++++++---------------
 tools/virsh-domain.c             |   3 +-
 12 files changed, 295 insertions(+), 58 deletions(-)

-- 
1.9.1




More information about the libvir-list mailing list