<domain type='<%= domain_type %>'>
  <name><%= name %></name>
  <memory><%= memory_size %></memory>
  <vcpu><%= cpus %></vcpu>
  <os>
    <type arch='<%= arch %>'><%= os_type %></type>
<% boot_order.each do |dev| -%>
    <boot dev='<%= dev %>'/>
<% end -%>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <devices>
<% volumes.each do |vol| -%>
    <disk type='file' device='disk'>
      <driver name='qemu' type='<%= vol.format_type %>'/>
      <source file='<%= vol.path %>'/>
      <%# we need to ensure a unique target dev -%>
      <target dev='vd<%= ('a'..'z').to_a[volumes.index(vol)] %>' bus='virtio'/>
    </disk>
<% end -%>
<% if iso_file -%>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='<%= "#{iso_dir}/#{iso_file}" %>'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
<% end -%>
<% nics.each do |nic| -%>
    <interface type='<%= nic.type %>'>
      <source <%= nic.type == 'bridge' ? "bridge='#{nic.bridge}'" : "network='#{nic.network}'" %> />
      <model type='<%= nic.model %>'/>
    </interface>
<% end -%>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
     <graphics type='<%= display[:type] %>' port='<%= display[:port] %>' autoport='yes' listen='<%= display[:listen] %>' passwd='<%=display[:password] %>'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
    </video>
  </devices>
</domain>
