mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 06:43:53 -06:00
migration: Drop inactivate_disk param in qemu_savevm_state_complete*
This parameter is only used by one caller, which is the genuine precopy
complete path (migration_completion_precopy).
The parameter was introduced in a1fbe750fd
("migration: Fix race of image
locking between src and dst") to make sure the inactivate will happen
before EOF to make sure dest will always be able to activate the disk
properly. However there's no limitation on how early we inactivate the
disk. For precopy completion path, we can always do that as long as VM is
stopped.
Move the disk inactivate there, then we can remove this inactivate_disk
parameter in the whole call stack, because all the rest users pass in false
always.
Signed-off-by: Peter Xu <peterx@redhat.com>
Tested-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Juraj Marcin <jmarcin@redhat.com>
Link: https://lore.kernel.org/r/20250114230746.3268797-6-peterx@redhat.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
parent
812145fcf7
commit
4822128693
3 changed files with 23 additions and 31 deletions
|
@ -1521,8 +1521,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy)
|
|||
}
|
||||
|
||||
int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
|
||||
bool in_postcopy,
|
||||
bool inactivate_disks)
|
||||
bool in_postcopy)
|
||||
{
|
||||
MigrationState *ms = migrate_get_current();
|
||||
int64_t start_ts_each, end_ts_each;
|
||||
|
@ -1553,20 +1552,6 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
|
|||
end_ts_each - start_ts_each);
|
||||
}
|
||||
|
||||
if (inactivate_disks) {
|
||||
/*
|
||||
* Inactivate before sending QEMU_VM_EOF so that the
|
||||
* bdrv_activate_all() on the other end won't fail.
|
||||
*/
|
||||
if (!migration_block_inactivate()) {
|
||||
error_setg(&local_err, "%s: bdrv_inactivate_all() failed",
|
||||
__func__);
|
||||
migrate_set_error(ms, local_err);
|
||||
error_report_err(local_err);
|
||||
qemu_file_set_error(f, -EFAULT);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!in_postcopy) {
|
||||
/* Postcopy stream will still be going */
|
||||
qemu_put_byte(f, QEMU_VM_EOF);
|
||||
|
@ -1587,8 +1572,7 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only,
|
||||
bool inactivate_disks)
|
||||
int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only)
|
||||
{
|
||||
int ret;
|
||||
Error *local_err = NULL;
|
||||
|
@ -1613,8 +1597,7 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only,
|
|||
goto flush;
|
||||
}
|
||||
|
||||
ret = qemu_savevm_state_complete_precopy_non_iterable(f, in_postcopy,
|
||||
inactivate_disks);
|
||||
ret = qemu_savevm_state_complete_precopy_non_iterable(f, in_postcopy);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
@ -1717,7 +1700,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
|
|||
|
||||
ret = qemu_file_get_error(f);
|
||||
if (ret == 0) {
|
||||
qemu_savevm_state_complete_precopy(f, false, false);
|
||||
qemu_savevm_state_complete_precopy(f, false);
|
||||
ret = qemu_file_get_error(f);
|
||||
}
|
||||
if (ret != 0) {
|
||||
|
@ -1743,7 +1726,7 @@ cleanup:
|
|||
void qemu_savevm_live_state(QEMUFile *f)
|
||||
{
|
||||
/* save QEMU_VM_SECTION_END section */
|
||||
qemu_savevm_state_complete_precopy(f, true, false);
|
||||
qemu_savevm_state_complete_precopy(f, true);
|
||||
qemu_put_byte(f, QEMU_VM_EOF);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue