mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
migration: add migration_guest_ram_loading() helper
Operations that read guest RAM (dump-guest-memory, memsave, pmemsave) must refuse to run while the destination of a migration is still receiving that RAM: during precopy it is incomplete, and during postcopy a read faults the page in from the source. Provide a single predicate they can share instead of open-coding the runstate and postcopy checks. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20260619101834.228432-2-den@openvz.org>
This commit is contained in:
committed by
Marc-André Lureau
parent
30e8a06b64
commit
c2719f2514
@@ -117,6 +117,9 @@ void migration_file_set_error(int ret, Error *err);
|
||||
/* True if incoming migration entered POSTCOPY_INCOMING_DISCARD */
|
||||
bool migration_in_incoming_postcopy(void);
|
||||
|
||||
/* True while the destination still receives guest RAM (precopy or postcopy) */
|
||||
bool migration_guest_ram_loading(void);
|
||||
|
||||
/* True if incoming migration entered POSTCOPY_INCOMING_ADVISE */
|
||||
bool migration_incoming_postcopy_advised(void);
|
||||
|
||||
|
||||
@@ -1643,6 +1643,12 @@ bool migration_in_incoming_postcopy(void)
|
||||
return ps >= POSTCOPY_INCOMING_DISCARD && ps < POSTCOPY_INCOMING_END;
|
||||
}
|
||||
|
||||
bool migration_guest_ram_loading(void)
|
||||
{
|
||||
return runstate_check(RUN_STATE_INMIGRATE) ||
|
||||
migration_in_incoming_postcopy();
|
||||
}
|
||||
|
||||
bool migration_incoming_postcopy_advised(void)
|
||||
{
|
||||
PostcopyState ps = postcopy_state_get();
|
||||
|
||||
Reference in New Issue
Block a user