一、启动虚拟机报错:
[root@KVM ~]# virsh start node-mssql-test01
error: Failed to start domain node-mssql-test01
error: internal error: qemu unexpectedly closed the monitor: Cannot set up guest memory 'pc.ram': Cannot allocate memory
二、报错原因:不能分配内存,查看物理机内存和虚拟机分配的内存,发现剩余物理内存过少。
[root@KVM ~]# free -g
total used free shared buff/cache available
Mem: 125 104 14 0 6 17
Swap: 31 31 0
[root@KVM ~]# virsh dominfo node-mssql-test01
Id: -
Name: node-mssql-test01
UUID: 4fc06259-0873-4082-95b8-2b530c330584
OS Type: hvm
State: shut off
CPU(s): 16
Max memory: 30817152 KiB
Used memory: 30817152 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: none
Security DOI: 0
三、解决方法:修改虚拟机xml文件减少内存(经测试最多只能修改到20G左右)
[root@KVM ~]# virsh dumpxml node-mssql-test01 | grep -i memory
<memory unit='KiB'>20487152</memory>
<currentMemory unit='KiB'>20487152</currentMemory>
[root@KVM ~]# virsh start node-mssql-test01
Domain node-mssql-test01 started