maas/images/maas-region-controller/2.8_kernel_package.patch
Ruslan Aliev 23a2b557f1 Revert "Upgrading MAAS to v3"
This reverts commit 129d958a51.

Reason for revert: reverting back to 2.8.7 to modify chart

Change-Id: I68d3abfb19decc5eb470fcf43694506bc5edd4b6
2023-02-16 15:32:01 -06:00

33 lines
1.4 KiB
Diff

diff --git a/src/maasserver/preseed.py b/src/maasserver/preseed.py
index 36c656775..5da8f0312 100644
--- a/src/maasserver/preseed.py
+++ b/src/maasserver/preseed.py
@@ -245,7 +245,27 @@ def compose_curtin_kernel_preseed(node):
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"""
+
+ # previous logic to retrieve kpackage parameter
kpackage = BootResource.objects.get_kpackage_for_node(node)
+
+ # determine if this node has kernel parameters applied by drydock
+ # and override kpackage if we discover the right properties
+ 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("=", 1) for kparam in kparams if "=" in kparam
+ )
+ if "kernel_package" in kdict:
+ kpackage = kdict["kernel_package"]
+
if kpackage:
kernel_config = {"kernel": {"package": kpackage, "mapping": {}}}
return [yaml.safe_dump(kernel_config)]