Creating virtual machines to host affinity rules