十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
最近测试esxi6.7的vmotion功能,为了熟悉kvm决定在kvm上实现, 系统是ubuntu16.04, 启动一个kvm,发现esxi在迁移时会崩溃,无法进行迁移,查找相关次料,解决方案如下:
成都创新互联于2013年创立,先为峰峰矿等服务建站,峰峰矿等地企业,进行企业商务咨询服务。为峰峰矿企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
# apt install qemu-system-x86 qemu-kvm qemu libvirt-bin virt-manager virtinst bridge-utils cpu-checker virt-viewer
# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
# virt-host-validate
QEMU: Checking for hardware virtualization : PASS
QEMU: Checking if device /dev/kvm exists : PASS
cat /etc/group | grep libvirt | awk -F':' {'print $1'} | xargs -n1 sudo adduser $USER
# add user to kvm group also
sudo adduser $USER kvm
# relogin, then show group membership
exec su -l $USER
id | grep libvirt
# ip addr show virbr0
17: virbr0: mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:d2:52:b5 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
# iptable -t nat -vnL
Chain POSTROUTING (policy ACCEPT 146 packets, 11359 bytes)
pkts bytes target prot opt in out source destination
0 0 RETURN all -- * * 192.168.122.0/24 224.0.0.0/24
0 0 RETURN all -- * * 192.168.122.0/24 255.255.255.255
0 0 MASQUERADE tcp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
0 0 MASQUERADE udp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
0 0 MASQUERADE all -- * * 192.168.122.0/24 !192.168.122.0/24
# virsh pool-list --all
Name State Autostart
-------------------------------------------
default active yes
$ virsh pool-define-as kvmpool --type dir --target /data/kvm/pool
Pool kvmpool defined
$ virsh pool-list --all
$ virsh pool-start kvmpool
$ virsh pool-autostart kvmpool
$ virsh pool-list --all
Name State Autostart
-------------------------------------------
default active yes
kvmpool active yes
virt-install --virt-type=kvm --name=ukvm1404 --ram 1024 --vcpus=1 --virt-type=kvm --hvm --cdrom ~/Downloads/mini.iso --network network=default --graphics vnc --disk pool=default,size=20,bus=virtio,format=qcow2 --noautoconsole
# open console to VM
virt-viewer ukvm1404
virsh destroy ukvm1404
virsh undefine ukvm1404
# vi /etc/modprobe.d/qemu-system-x86.conf
options kvm_intel nested=1 enable_apicv=n
options kvm ignore_msrs=1
# want Y to be returned
$ cat /sys/module/kvm/parameters/ignore_msrs
# want N to be returned
$ cat /sys/module/kvm_intel/parameters/enable_apicv
# want Y to be returned
$ cat /sys/module/kvm_intel/parameters/nested
# virt-install --virt-type=kvm --name=esxi4 \
--ram 4096 --vcpus=4 \
--virt-type=kvm --hvm \
--cdrom /data/iso/VMware-VMvisor-Installer-6.7.0.update03-14320388.x86_64.iso \
--network network:default,model=e1000 \
--graphics vnc --video qxl \
--disk pool=default,size=80,sparse=true,bus=ide,format=qcow2 \
--boot cdrom,hd --noautoconsole --force \
--cpu host-model-only
当然你也可以使用virt-manager来建立虚拟机。