Skip to content

Commit d8aa2e4

Browse files
committed
template formatting
1 parent c7e42c4 commit d8aa2e4

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>
@@ -28,67 +28,67 @@
2828
<apic/>
2929
<pae/>
3030
</features>
31-
{% if cpu_mode %}
31+
{% if cpu_mode %}
3232
<cpu mode='{{ cpu_mode }}'>
3333
<model fallback='allow'/>
3434
</cpu>
35-
{% endif %}
35+
{% endif %}
3636
<devices>
3737
<emulator>{{ libvirt_vm_emulator }}</emulator>
3838
{% for volume in volumes %}
3939
<disk type='{{ volume.type | default(libvirt_volume_default_type) }}' device='{{ volume.device | default(libvirt_volume_default_device) }}'>
4040
<driver name='qemu' type='{{ volume.format | default(libvirt_volume_default_format) }}'/>
41-
{% if volume.type | default(libvirt_volume_default_type) == 'file' %}
41+
{% if volume.type | default(libvirt_volume_default_type) == 'file' %}
4242
<source file='{{ volume.file_path |default(libvirt_volume_default_images_path) }}/{{ volume.name}}'/>
43-
{% elif volume.type | default(libvirt_volume_default_type) == 'network' %}
44-
{% if volume.auth.username is defined %}
43+
{% elif volume.type | default(libvirt_volume_default_type) == 'network' %}
44+
{% if volume.auth.username is defined %}
4545
<auth username='{{ volume.auth.username }}'>
4646
<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 %}/>
4747
</auth>
48-
{% endif %} {# End volume.auth.username check #}
49-
{% if volume.source.name is defined %}
48+
{% endif %} {# End volume.auth.username check #}
49+
{% if volume.source.name is defined %}
5050
<source protocol='{{ volume.source.protocol }}' name='{{ volume.source.name }}'>
51-
{% for host in volume.source.hosts_list %}
51+
{% for host in volume.source.hosts_list %}
5252
<host name='{{ host }}' {% if volume.source.port is defined and volume.source.port is not none %} port='{{ volume.source.port }}' {% endif %}/>
53-
{% endfor %}
53+
{% endfor %}
5454
</source>
55-
{% endif %} {# End volume.source.name check #}
56-
{% elif volume.type | default(libvirt_volume_default_type) == 'block' %}
55+
{% endif %} {# End volume.source.name check #}
56+
{% elif volume.type | default(libvirt_volume_default_type) == 'block' %}
5757
<source dev='{{ volume.dev }}'/>
58-
{% else %} {# End elif volume.type is defined #}
58+
{% else %} {# End elif volume.type is defined #}
5959
<source pool='{{ volume.pool }}' volume='{{ volume.name }}'/>
60-
{% endif %}
61-
{% if volume.target is undefined %}
60+
{% endif %}
61+
{% if volume.target is undefined %}
6262
<target dev='vd{{ 'abcdefghijklmnopqrstuvwxyz'[loop.index - 1] }}' {% if volume.device | default(libvirt_volume_default_device) == 'cdrom' %}bus='sata'{% endif %}/>
63-
{% else %}
63+
{% else %}
6464
<target dev='{{ volume.target }}' {% if volume.device | default(libvirt_volume_default_device) == 'cdrom' %}bus='sata'{% endif %}/>
65-
{% endif %}
65+
{% endif %}
6666
</disk>
6767
{% endfor %}
6868
{% for interface in interfaces %}
69-
{% if interface.type is defined and interface.type == 'direct' %}
69+
{% if interface.type is defined and interface.type == 'direct' %}
7070
<interface type='direct' {% if interface.trust_guest_rx_filters | default(libvirt_vm_trust_guest_rx_filters) | bool %}trustGuestRxFilters='yes'{% endif %}>
7171
<source dev='{{ interface.source.dev }}' mode='{{ interface.source.mode | default('vepa') }}'/>
72-
{% elif interface.type is defined and interface.type == 'bridge' %}
72+
{% elif interface.type is defined and interface.type == 'bridge' %}
7373
<interface type='bridge'>
7474
<source bridge='{{ interface.source.dev }}'/>
75-
{% elif interface.type is not defined or interface.type == 'network' %}
75+
{% elif interface.type is not defined or interface.type == 'network' %}
7676
<interface type='network'>
7777
<source network='{{ interface.network }}'/>
78-
{% endif %}
79-
{% if interface.mac is defined %}
78+
{% endif %}
79+
{% if interface.mac is defined %}
8080
<mac address='{{ interface.mac }}'/>
81-
{% endif %}
81+
{% endif %}
8282
{# if the network configuration is invalid this can still appear in the xml #}
8383
{# (say you enter 'bond' instead of 'bridge' in your variables) #}
84-
{% if interface.model is defined %}
84+
{% if interface.model is defined %}
8585
<model type='{{ interface.model }}'/>
8686
{% else %}
8787
<model type='virtio'/>
8888
{% endif %}
8989
{% if interface.alias is defined %}
9090
<alias name='ua-{{ interface.alias }}'/>
91-
{% endif %}
91+
{% endif %}
9292
</interface>
9393
{% endfor %}
9494
{% if console_log_enabled | bool %}

0 commit comments

Comments
 (0)