bifrost/playbooks/roles/bifrost-create-vm-nodes/templates/testvm.xml.j2
Pavlo Shchelokovskyy f888748d4e Use Ansible to create test VMs
this patch moves logic for preparing libvirt environment
and creating test VMs out of bash script to Ansible tasks
using virt_* modules available since Ansible 2.0.

The only virsh command left is volume creation as Ansible still
lacks modules for libvirt volume management.

As a consequence, many variables hidden in the bash script are now
explicitly defined in defaults of 'bifrost-create-vm-nodes' role and can
be redefined by standard Ansible means.

Although the libvirt connection string can be redefined too,
it was not tested with any other than default value (local qemu connection).

Change-Id: Idaca6b5f502e0e2391af92651f30ab9dcd2fbb3b
Related-Bug: #1659876
2017-03-06 17:06:30 +02:00

60 lines
1.9 KiB
Django/Jinja

<domain type='{{ test_vm_domain_type }}'>
<name>{{ vm_name }}</name>
<memory unit='MiB'>{{ test_vm_memory_size }}</memory>
<vcpu>{{ test_vm_cpu_count }}</vcpu>
<os>
<type arch='{{ test_vm_arch }}' machine='{{ test_vm_machine }}'>hvm</type>
<boot dev='network'/>
<bootmenu enable='no'/>
<bios useserial='yes' rebootTimeout='10000'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>{{ test_vm_emulator }}</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='{{ test_vm_disk_cache }}'/>
<source file='{{ vm_volume_path }}'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='network'>
<source network='{{ test_vm_network }}'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<serial type='file'>
<source path='{{ vm_log_file }}'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<serial type='pty'>
<source path='/dev/pts/49'/>
<target port='1'/>
<alias name='serial1'/>
</serial>
<console type='file'>
<source path='{{ vm_log_file }}'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</memballoon>
</devices>
</domain>