[pve-devel] [PATCH-SERIES v2 qemu-server] Cleanup migration code and improve migration disk cleanup

Fabian Ebner f.ebner at proxmox.com
Fri Jan 29 16:11:30 CET 2021

This series intends to make the migration code more readable by
simplyfing/unifying how we keep track of local volumes and splitting up
sync_disks into multiple subroutines.

This is done by keeping more information within the hash of local_volumes we
obtain in the very beginning and re-using it later. Also a method to filter by
migration/replication type is introduced, making it possible to get rid of some
special-case handling when iterating over local volumes.

Still more should be possible, but the series is getting big, so I stopped here.
Namely, $self->{local_volumes}, $self->{volume_map} and $self->{target_drive}
still have some overlap and it might be possible to merge them somehow.

Also it might make sense to put abstract more things to the common code, one
example is to make target storage mapping available for containers too.

Changes from v1:
    * dropped already applied patches
    * rebased
    * prefix commit messages with 'migration' (and 'test')
    * increased test coverage a little, see patch #1 and patch #13
    * reordered patches #8+#9 to avoid temporary breakage, see
      patches #8 and patch #13 (added test-case) for the details
    * add patch to fix bandwidth limit calculation
    * add patch to split out run_replication from scan_local_volumes
    * add patch to improve error handling when block job finishing fails

Fabian Ebner (13):
  test: migration: add parse_volume_id calls
  migration: split sync_disks into two functions
  migration: avoid re-scanning all volumes
  migration: split out config_update_local_disksizes from
  migration: fix calculation of bandwith limit for non-disk migration
  migration: save targetstorage and bwlimit in local_volumes hash and
    re-use information
  migration: add nbd migrated volumes to volume_map earlier
  migration: simplify removal of local volumes and get rid of
  migration: cleanup_remotedisks: simplify and include more disks
  migration: use storage_migration for checks instead of
  migration: keep track of replicated volumes via local_volumes
  migration: split out replication from scan_local_volumes
  migration: move finishing block jobs to phase2 for better/uniform
    error handling

 PVE/QemuMigrate.pm                    | 401 ++++++++++++++------------
 PVE/QemuServer.pm                     |   2 +
 test/MigrationTest/QemuMigrateMock.pm |   9 +
 test/MigrationTest/QmMock.pm          |   2 +
 test/MigrationTest/Shared.pm          |   4 +
 test/run_qemu_migrate_tests.pl        |  40 ++-
 6 files changed, 267 insertions(+), 191 deletions(-)


More information about the pve-devel mailing list