Middleware For A Clever Use Of Virtual Resources In Federated Clouds