<domain type='<%= @domain_type %>'>
  <name><%= @name %></name>
  <memory><%= @memory_size %></memory>
  <vcpu><%= @cpus %></vcpu>

  <% if @nested %>
    <cpu match='exact'>
      <model>core2duo</model>
      <feature policy='require' name='vmx'/>
    </cpu>
  <% end %>

  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <devices>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='<%= @domain_volume_cache %>'/>
      <source file='<%= @domain_volume_path %>'/>
      <%# we need to ensure a unique target dev -%>
      <target dev='vda' bus='virtio'/>
    </disk>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
    </video>
  </devices>
</domain>

<domain type='<%= @domain_type %>'>
  <name><%= @name %></name>
  <memory><%= @memory_size %></memory>
  <vcpu><%= @cpus %></vcpu>

  <% if @nested %>
    <cpu mode='host-passthrough'>
      <model fallback='allow'>qemu64</model>
      <feature policy='optional' name='vmx'/>
      <feature policy='optional' name='svm'/>
    </cpu>
  <% end %>

  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <devices>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='<%= @domain_volume_cache %>'/>
      <source file='<%= @domain_volume_path %>'/>
      <%# we need to ensure a unique target dev -%>
      <target dev='vda' bus='virtio'/>
    </disk>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1' keymap='en-us'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
    </video>
  </devices>
</domain>

Support AMD and Intel processors with nested vm's
Support AMD and Intel processors with nested vm's

Use a more generic model and optional vmx or svm feature.
