参考资料:
http://blog.csdn.net/matt_mao/article/details/18356801 Openstack CPU/Disk/network QoS 功能
http://blog.csdn.net/isclouder/article/details/79189022 libvirt-虚拟机qos控制
flavor Extra Specs
https://docs.openstack.org/nova/pike/admin/flavors.html#extra-specs
通过Libvirt控制KVM虚拟机资源的方法
http://blog.csdn.net/maokexu123/article/details/49821809
正常创建vm,使用unixbench测试结果:
./Run whetstone-double
========================================================================
BYTE UNIX Benchmarks (Version 5.1.2)
System: qa: GNU/Linux
OS: GNU/Linux -- 3.10.0-229.el7.x86_64 -- #1 SMP Fri Mar 6 11:36:42 UTC 2015
Machine: x86_64 (x86_64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel Core i7 9xx (Nehalem Class Core i7) (6600.1 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 1: Intel Core i7 9xx (Nehalem Class Core i7) (6600.1 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
15:54:36 up 21 min, 2 users, load average: 0.69, 0.63, 0.42; runlevel 3
------------------------------------------------------------------------
2 CPUs in system; running 1 parallel copy of tests
Double-Precision Whetstone 3786.1 MWIPS (13.5 s, 7 samples)
System Benchmarks Partial Index BASELINE RESULT INDEX
Double-Precision Whetstone 55.0 3786.1 688.4
========
System Benchmarks Index Score (Partial Only) 688.4
------------------------------------------------------------------------
2 CPUs in system; running 2 parallel copies of tests
Double-Precision Whetstone 7701.5 MWIPS (13.1 s, 7 samples)
System Benchmarks Partial Index BASELINE RESULT INDEX
Double-Precision Whetstone 55.0 7701.5 1400.3
========
System Benchmarks Index Score (Partial Only) 1400.3
virsh schedinfo inst---XXXX set vcpu_quota=10000
========================================================================
BYTE UNIX Benchmarks (Version 5.1.2)
System: qa: GNU/Linux
OS: GNU/Linux -- 3.10.0-229.el7.x86_64 -- #1 SMP Fri Mar 6 11:36:42 UTC 2015
Machine: x86_64 (x86_64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel Core i7 9xx (Nehalem Class Core i7) (6600.1 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 1: Intel Core i7 9xx (Nehalem Class Core i7) (6600.1 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
17:03:45 up 1 min, 1 user, load average: 0.52, 0.22, 0.08; runlevel 3
------------------------------------------------------------------------
Benchmark Run: 三 1月 31 2018 17:03:46 - 17:14:53
2 CPUs in system; running 1 parallel copy of tests
Double-Precision Whetstone 4373.5 MWIPS (10.2 s, 7 samples)
System Benchmarks Partial Index BASELINE RESULT INDEX
Double-Precision Whetstone 55.0 4373.5 795.2
========
System Benchmarks Index Score (Partial Only) 795.2
------------------------------------------------------------------------
Benchmark Run: 三 1月 31 2018 17:14:53 - 17:26:32
2 CPUs in system; running 2 parallel copies of tests
Double-Precision Whetstone 8866.6 MWIPS (10.7 s, 7 samples)
System Benchmarks Partial Index BASELINE RESULT INDEX
Double-Precision Whetstone 55.0 8866.6 1612.1
========
System Benchmarks Index Score (Partial Only) 1612.1
修改flavor extra-specs
nova flavor-key bec5bc03-c0cc-421f-9075-dacea3ab0238 set quota:cpu_quota=10000 quota:cpu_period=20000
参数说明:
period vcpu强制间隔的时间周期,单位微妙,范围[1000, 1000000],每一个vcpu不能使用超过period时间周期
quota vcpu最大允许带宽,单位微妙,范围[1000, 18446744073709551]
emulator_period 强制间隔的时间周期,单位微妙,范围[1000, 1000000],虚拟机进程(qemu)不能使用超过period时间周期
emulator_quota 虚拟机进程(qemu)最大允许带宽,单位微妙,范围[1000, 18446744073709551]