<target dev="hdc" bus="ide"/>
<readonly/>
<address type="drive" controller="0" bus="1" target="0" unit="0"/>
</disk>
<interface type='bridge'>
<source bridge='br0'/>
<mac address="00:00:A3:B0:56:10"/>
</interface>
<controller type="ide" index="0">
<address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x1"/>
</controller>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport="yes" listen='0.0.0.0'/>
<console type='pty'>
<target port='0'/>
</console>
</devices>
</domain>
上面的主机xml配置文件定义了如下的虚拟机内容。
1GB内存,一个虚拟cpu和一个硬件驱动
磁盘镜像:/home/dev/images/alice.img
从 CD-ROM 引导(/home/dev/iso/CentOS-6.5-x86_64-minomal.iso)
网络:一个桥接到 br0 的虚拟网卡
通过 VNC 远程访问
<uuid></uuid> 中的 UUID 字符串可以随机生成。为了得到一个随机的 uuid 字符串,你可能需要使用 uuid 命令行工具。
复制代码
$ sudo apt-get install uuid
$ uuid
生成一个主机 xml 配置文件的方式就是通过一个已经存在的虚拟机来导出它的 xml 配置文件。如下所示。
复制代码
$ virsh dumpxml alice > bob.xml

第五步:使用命令行启动虚拟机