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
This commit is contained in:
Alan Meadows 2018-10-15 13:07:36 -07:00
parent 56521ab77c
commit 52ddfdcf4d
2 changed files with 29 additions and 0 deletions

View File

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

View File

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