Quasi-hitless software-defined defragmentation in space division multiplexing (SDM)