Skip to content

Instantly share code, notes, and snippets.

@luohao-brian
Last active September 30, 2018 08:43
Show Gist options
  • Save luohao-brian/5453189 to your computer and use it in GitHub Desktop.
Save luohao-brian/5453189 to your computer and use it in GitHub Desktop.
libvirt virtual machine example
<domain type='kvm' id='1'>
<name>ubuntu-1804-hluo</name>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu>2</vcpu>
<cpu mode='host-passthrough'/>
<os>
<type arch='x86_64'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
<hap/>
</features>
<clock offset='localtime'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none' io='native'/>
<source file='/root/hluo/vm/ubuntu-1804.img'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/root/hluo/vm/virtio-win-0.1-52.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:65:f3:de'/>
<model type='virtio' />
<driver name='vhost'/>
<source bridge='virbr0'/>
</interface>
<input type='keyboard' bus='ps2' />
<graphics type='vnc' port='5900' autoport='yes'>
<listen type='address' address='0.0.0.0'/>
</graphics>
<video>
<model type='cirrus' vram='16384' heads='1' primary='yes'/>
</video>
<serial type="file">
<source path='/tmp/hluo-ubuntu-console.log'/>
</serial>
</devices>
</domain>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment