Skip to content

scsi: persistent reservation live migration

Stefan Hajnoczi qemu-devel 3 versions – Applied

Status from this message: Thanks, applied to my block tree:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 5 repliesApplied
  2. v25 patches 6 repliesSuperseded
  3. v1 RFC4 patches 3 repliesSuperseded

Changes in v3 from the cover letter

- Use warn_report_err() instead of suppressing errors [Daniel Berrangé]
- Wrap lines exceeding 80 characters

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/5scsi: generalize scsi_SG_IO_FROM_DEV() to scsi_SG_IO()hw/scsi/scsi-disk.c hw/scsi/scsi-generic.c include/hw/scsi/scsi.h+14 -120 replies
2/5scsi: add error reporting to scsi_SG_IO()hw/scsi/scsi-disk.c hw/scsi/scsi-generic.c include/hw/scsi/scsi.h+30 -70 replies
3/5scsi: track SCSI reservation state for live migrationhw/scsi/scsi-bus.c hw/scsi/scsi-generic.c hw/scsi/trace-events +2 more+200 -00 replies
4/5scsi: save/load SCSI reservation statehw/core/machine.c hw/scsi/scsi-disk.c hw/scsi/scsi-generic.c +2 more+173 -20 replies
5/5docs: add SCSI migrate-pr documentationdocs/system/device-emulation.rst docs/system/devices/scsi/index.rst docs/system/devices/scsi/migrate-pr.rst+65 -00 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPaolo Bonzini
SeriesR-b R-b
1/5
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/5] scsi: persistent reservation live migration

v3:
- Use warn_report_err() instead of suppressing errors [Daniel Berrangé]
- Wrap lines exceeding 80 characters

v2:
- Add user documentation [Paolo]
- Send PREEMPT on the source if migration fails. This rollback operation ensures the source regains access to the LUN even if migration fails after the destination issues its own PREEMPT.

Live migration does not work for SCSI Persistent Reservations acquired on scsi-block devices. This patch series migrates the reservation key and reservation type so that the destination QEMU can take over the persistent reservation with the PREEMPT service action upon live migration.

The approach involves snooping PERSISTENT RESERVE OUT replies and tracking the scsi-block device's current reservation key and reservation type. In most cases this involves no additional SCSI commands. This approach isn't perfect: if another machine modifies the reservation on the physical LUN, then QEMU's state becomes stale. Persistent reservations are inherently cooperative, so this is acceptable as long as real applications don't run into problems.

I am also working on a test suite called pr-tests that runs sg_persist(8) commands across multiple machines in order to exercise various scenarios:
https://gitlab.com/stefanha/pr-tests

Stefan Hajnoczi (5):
scsi: generalize scsi_SG_IO_FROM_DEV() to scsi_SG_IO()
scsi: add error reporting to scsi_SG_IO()
scsi: track SCSI reservation state for live migration
scsi: save/load SCSI reservation state
docs: add SCSI migrate-pr documentation

 docs/system/device-emulation.rst        |   1 +
 docs/system/devices/scsi/index.rst      |  10 +
 docs/system/devices/scsi/migrate-pr.rst |  54 +++++
 include/hw/scsi/scsi.h                  |  15 +-
 include/scsi/constants.h                |  21 ++
 hw/core/machine.c                       |   4 +-
 hw/scsi/scsi-bus.c                      |   3 +
 hw/scsi/scsi-disk.c                     |  90 +++++++-
 hw/scsi/scsi-generic.c                  | 291 +++++++++++++++++++++++-
 hw/scsi/trace-events                    |   2 +
 10 files changed, 476 insertions(+), 15 deletions(-)
 create mode 100644 docs/system/devices/scsi/index.rst
 create mode 100644 docs/system/devices/scsi/migrate-pr.rst
Signature · 1 line
2.52.0