Set primary controller role before priorities assignment

If nodes were passed as unsorted list
then there was a problem with wrong priorities
assignment, we have to assign primary-controller
role and only after that set priorities.

Change-Id: I35b824d316261ad555aa555ed5e34afb5857dc8d
Closes-bug: #1287656