1. 程式人生 > >MobaXterm建立虛擬機器xml檔案格式

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
(僅分享學習虛擬化過程中實際操作遇到的情景,如果上述說法有錯誤,請批評指正,謝謝)