Dynamic primary-backup swap