Extended get_allocated_nodes() from lib/common

Extended get_allocated_nodes() from lib/common to allow to search only for
nodes with a specific role, if needed