aboutsummaryrefslogtreecommitdiff
path: root/docker/nova/nova-libvirt/Dockerfile.j2
blob: 08008567870dd68822a2fac18ccbccb56ebcd284 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}

{% block nova_libvirt_header %}{% endblock %}

{% import "macros.j2" as macros with context %}

{{ macros.configure_user(name='nova', groups='qemu') }}

# FIXME(mnasiadka): Remove when CentOS Storage SIG repo is available for CentOS 8
{% if distro_package_manager == 'dnf' %}
    {{ macros.enable_extra_repos(['ceph', 'ceph-noarch', 'ceph-el8', 'ceph-lab-extras']) }}
{% else %}
    {{ macros.enable_extra_repos(['ceph']) }}
{% endif %}

{% if base_package_type == 'rpm' %}

    {% set nova_libvirt_packages = [
        'ceph-common',
        'cyrus-sasl-scram',
        'libguestfs',
        'libvirt-client',
        'libvirt-daemon',
        'libvirt-daemon-config-nwfilter',
        'libvirt-daemon-driver-nwfilter',
        'openvswitch',
        'trousers'
    ] %}
    {% if distro_package_manager == 'dnf' or base_distro not in ['centos'] %}
        {% set nova_libvirt_packages = nova_libvirt_packages + [
            'qemu-kvm'
        ] %}
    {% else %}
        {% set nova_libvirt_packages = nova_libvirt_packages + [
            'qemu-kvm-ev'
        ] %}
    {% endif %}
    {% if distro_package_manager != 'dnf' %}
        {% set nova_libvirt_packages = nova_libvirt_packages + [
            'libvirt-daemon-driver-lxc',
        ] %}
    {% endif %}

    {% if base_arch == 'x86_64' %}
        {% if base_distro_tag.startswith('7') %}
            {% set nova_libvirt_packages = nova_libvirt_packages + [
                'OVMF'
            ] %}
        {% else %}
            {% set nova_libvirt_packages = nova_libvirt_packages + [
                'edk2-ovmf'
            ] %}
        {% endif %}
    {% elif base_arch == 'aarch64' %}
        {% if base_distro_tag.startswith('7') %}
            {% set nova_libvirt_packages = nova_libvirt_packages + [
                'AAVMF'
            ] %}
        {% else %}
            {% set nova_libvirt_packages = nova_libvirt_packages + [
                'edk2-aarch64'
            ] %}
        {% endif %}
    {% endif %}

{% elif base_package_type == 'deb' %}

    {% set nova_libvirt_packages = [
        'ceph-common',
        'ebtables',
        'libvirt-clients',
        'libvirt-daemon-system',
        'openvswitch-switch',
        'pm-utils',
        'python3-cephfs',
        'python3-rados',
        'python3-rbd',
        'qemu-block-extra',
        'qemu-system',
        'trousers'
    ] %}

    {% if base_arch == "aarch64" %}
        {% set nova_libvirt_packages = nova_libvirt_packages + [
            'qemu-efi'
        ] %}
    {% elif base_arch == "x86_64" %}
        {% set nova_libvirt_packages = nova_libvirt_packages + [
            'ovmf',
            'qemu-kvm'
        ] %}
    {% endif %}

    {% if base_arch != "ppc64le" %}
        {% set nova_libvirt_packages = nova_libvirt_packages + [
            'dmidecode',
            'xen-utils'
        ] %}
    {% endif %}

    {% if base_distro in ['debian'] %}
        {% set nova_libvirt_packages = nova_libvirt_packages + [
            'usermode'
        ] %}
    {% endif %}
{% endif %}

{{ macros.install_packages(nova_libvirt_packages | customizable("packages")) }}

{% if base_package_type == 'deb' %}

RUN rm -f /etc/libvirt/qemu/networks/default.xml /etc/libvirt/qemu/networks/autostart/default.xml

{% elif base_package_type == 'rpm' %}

    {% if base_arch == 'x86_64' and base_distro_tag.startswith('7') %}
# NOTE(jeffrey4l): for x86_64, nova will validate the existence of /usr/share/OVMF/OVMF_CODE.fd
RUN ln -sf /usr/share/OVMF/OVMF_CODE.secboot.fd /usr/share/OVMF/OVMF_CODE.fd
    {% endif %}

{% endif %}

COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start

{% block nova_libvirt_footer %}{% endblock %}
{% block footer %}{% endblock %}