003f7bf702
Signed-off-by: Ruslan Aliev <raliev@mirantis.com> Change-Id: I87a86c920e49e53447c87bcff3c0fae08ebf267f
33 lines
1.4 KiB
Diff
33 lines
1.4 KiB
Diff
diff --git a/src/maasserver/preseed.py b/src/maasserver/preseed.py
|
|
index f9ba34a18..a9f41b9c2 100644
|
|
--- a/src/maasserver/preseed.py
|
|
+++ b/src/maasserver/preseed.py
|
|
@@ -232,7 +232,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)]
|