通过配置nova-compute.conf设置qemu中的cache项

openstack中将qemu的cache功能打开的配置方法:


配置nova-compute.conf:

[DEFAULT]

compute_driver=libvirt.LibvirtDriver

 

[libvirt]

disk_cachemodes ="block=writeback"

disk_cachemodes ="network=writeback"

disk_cachemodes ="file=writeback"


如果是qcow2的磁盘,需要配置file=writeback

这样后台就会看到qemu虚拟机开启了cache=writeback:

libvirt+ 25647 69.0  4.7 1372240 190468 ?      Sl  13:49   0:08/usr/bin/qemu-system-x86_64 -name instance-00000010 -S -machinepc-i440fx-utopic,accel=tcg,usb=off -cpuSandyBridge,+erms,+smep,+fsgsbase,+pdpe1gb,+hypervisor,+rdrand,+f16c,+osxsave,+pcid,+vmx,+ss,+vme-m 512 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuidd441cb9d-4230-496d-9254-61a3d006d607 -smbios type=1,manufacturer=OpenStackFoundation,product=OpenStackNova,version=2015.1.2,serial=5427607f-63ea-4895-bcf5-8d1a1bad40b4,uuid=d441cb9d-4230-496d-9254-61a3d006d607-no-user-config -nodefaults -chardevsocket,id=charmonitor,path=/var/lib/libvirt/qemu/instance-00000010.monitor,server,nowait-mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown-boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/var/lib/nova/instances/d441cb9d-4230-496d-9254-61a3d006d607/disk,if=none,id=drive-virtio-disk0,format=qcow2,cache=writeback -devicevirtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1-netdev tap,fd=25,id=hostnet0 -devicevirtio-net-pci,netdev=hostnet0,id=net0,mac=fa:16:3e:4b:59:b5,bus=pci.0,addr=0x3-chardevfile,id=charserial0,path=/var/lib/nova/instances/d441cb9d-4230-496d-9254-61a3d006d607/console.log-device isa-serial,chardev=charserial0,id=serial0 -chardev pty,id=charserial1-device isa-serial,chardev=charserial1,id=serial1 -device usb-tablet,id=input0-vnc 0.0.0.0:0 -k en-us -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -devicevirtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -msg timestamp=on


你可能感兴趣的:(通过配置nova-compute.conf设置qemu中的cache项)