[libvirt] [PATCH RFC 00/51] refactor block job handling and add support for new event/commands (blockdev-add saga)

Peter Krempa pkrempa at redhat.com
Wed Dec 12 17:08:16 UTC 2018

This series refactors how libvirt stores block job data and handles
block job events in general. This is done in preparation for -blockdev
support where we'll need to add support for the 'blockdev-create' job
which is not associated to any frontend 'disk' in some cases.

This series introduces a new structure and table of blockjobs currently
running and implements handlers for the new even "JOB_STATUS_CHANGE".

RFC status excuses:
- the series needs much more testing than I did
- the last few patches are true RFC
- I didn't port/refactor the rest of the blockjob finishing code that
  I have for the individual job types after the big refactor so there
  aren't any examples for the -blockdev case yet.

I'll post the link to a repo containing the patches some time later.

Peter Krempa (51):
  qemu: blockjob: Extract emitting of libvirt events
  qemu: blockjob: Emit VIR_DOMAIN_EVENT_ID_BLOCK_JOB only for local
  qemu: processBlockJobEvent: Use qemuBlockJobUpdate to process block
    job events
  qemu: blockjob: Unexport qemuBlockJobEventProcess
  qemu: blockjob: Rename public APIs
  qemu: blockjob: Remove header dependency on qemu_domain.h
  qemu: Consolidate disk blockjob variables into a structure
  qemu: process: Consolidate error paths in qemuProcessHandleBlockJob
  qemu: blockjob: Rename qemuBlockJobEventProcess to
  qemu: blockjob: Split out handling of comlpleted jobs
  qemu: migration: Properly note that non-shared-storage migration uses
    a blockjob
  qemu: process: refresh block jobs on reconnect
  qemu: driver: Remove block job status reprobing from
  qemu: migration: Simplify cancellation of migration blockjobs
  qemu: blockjob: Turn struct qemuBlockJobData into a virObject
  qemu: blockjob: Clarify that job 'status' field contains new state
  qemu: migration: Separate startup of disk mirror from migration logic
  qemu: blockjob: Add functions for block job state control
  qemu: blockjob: Drop unnecessary calls to qemuBlockJobSyncEndDisk
  qemu: blockjob: Add reference to disk into struct qemuBlockJobData
  qemu: blockjob: Record job type when starting the job
  qemu: blockjob: Pass in job to qemuBlockJobEventProcessLegacy
  qemu: blockjob: Convert qemuBlockJobSyncBeginDisk to work with the job
  qemu: blockjob: Track current state of blockjob
  qemu: migration: Extract reporting of disk migration error
  qemu: blockjob: Remove error propagation from qemuBlockJobUpdateDisk
  qemu: blockjob: Consume new block job state in the processing function
  qemu: blockjob: Pass job into qemuBlockJobUpdateDisk and rename it
  qemu: Allocate diskPriv->blockjob only when there's a blockjob
  qemu: migration: Don't call qemuBlockJobSyncEndDisk when block job has
  qemu: blockjob: Convert qemuBlockJobSyncEndDisk to take job instead of
  qemu: blockjob: Add job name into the data
  qemu: domain: Add global table of blockjobs
  qemu: blockjob: Register new and running blockjobs in the global table
  qemu: blockjob: Add string convertors for blockjob type and state
  qemu: domain: Store blockjob data in the status XML
  tests: qemustatusxml2xml: Add test case for block job tracking
  qemu: monitor: Add new fields for 'block-stream' command
  qemu: monitor: Add new fields for 'block-commit' command
  qemu: monitor: Add new fields for 'blockdev-mirror' command
  qemu: monitor: Add support for 'job-dismiss' command
  qemu: monitor: Add support for 'job-cancel' command
  qemu: monitor: Add support for 'job-complete' command
  qemu: monitor: Add infrastructure for 'query-jobs'
  qemu: blockjob: Add 'concluded' state for a block job
  qemu: monitor: Implement support for 'JOB_STATUS_CHANGE' event
  qemu: process: Don't trigger BLOCK_JOB* events with -blockdev
  qemu: blockjob: Add helper to convert monitor job status to internal
  qemu: Add handler for job state change event
  qemu: blockjob: Add modern block job event handler
  qemu: process: Refresh -blockdev based blockjobs on reconnect to qemu

 src/qemu/qemu_blockjob.c                      | 687 ++++++++++++++----
 src/qemu/qemu_blockjob.h                      | 111 ++-
 src/qemu/qemu_domain.c                        | 123 +++-
 src/qemu/qemu_domain.h                        |  13 +-
 src/qemu/qemu_driver.c                        | 114 ++-
 src/qemu/qemu_migration.c                     | 233 +++---
 src/qemu/qemu_monitor.c                       | 120 ++-
 src/qemu/qemu_monitor.h                       |  82 ++-
 src/qemu/qemu_monitor_json.c                  | 239 +++++-
 src/qemu/qemu_monitor_json.h                  |  28 +-
 src/qemu/qemu_process.c                       | 179 ++++-
 .../query-jobs-create.json                    |  20 +
 .../query-jobs-create.result                  |  11 +
 .../qemumonitorjsondata/query-jobs-empty.json |   1 +
 .../query-jobs-empty.result                   |   0
 tests/qemumonitorjsontest.c                   | 101 ++-
 .../blockjob-blockdev-in.xml                  | 364 ++++++++++
 .../blockjob-blockdev-out.xml                 |   1 +
 tests/qemuxml2xmltest.c                       |   2 +
 19 files changed, 2097 insertions(+), 332 deletions(-)
 create mode 100644 tests/qemumonitorjsondata/query-jobs-create.json
 create mode 100644 tests/qemumonitorjsondata/query-jobs-create.result
 create mode 100644 tests/qemumonitorjsondata/query-jobs-empty.json
 create mode 100644 tests/qemumonitorjsondata/query-jobs-empty.result
 create mode 100644 tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
 create mode 120000 tests/qemustatusxml2xmldata/blockjob-blockdev-out.xml


More information about the libvir-list mailing list