mirror of
https://github.com/qemu/qemu.git
synced 2026-04-05 22:00:58 +00:00
SCSI Persistent Reservations are stateful and external to the guest. In order to transparently move reservations to the destination host during live migration, it is necessary to track the state built up on the source host before migration. Only then can the destination host ensure an equivalent state is restored upon migration. Snoop on successful PERSISTENT RESERVE OUT commands and save the reservation key and reservation type. This will allow registered keys and reservations to be migrated. Also patch PERSISTENT RESERVE IN replies with the REPORT CAPABILITIES service action since features that involve the physical SCSI bus target ports must not be exposed to the guest (it sees a virtual SCSI bus). Usually this plays out as follows: 1. The guest invokes the REGISTER service action to register a reservation key on its I_T nexus. 2. The guest invokes the RESERVE service action to create a reservation using the previously-registered key. This commit implements the snooping and stores the reservation key and type (if any) for each LUN. The snooped PR state and the migrate_pr flag to enable PR migration will be used in later commits. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 20260129212035.219676-4-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>