本文共 3900 字,大约阅读时间需要 13 分钟。
$ sudo yum install qemu-guest-agent
systemctl status qemu-geust-agent
$ sudo virsh qemu-agent-command centos7.0 '{"execute": "guest-info"}' --pretty{ "return": { "version": "2.8.0", "supported_commands": [ { "enabled": true, "name": "guest-sync-delimited", "success-response": true }, { "enabled": true, "name": "guest-sync", "success-response": true }, { "enabled": true, "name": "guest-suspend-ram", "success-response": false }, { "enabled": true, "name": "guest-suspend-hybrid", "success-response": false },
root@kvm:~# virsh nodecpustats --percentusage: 0.0%user: 0.0%system: 0.0%idle: 100.0%iowait: 0.0%
root@kvm:~# virsh nodememstatstotal : 131918328 KiBfree : 103633700 KiBbuffers: 195532 KiBcached : 25874840 KiB
root@kvm:~# virsh domstate kvm1running
root@kvm:~# virsh vcpucount --current kvm1 --live1
root@kvm:~# virsh vcpuinfo kvm1VCPU: 0CPU: 29State: runningCPU time: 118.8sCPU Affinity: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
root@kvm:~# virsh cpu-stats --total kvm1Total:cpu_time 175.003045493 secondsuser_time 2.610000000 secondssystem_time 7.510000000 seconds
root@kvm:~# virsh dominfo kvm1Id: 30Name: kvm1UUID: bd167199-c1c4-de7e-4996-43a7f197e565OS Type: hvmState: runningCPU(s): 1CPU time: 175.6sMax memory: 1048576 KiBUsed memory: 1048576 KiBPersistent: yesAutostart: disableManaged save: noSecurity model: noneSecurity DOI: 0
root@kvm:~# virsh dommemstat --live kvm1actual 1048576swap_in 0rss 252684
root@kvm:~# virsh domblklist kvm1Target Source------------------------------------------------hda /var/lib/libvirt/images/kvm1.img
root@kvm:~# virsh domblkinfo --device hda kvm1Capacity: 8589934592Allocation: 2012381184Physical: 2012381184
root@kvm:~# virsh domblkerror kvm1No errors found
root@kvm:~# virsh domblkstat --device hda --human kvm1Device: hdanumber of read operations: 42053number of bytes read: 106145280number of write operations: 10648number of bytes written: 96768000number of flush operations: 4044total duration of reads (ns): 833974071total duration of writes (ns): 1180545967total duration of flushes (ns): 3458623200
root@kvm:~# pgrep -lfa kvm132332 /usr/bin/qemu-system-x86_64 -name kvm1 -S -machine pc- i440fx-trusty,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid bd167199-c1c4-de7e-4996-43a7f197e565 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/kvm1.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/libvirt/images/kvm1.img,if=none,id=drive-ide0-0-0,format=raw -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -netdev tap,fd=24,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:55:9b:d6,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -vnc 146.20.141.158:0 -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
转载于:https://blog.51cto.com/aishangwei/2124540