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. Patch #1 fixes a check when updating the re-scanned sizes (has been sent before already, but is needed for this series). Patches #2-#5 split up sync_disks into 3 pieces and improve the before-mentioned rescanning. Patch #6 for determining bwlimit earlier/less often Patches #7-#11 improve both removal of local and remote disks made possible by using the volume filtering. There's still more that can be done, first thing that comes to mind is splitting out the replication from sync_disks and further simplyfing sync_disks; there's still a few loops doing similar things in there. Also $self->{local_volumes}, $self->{volume_map} and $self->{target_drive} still have some overlap and it might be possible to merge them somehow. But before thinking too much about those things I wanted to get some feedback for this and ask if this is the right direction to go in. Fabian Ebner (11): sync_disks: fix check update_disksize: make interface leaner Split sync_disks into two functions Avoid re-scanning all volumes Split out config_update_local_disksizes from scan_local_volumes Save targetstorage and bwlimit in local_volumes hash and re-use information Add nbd migrated volumes to volume_map earlier cleanup_remotedisks: simplify and also include those migrated with storage_migrate Simplify removal of local volumes and get rid of self->{volumes} Use storage_migration for checks instead of online_local_volumes Keep track of replicated volumes via local_volumes PVE/QemuMigrate.pm | 289 +++++++++++++++++++++------------------- PVE/QemuServer.pm | 6 +- PVE/QemuServer/Drive.pm | 11 +- 3 files changed, 160 insertions(+), 146 deletions(-) -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel