We propose a general model for resources allocation of virtual machines in multi-tier distributed environments. Our model describes each virtual machine and each physical host by a multi-dimensional resource vector, allowing the coexistence of both quantitative and qualitative resources, also handling different SLAs. As this model is a generalization of the classical 0/1 Knapsack Problem, we have also developed an heuristic to obtain very near optimum solutions in a timely manner.