Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
domain_template.xml.j2 1.49 KiB
<domain type='kvm'>
  <name>$vm_name</name>
  <memory unit='MiB'>{{ gitlab_runner_libvirt_vm_memory }}</memory>
  <vcpu>4</vcpu>
  <sysinfo type='smbios'>
    <oemStrings>
      <entry>io.systemd.credential:system.hostname=$vm_name</entry>
      <entry>io.systemd.credential.binary:ssh.authorized_keys.root=$ssh_authorized_keys_root</entry>
    </oemStrings>
  </sysinfo>
  <os>
    <type arch='x86_64' machine='q35'>hvm</type>
    <smbios mode='sysinfo'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough'/>
  <!-- https://github.com/virt-manager/virt-manager/blob/7ae10b5566ac4d8c7afd94499a9733ed42cf3d07/virtinst/domain/clock.py#L49-L59 -->
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <devices>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/$vm_name.qcow2'/>
      <target dev='sdb' bus='scsi'/>
    </disk>
    <controller type='pci' model='pcie-root'/>
    <controller type='scsi' model='virtio-scsi'/>
    <controller type='usb' model='none'/>
    <interface type='network'>
      <source network='default'/>
      <model type='virtio'/>
      <filterref filter='clean-traffic'/>
    </interface>
    <rng model='virtio'>
      <backend model='random'>/dev/urandom</backend>
    </rng>
    <video>
      <model type='virtio'/>
    </video>
    <graphics type='vnc'/>
  </devices>
</domain>