Refactoring GetSlaveCandidates and relevant validators and helpers.

Added master device name as a parameter to make the function more
explicit.
Adopted testsuite.