tripleo-quickstart/roles/libvirt/setup/undercloud/templates/undercloudvm.xml.j2

84 lines
2.8 KiB
Django/Jinja

{% set lvars = { 'use_default_libvirt' : true } %}
{% for network in networks %}
{% if network.forward_mode is defined and network.forward_mode == 'nat' %}
{% if lvars.update({'use_default_libvirt' : false}) %}{% endif %}
{% if lvars.update({'nat_network' : network.name}) %}{% endif %}
{% if lvars.update({'nat_bridge' : network.bridge}) %}{% endif %}
{% endif %}
{% endfor %}
<domain type='{{ libvirt_domain_type }}'>
<name>{{ undercloud_node.name }}</name>
<memory unit='MiB'>{{ flavors[undercloud_node.flavor].memory }}</memory>
<vcpu>{{ flavors[undercloud_node.flavor].vcpu }}</vcpu>
<os>
<type arch='{{ libvirt_arch }}'>hvm</type>
<boot dev='hd'/>
<bootmenu enable='no'/>
{% if overcloud_as_undercloud|bool or undercloud_use_custom_boot_images|bool %}
<kernel>{{ undercloud_custom_vmlinuz }}</kernel>
<initrd>{{ undercloud_custom_initrd }}</initrd>
<cmdline>console=ttyS0 root=/dev/vda</cmdline>
{% endif %}
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu mode='{{ libvirt_cpu_mode }}'>
<!-- temporary workaround for RHBZ#1415831 -->
<feature policy='disable' name='avx'/>
<feature policy='disable' name='avx2'/>
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='volume' device='disk'>
<driver name='qemu' type='qcow2'/>
<source pool='{{ libvirt_volume_pool }}' volume='{{ undercloud_node.name }}.qcow2'/>
<target dev='{{ libvirt_diskdev }}' bus='{{ libvirt_diskbus }}'/>
</disk>
{% if lvars['use_default_libvirt'] %}
<interface type='bridge'>
<source bridge='virbr0'/>
<model type='virtio'/>
</interface>
{% else %}
<interface type='bridge'>
<mac address='{{ undercloud_mac_map.get(undercloud_node.name).get(lvars['nat_network']) }}'/>
<source bridge='{{ lvars['nat_bridge'] }}'/>
<model type='virtio'/>
</interface>
{% endif %}
{% for network in networks %}
{% if not (lvars['use_default_libvirt'] == false and network.name == lvars['nat_network']) %}
<interface type='bridge'>
<mac address='{{ undercloud_mac_map.get(undercloud_node.name).get(network.name) }}'/>
<source bridge='{{ network.bridge }}'/>
<model type='virtio'/>
{% if network.virtualport_type is defined %}
<virtualport type='{{ network.virtualport_type }}'/>
{% endif %}
</interface>
{% endif %}
{% endfor %}
<serial type='pty'/>
<console type='pty'/>
{% if enable_vnc_console|bool %}
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
</video>
{% endif %}
</devices>
</domain>