Browse Source

Add support for specific kernel package selection

by tagging a node with a tag of 'kernel_package' with
a value of the explicit package name which will drive
the curtin installer.

Change-Id: I67c8395c30bcb538859947f7406a433fb18a981b
changes/20/610720/4
Alan Meadows 9 months ago
parent
commit
52ddfdcf4d

+ 27
- 0
images/maas-region-controller/2.3_kernel_package.patch View File

@@ -0,0 +1,27 @@
1
+--- preseed.py	2018-10-15 12:52:41.611027184 -0700
2
++++ preseed2.py	2018-10-16 13:42:51.824755746 -0700
3
+@@ -317,7 +317,23 @@
4
+     The BootResourceFile table contains a mapping between hwe kernels and
5
+     Ubuntu package names. If this mapping is missing we fall back to letting
6
+     Curtin figure out which kernel should be installed"""
7
+-    kpackage = BootResource.objects.get_kpackage_for_node(node)
8
++
9
++    # determine if this node has kernel parameters applied by drydock
10
++    kernel_opt_tag = "%s_kp" % (node.hostname)
11
++    if kernel_opt_tag in node.tag_names():
12
++
13
++        # the tag exists, retrieve it
14
++        kernel_opts = node.tags.get(name=kernel_opt_tag).kernel_opts
15
++
16
++        # parse the string and find our package param value
17
++        # e.g. kernel_package=linux-image-4.15.0-34-generic
18
++        kparams = kernel_opts.split()
19
++        kdict = dict(kparam.split('=') for kparam in kparams)
20
++        if 'kernel_package' in kdict:
21
++            kpackage = kdict['kernel_package']
22
++    else:
23
++        kpackage = BootResource.objects.get_kpackage_for_node(node)
24
++
25
+     if kpackage:
26
+         kernel_config = {
27
+             'kernel': {

+ 2
- 0
images/maas-region-controller/Dockerfile View File

@@ -56,8 +56,10 @@ RUN apt-get download maas-region-controller=$MAAS_VERSION && \
56 56
 # 2.3 workarounds
57 57
 COPY 2.3_proxy_port.patch /tmp/2.3_proxy_port.patch
58 58
 COPY 2.3_route.patch /tmp/2.3_route.patch
59
+COPY 2.3_kernel_package.patch /tmp/2.3_kernel_package.patch
59 60
 RUN cd /usr/lib/python3/dist-packages/maasserver && patch compose_preseed.py < /tmp/2.3_proxy_port.patch
60 61
 RUN cd /usr/lib/python3/dist-packages/maasserver && patch preseed_network.py < /tmp/2.3_route.patch
62
+RUN cd /usr/lib/python3/dist-packages/maasserver && patch preseed.py < /tmp/2.3_kernel_package.patch
61 63
 
62 64
 COPY journalctl-to-tty.service /etc/systemd/system/journalctl-to-tty.service
63 65
 RUN mkdir -p /etc/systemd/system/basic.target.wants ;\

Loading…
Cancel
Save