MobaXterm创建虚拟机xml文件格式
用MobaXterm创建管理虚拟机,产生的xml文件如下,求其进行分析学习:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/3.0'> //如果是Xen,则type=‘xen’
<name>sles</name> //虚拟机名称,同一物理机唯一
<memory>4194304</memory>
<currentMemory>4194304</currentMemory> //memory
<vcpu>8</vcpu> //虚拟机可使用的cpu个数,查看物理机可用CPU个数:cat /proc/cpuinfo |grep processor | wc -l
<os>
<type arch='x86_64'>hvm</type> //arch指出系统架构类型
<bootmenu enable='yes'/>
</os>
<features>
<acpi/> //Advanced Configuration and Power Interface,高级配置与电源接口
<apic/> //Advanced Programmable Interrupt Controller,高级可编程中断控制器
<pae/> //Physical Address Extension,物理地址扩展
</features>
<clock offset='utc'> //虚拟机时钟设置,这里表示utc时间(协调世界时),如果是clock offset='localtime',表示本机本地时间
<timer name='rtc' tickpolicy='catchup' track='guest'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices> //设备配置
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='cdrom'> //光盘
<driver name='qemu' type='raw' cache='none' io='native'/>
<source file='/mnt/sdb/iso/SLES-11-SP3-DVD-x86_64-GM-DVD1.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<disk type='file' device='disk'> //硬盘
<driver name='qemu' type='qcow2' cache='none' io='native'/>
<source file='/mnt/sdc/qcow2/sles.qcow2'/>
<target dev='vda' bus='virtio'/>
</disk>
<!--controller type='scsi' model='vhost-user-scsi' index='2'>
<source path='/home/spdk/vhost.0' />
<driver queues='8'/>
</controller-->
<interface type='bridge'> /* 利用Linux网桥连接网络 */
<mac address='52:54:48:16:f4:81'/>
<source bridge='br0'/> //配置的网桥网卡名称
<model type='virtio'/>
<virtualport type='openvswitch'/>
</interface>
<input type='tablet' bus='usb'>
<alias name='input0'/>
</input>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
<!--
<video>
<model type='cirrus' vram='9216' heads='1'/>
<alias name='video0'/>
</video>
-->
<memballoon model='virtio'>
<alias name='balloon0'/>
</memballoon>
</devices>
<qemu:commandline>
<qemu:arg value='-chardev'/>
<qemu:arg value='file,id=seabios,path=/var/log/libvirt/qemu/seabios-sles.log'/>
<qemu:arg value='-device'/>
<qemu:arg value='isa-debugcon,iobase=0x402,chardev=seabios'/>
</qemu:commandline>
</domain>
实际采用virsh和xml文件创建虚拟机的步骤有所不同,不在本文里面阐述,另起一篇。
参考资料:https://blog.csdn.net/qq_15437629/article/details/77827033
(仅分享学习虚拟化过程中实际操作遇到的情景,如果上述说法有错误,请批评指正,谢谢)
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/3.0'> //如果是Xen,则type=‘xen’
<name>sles</name> //虚拟机名称,同一物理机唯一
<memory>4194304</memory>
<currentMemory>4194304</currentMemory> //memory
<vcpu>8</vcpu> //虚拟机可使用的cpu个数,查看物理机可用CPU个数:cat /proc/cpuinfo |grep processor | wc -l
<os>
<type arch='x86_64'>hvm</type> //arch指出系统架构类型
<bootmenu enable='yes'/>
</os>
<features>
<acpi/> //Advanced Configuration and Power Interface,高级配置与电源接口
<apic/> //Advanced Programmable Interrupt Controller,高级可编程中断控制器
<pae/> //Physical Address Extension,物理地址扩展
</features>
<clock offset='utc'> //虚拟机时钟设置,这里表示utc时间(协调世界时),如果是clock offset='localtime',表示本机本地时间
<timer name='rtc' tickpolicy='catchup' track='guest'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices> //设备配置
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='cdrom'> //光盘
<driver name='qemu' type='raw' cache='none' io='native'/>
<source file='/mnt/sdb/iso/SLES-11-SP3-DVD-x86_64-GM-DVD1.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<disk type='file' device='disk'> //硬盘
<driver name='qemu' type='qcow2' cache='none' io='native'/>
<source file='/mnt/sdc/qcow2/sles.qcow2'/>
<target dev='vda' bus='virtio'/>
</disk>
<!--controller type='scsi' model='vhost-user-scsi' index='2'>
<source path='/home/spdk/vhost.0' />
<driver queues='8'/>
</controller-->
<interface type='bridge'> /* 利用Linux网桥连接网络 */
<mac address='52:54:48:16:f4:81'/>
<source bridge='br0'/> //配置的网桥网卡名称
<model type='virtio'/>
<virtualport type='openvswitch'/>
</interface>
<input type='tablet' bus='usb'>
<alias name='input0'/>
</input>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
<!--
<video>
<model type='cirrus' vram='9216' heads='1'/>
<alias name='video0'/>
</video>
-->
<memballoon model='virtio'>
<alias name='balloon0'/>
</memballoon>
</devices>
<qemu:commandline>
<qemu:arg value='-chardev'/>
<qemu:arg value='file,id=seabios,path=/var/log/libvirt/qemu/seabios-sles.log'/>
<qemu:arg value='-device'/>
<qemu:arg value='isa-debugcon,iobase=0x402,chardev=seabios'/>
</qemu:commandline>
</domain>
实际采用virsh和xml文件创建虚拟机的步骤有所不同,不在本文里面阐述,另起一篇。
参考资料:https://blog.csdn.net/qq_15437629/article/details/77827033
(仅分享学习虚拟化过程中实际操作遇到的情景,如果上述说法有错误,请批评指正,谢谢)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.