Skip to content

Commit 4e1d9b5

Browse files
committed
template formatting
1 parent d705ae1 commit 4e1d9b5

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

templates/vm.xml.j2

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<domain type='{{ libvirt_vm_engine }}'>
22
<name>{{ vm.name }}</name>
3-
{% if vm.uuid is defined %}
3+
{% if vm.uuid is defined %}
44
<uuid>{{ vm.uuid }}</uuid>
5-
{% elif (libvirt_vm_default_uuid_deterministic | bool) or (vm.uuid_deterministic is defined and (vm.uuid_deterministic | bool)) %}
5+
{% elif (libvirt_vm_default_uuid_deterministic | bool) or (vm.uuid_deterministic is defined and (vm.uuid_deterministic | bool)) %}
66
<uuid>{{ vm.name | to_uuid }}</uuid>
7-
{% endif %}
7+
{% endif %}
88
<memory>{{ vm.memory_mb | int * 1024 }}</memory>
99
<vcpu>{{ vm.vcpus }}</vcpu>
10-
{% if vm.clock_offset |default( libvirt_vm_clock_offset ) %}
10+
{% if vm.clock_offset |default( libvirt_vm_clock_offset ) %}
1111
<clock offset="{{ vm.clock_offset }}"/>
12-
{% else %}
12+
{% else %}
1313
<clock sync="localtime"/>
14-
{% endif %}
14+
{% endif %}
1515
<on_poweroff>destroy</on_poweroff>
1616
<on_reboot>restart</on_reboot>
1717
<on_crash>destroy</on_crash>
@@ -34,67 +34,67 @@
3434
<apic/>
3535
<pae/>
3636
</features>
37-
{% if cpu_mode %}
37+
{% if cpu_mode %}
3838
<cpu mode='{{ cpu_mode }}'>
3939
<model fallback='allow'/>
4040
</cpu>
41-
{% endif %}
41+
{% endif %}
4242
<devices>
4343
<emulator>{{ libvirt_vm_emulator }}</emulator>
4444
{% for volume in volumes %}
4545
<disk type='{{ volume.type | default(libvirt_volume_default_type) }}' device='{{ volume.device | default(libvirt_volume_default_device) }}'>
4646
<driver name='qemu' type='{{ volume.format | default(libvirt_volume_default_format) }}'/>
47-
{% if volume.type | default(libvirt_volume_default_type) == 'file' %}
47+
{% if volume.type | default(libvirt_volume_default_type) == 'file' %}
4848
<source file='{{ volume.file_path |default(libvirt_volume_default_images_path) }}/{{ volume.name}}'/>
49-
{% elif volume.type | default(libvirt_volume_default_type) == 'network' %}
50-
{% if volume.auth.username is defined %}
49+
{% elif volume.type | default(libvirt_volume_default_type) == 'network' %}
50+
{% if volume.auth.username is defined %}
5151
<auth username='{{ volume.auth.username }}'>
5252
<secret type='{{ volume.auth.type }}' {% if volume.auth.uuid is defined and volume.auth.uuid is not none %} uuid='{{ volume.auth.uuid }}' {% else %} usage='{{ volume.auth.usage }}' {% endif %}/>
5353
</auth>
54-
{% endif %} {# End volume.auth.username check #}
55-
{% if volume.source.name is defined %}
54+
{% endif %} {# End volume.auth.username check #}
55+
{% if volume.source.name is defined %}
5656
<source protocol='{{ volume.source.protocol }}' name='{{ volume.source.name }}'>
57-
{% for host in volume.source.hosts_list %}
57+
{% for host in volume.source.hosts_list %}
5858
<host name='{{ host }}' {% if volume.source.port is defined and volume.source.port is not none %} port='{{ volume.source.port }}' {% endif %}/>
59-
{% endfor %}
59+
{% endfor %}
6060
</source>
61-
{% endif %} {# End volume.source.name check #}
62-
{% elif volume.type | default(libvirt_volume_default_type) == 'block' %}
61+
{% endif %} {# End volume.source.name check #}
62+
{% elif volume.type | default(libvirt_volume_default_type) == 'block' %}
6363
<source dev='{{ volume.dev }}'/>
64-
{% else %} {# End elif volume.type is defined #}
64+
{% else %} {# End elif volume.type is defined #}
6565
<source pool='{{ volume.pool }}' volume='{{ volume.name }}'/>
66-
{% endif %}
67-
{% if volume.target is undefined %}
66+
{% endif %}
67+
{% if volume.target is undefined %}
6868
<target dev='vd{{ 'abcdefghijklmnopqrstuvwxyz'[loop.index - 1] }}' {% if volume.device | default(libvirt_volume_default_device) == 'cdrom' %}bus='sata'{% endif %}/>
69-
{% else %}
69+
{% else %}
7070
<target dev='{{ volume.target }}' {% if volume.device | default(libvirt_volume_default_device) == 'cdrom' %}bus='sata'{% endif %}/>
71-
{% endif %}
71+
{% endif %}
7272
</disk>
7373
{% endfor %}
7474
{% for interface in interfaces %}
75-
{% if interface.type is defined and interface.type == 'direct' %}
75+
{% if interface.type is defined and interface.type == 'direct' %}
7676
<interface type='direct' {% if interface.trust_guest_rx_filters | default(libvirt_vm_trust_guest_rx_filters) | bool %}trustGuestRxFilters='yes'{% endif %}>
7777
<source dev='{{ interface.source.dev }}' mode='{{ interface.source.mode | default('vepa') }}'/>
78-
{% elif interface.type is defined and interface.type == 'bridge' %}
78+
{% elif interface.type is defined and interface.type == 'bridge' %}
7979
<interface type='bridge'>
8080
<source bridge='{{ interface.source.dev }}'/>
81-
{% elif interface.type is not defined or interface.type == 'network' %}
81+
{% elif interface.type is not defined or interface.type == 'network' %}
8282
<interface type='network'>
8383
<source network='{{ interface.network }}'/>
84-
{% endif %}
85-
{% if interface.mac is defined %}
84+
{% endif %}
85+
{% if interface.mac is defined %}
8686
<mac address='{{ interface.mac }}'/>
87-
{% endif %}
87+
{% endif %}
8888
{# if the network configuration is invalid this can still appear in the xml #}
8989
{# (say you enter 'bond' instead of 'bridge' in your variables) #}
90-
{% if interface.model is defined %}
90+
{% if interface.model is defined %}
9191
<model type='{{ interface.model }}'/>
9292
{% else %}
9393
<model type='virtio'/>
9494
{% endif %}
9595
{% if interface.alias is defined %}
9696
<alias name='ua-{{ interface.alias }}'/>
97-
{% endif %}
97+
{% endif %}
9898
</interface>
9999
{% endfor %}
100100
{% if console_log_enabled | bool %}

0 commit comments

Comments
 (0)