From deb835792cbe2a19060a1bbe1cece297303dd624 Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Tue, 12 Jan 2021 18:25:53 +0100 Subject: [PATCH] Properly detect unloaded dynamic modules on RHEL derivates. Fixes #9776 The modules.dep file on RHEL includes .xz for compressed kernel modules. --- CHANGELOG.md | 1 + client/fingerprint/bridge_linux.go | 2 +- client/fingerprint/bridge_linux_test.go | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbea9d67a8f..15abc8d1bc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ IMPROVEMENTS: BUG FIXES: * client: Fixed a bug where non-`docker` tasks with network isolation were restarted on client restart. [[GH-9757](https://github.com/hashicorp/nomad/issues/9757)] * client: Fixed a bug where clients configured with `cpu_total_compute` did not update the `cpu.totalcompute` node attribute. [[GH-9532](https://github.com/hashicorp/nomad/issues/9532)] + * client: Fixed an fingerprinter issue detecting bridge kernel module on RHEL [[GH-9776](https://github.com/hashicorp/nomad/issues/9776)] * core: Fixed a bug where an in place update dropped an allocations shared allocated resources [[GH-9736](https://github.com/hashicorp/nomad/issues/9736)] * consul: Fixed a bug where updating a task to include services would not work [[GH-9707](https://github.com/hashicorp/nomad/issues/9707)] * consul: Fixed alloc address mode port advertisement to use the mapped `to` port value [[GH-9730](https://github.com/hashicorp/nomad/issues/9730)] diff --git a/client/fingerprint/bridge_linux.go b/client/fingerprint/bridge_linux.go index ff0b6c07a8c..013537059dc 100644 --- a/client/fingerprint/bridge_linux.go +++ b/client/fingerprint/bridge_linux.go @@ -16,7 +16,7 @@ const bridgeKernelModuleName = "bridge" const ( dynamicModuleRe = `%s\s+.*$` builtinModuleRe = `.+/%s.ko$` - dependsModuleRe = `.+/%s.ko:.*$` + dependsModuleRe = `.+/%s.ko(\.xz)?:.*$` ) func (f *BridgeFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error { diff --git a/client/fingerprint/bridge_linux_test.go b/client/fingerprint/bridge_linux_test.go index e8ac5c897f9..8917598e2a8 100644 --- a/client/fingerprint/bridge_linux_test.go +++ b/client/fingerprint/bridge_linux_test.go @@ -67,6 +67,8 @@ kernel/net/bridge/bridge.ko: kernel/net/802/stp.ko kernel/net/llc/llc.ko kernel/net/bridge/br_netfilter.ko: kernel/net/bridge/bridge.ko kernel/net/802/stp.ko kernel/net/llc/llc.ko kernel/net/appletalk/appletalk.ko: kernel/net/802/psnap.ko kernel/net/llc/llc.ko kernel/net/x25/x25.ko: +# Dummy module to test RHEL modules.dep format +kernel/net/bridge/bridgeRHEL.ko.xz: kernel/net/802/stp.ko.xz kernel/net/llc/llc.ko.xz ` ) @@ -116,6 +118,9 @@ func TestBridgeFingerprint_search(t *testing.T) { err := f.searchFile("bridge", file, f.regexp(dependsModuleRe, "bridge")) require.NoError(t, err) + + err = f.searchFile("bridgeRHEL", file, f.regexp(dependsModuleRe, "bridgeRHEL")) + require.NoError(t, err) }) t.Run("absent", func(t *testing.T) {