<domain type='{{ hypervisor }}'>
        <name>{{ name }}</name>
        <vcpu>{{ cpu }}</vcpu>
        <memory unit='KiB'>{{ mem }}</memory>
        <os>
                <type>hvm</type>
                {% for dev in boot_dev %}
                <boot dev='{{ dev }}' />
                {% endfor %}
        </os>
        <devices>
                {% for diskname, disk in disks.items() %}
                <disk type='file' device='disk'>
                        <source file='{{ disk.source_file }}' />
                        <target dev='{{ disk.target_dev }}' bus='{{ disk.disk_bus }}' />
                        {% if disk.address -%}
                        <address type='drive' controller='0' bus='0' target='0' unit='{{ disk.index }}' />
                        {% endif %}
                        {% if disk.driver -%}
                        <driver name='qemu' type='{{ disk.type }}' cache='none' io='native'/>
                        {% endif %}
                </disk>
                {% endfor %}

                {% if controller_model %}
                <controller type='scsi' index='0' model='{{ controller_model }}' />
                {% endif %}

                {% for nic in nics %}
                <interface type='{{ nic.type }}'>
                    <source {{ nic.type }}='{{ nic.source }}'/>
                    <mac address='{{ nic.mac }}'/>
                    <model type='{{ nic.model }}'/>
                </interface>
                {% endfor %}

                <graphics type='vnc' listen='0.0.0.0' autoport='yes' />

                {% if serial_type == 'pty' %}
                <serial type='pty'>
                        <target port='0'/>
                </serial>
                {% if console %}
                <console type='pty'>
                        <target type='serial' port='0'/>
                </console>
                {% endif %}
                {% endif %}

                {% if serial_type == 'tcp' %}
                <serial type='tcp'>
                        <source mode='bind' host='' service='{{ telnet_port }}'/>
                        <protocol type='telnet'/>
                        <target port='0'/>
                </serial>
                {% if console %}
                <console type='tcp'>
                        <source mode='bind' host='' service='{{ telnet_port }}'/>
                        <protocol type='telnet'/>
                        <target type='serial' port='0'/>
                </console>
                {% endif %}
                {% endif %}

        </devices>
        <features>
                <acpi />
        </features>
</domain>
