列出所有虚拟机
virsh list --all
关闭虚拟机
virsh destroy guest-rhel7
编辑虚拟机文件
virsh edit guest-rhel7
添加cdrom镜像
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/kvm/iso/CentOS-7-x86_64-DVD-2009.iso'/>
<target dev='hda' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
将boot 改为光盘启动
<os>
<type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
<boot dev='cdrom'/>
<bootmenu enable='yes'/>
</os>
检查虚拟机配置
virsh domblklist guest-rhel7
开启虚拟机
virsh start guest-rhel7
注意:由于openstack nova-compute服务对虚拟机电源状态同步会自动关机,因此可以采用:
临时停止宿主机nova-compute
systemctl stop openstack-nova-compute.service
查看vnc端口
通过vnc工具连接该宿主机IP和以下对应端口进入虚拟机控制台
virsh vncdisplay guest-rhel7
:0