Controlling network bandwidth allocation to vms

Hi all. Is it possible to control the network bandwidth allocation to Virtual Machines ? I want to set up cap on bandwidth alloted to a VM. Would it be possible to modify this cap when VM is running without restarting the VM ?

I guess it’s easiest to set inside the guest OS, especially if we’re talking Linux here… Otherwise Open vSwitch may be able to do the job.