1. 编辑虚拟机配置文件
# 虚拟机的名称为 centos2[root@controller ~]# virsh edit centos2
如,
<domain type='kvm'> <name>centos2</name> <uuid>12343a79-8c41-4e75-916e-feaecc2606fc</uuid> <memory unit='KiB'>1048576</memory> <currentMemory unit='KiB'>1048576</currentMemory> <vcpu placement='static'>2</vcpu>...
注:不要批改 name
和 uuid
!
2. 更新虚拟机配置
[root@controller ~]# virsh define /etc/libvirt/qemu/centos2.xml
即便虚拟机仍处于运行状态也能够执行此命令,只是要到虚拟机重启后,新的配置才会起作用。
3. 重启虚拟机
[root@controller ~]# virsh reboot centos2
4. 查看虚拟机信息
概要信息
[root@controller ~]# virsh dominfo centos2Id: 16名称: centos2UUID: 12343a79-8c41-4e75-916e-feaecc2606fcOS 类型: hvm状态: runningCPU: 2CPU 工夫: 5.0s最大内存: 2097152 KiB应用的内存: 2097152 KiB长久: 是主动启动: 禁用治理的保留: 否安全性模式: selinux安全性 DOI: 0安全性标签: system_u:system_r:svirt_t:s0:c871,c977 (enforcing)
具体配置
[root@controller ~]# virsh dumpxml centos2<domain type='kvm'> <name>centos2</name> <uuid>12343a79-8c41-4e75-916e-feaecc2606fc</uuid> <memory unit='KiB'>2097152</memory> <currentMemory unit='KiB'>2097152</currentMemory> ...