InstanceResourceQuota
Instance Resource Quota
How to set Server CPU,disk IO,Bandwidth consumption limit for instances using the new feature of nova. By using cgroup,libvirt can set the per instance CPU time consumption percent. and the instances's read_iops,read_byteps, write_iops,write_byteps.also libvirt support limit the instances in/out bandwidth.
https://blueprints.launchpad.net/nova/+spec/quota-instance-resource
Configure Nova to use these feathers
Config IO limit for the specified instance type
nova-manage flavor set_key --name m1.small --key quota:disk_read_bytes_sec --value 10240000 nova-manage flavor set_key --name m1.small --key quota:disk_write_bytes_sec --value 10240000 or using python-novaclient with admin credentials nova flavor-key m1.small set quota:disk_read_bytes_sec=10240000 nova flavor-key m1.small set quota:disk_write_bytes_sec=10240000
CPU control params :cpu_shares,cpu_quota,cpu_period
shares
The optional shares element specifies the proportional weighted share for the domain. If this is omitted, it defaults to the OS provided defaults. NB, There is no unit for the value, it's a relative measure based on the setting of other VM, e.g. A VM configured with value 2048 will get twice as much CPU time as a VM configured with value 1024. Since 0.9.0
period
The optional period element specifies the enforcement interval(unit: microseconds). Within period, each vcpu of the domain will not be allowed to consume more than quota worth of runtime. The value should be in range [1000, 1000000]. A period with value 0 means no value. Only QEMU driver support since 0.9.4, LXC since 0.9.10
quota
The optional quota element specifies the maximum allowed bandwidth(unit: microseconds). A domain with quota as any negative value indicates that the domain has infinite bandwidth, which means that it is not bandwidth controlled. The value should be in range [1000, 18446744073709551] or less than 0. A quota with value 0 means no value. You can use this feature to ensure that all vcpus run at the same speed. Only QEMU driver support since 0.9.4, LXC since 0.9.10
Config CPU limit for the specified instance type
nova-manage flavor set_key --name m1.small --key quota:cpu_quota --value 5000 nova-manage flavor set_key --name m1.small --key quota:cpu_period --value 2500 or using python-novaclient with admin credentials nova flavor-key m1.small set quota:cpu_quota=10240000 nova flavor-key m1.small set quota:cpu_period=10240000
bandwidth params :vif_inbound_average,vif_inbound_peak,vif_inbound_burst,vif_outbound_average,vif_outbound_peak,vif_outbound_burst
Incoming and outgoing traffic can be shaped independently. The bandwidth element can have at most one inbound and at most one outbound child elements. Leaving any of these children element out result in no QoS applied on that traffic direction. So, when you want to shape only network's incoming traffic, use inbound only, and vice versa. Each of these elements have one mandatory attribute average. It specifies average bit rate on interface being shaped. Then there are two optional attributes: peak, which specifies maximum rate at which bridge can send data, and burst, amount of bytes that can be burst at peak speed. Accepted values for attributes are integer numbers, The units for average and peak attributes are kilobytes per second, and for the burst just kilobytes. The rate is shared equally within domains connected to the network.
Config Bandwidth limit for instance network traffic
nova-manage flavor set_key --name m1.small --key quota:vif_inbound_average --value 10240 nova-manage flavor set_key --name m1.small --key quota:vif_outbound_average --value 10240 or using python-novaclient with admin credentials nova flavor-key m1.small set quota:vif_inbound_average=10240 nova flavor-key m1.small set quota:vif_outbound_average=10240