Merge ~peppepetra/charm-sysconfig:lp1944996 into charm-sysconfig:master

Proposed by Giuseppe Petralia
Status: Merged
Approved by: Giuseppe Petralia
Approved revision: 6255110782944a78159bebde4aac0678999a8738
Merged at revision: b7602324a8e0e85b41efc5bc697b2bd8a968c110
Proposed branch: ~peppepetra/charm-sysconfig:lp1944996
Merge into: charm-sysconfig:master
Diff against target: 96 lines (+14/-6)
3 files modified
src/lib/lib_sysconfig.py (+3/-1)
src/reactive/sysconfig.py (+2/-2)
src/tests/unit/test_lib.py (+9/-3)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
James Troup (community) Approve
BootStack Reviewers Pending
Review via email: mp+410216@code.launchpad.net

Commit message

Restart irqbalance when updating irqbalance-banned-cpus and avoid considering that a reboot is needed.

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
James Troup (elmo) wrote :

Please see comment inline; you may also need to rebase on top of master?

review: Needs Fixing
Revision history for this message
James Troup (elmo) wrote :

LGTM - will merge once CI passes. Do we need this backported to WIP-release?

review: Approve
Revision history for this message
Giuseppe Petralia (peppepetra) wrote :

CI is broken for this charm atm.

Lint and unittests https://pastebin.canonical.com/p/xmxQK3XWGy/

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision b7602324a8e0e85b41efc5bc697b2bd8a968c110

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/lib/lib_sysconfig.py b/src/lib/lib_sysconfig.py
2index 3fa18a1..3032c30 100644
3--- a/src/lib/lib_sysconfig.py
4+++ b/src/lib/lib_sysconfig.py
5@@ -497,6 +497,7 @@ class SysConfigHelper:
6 if self.irqbalance_banned_cpus:
7 context["irqbalance_banned_cpus"] = self.irqbalance_banned_cpus
8 self._render_boot_resource(IRQBALANCE_CONF_TMPL, IRQBALANCE_CONF, context)
9+ host.service_restart("irqbalance")
10 hookenv.log("irqbalance configuration updated")
11
12 def remove_grub_configuration(self):
13@@ -565,8 +566,9 @@ class SysConfigHelper:
14 )
15 host.service_restart("cpufrequtils")
16
17- def remove_irqbalance_conifguration(self):
18+ def remove_irqbalance_configuration(self):
19 """Remove config from /etc/default/irqbalance."""
20 context = {}
21 self._render_boot_resource(IRQBALANCE_CONF_TMPL, IRQBALANCE_CONF, context)
22+ host.service_restart("irqbalance")
23 hookenv.log("irqbalance configuration deleted")
24diff --git a/src/reactive/sysconfig.py b/src/reactive/sysconfig.py
25index 7aed3c3..1861540 100644
26--- a/src/reactive/sysconfig.py
27+++ b/src/reactive/sysconfig.py
28@@ -160,7 +160,7 @@ def update_status():
29 if is_flag_set("sysconfig.unsupported"):
30 return
31
32- resources = [KERNEL, SYSTEMD_SYSTEM, GRUB_CONF, IRQBALANCE_CONF]
33+ resources = [KERNEL, SYSTEMD_SYSTEM, GRUB_CONF]
34 boot_changes = SysConfigHelper.boot_resources.resources_changed_since_boot(
35 resources
36 )
37@@ -193,6 +193,6 @@ def remove_configuration():
38 syshelper.remove_grub_configuration()
39 syshelper.remove_systemd_configuration()
40 syshelper.remove_resolved_configuration()
41- syshelper.remove_irqbalance_conifguration()
42+ syshelper.remove_irqbalance_configuration()
43 clear_flag("sysconfig.installed")
44 clear_flag("sysconfig.unsupported")
45diff --git a/src/tests/unit/test_lib.py b/src/tests/unit/test_lib.py
46index 682245e..b7eea0c 100644
47--- a/src/tests/unit/test_lib.py
48+++ b/src/tests/unit/test_lib.py
49@@ -551,10 +551,11 @@ class TestLib:
50
51 apt_install.assert_not_called()
52
53+ @mock.patch("lib_sysconfig.host.service_restart")
54 @mock.patch("lib_sysconfig.hookenv.config")
55 @mock.patch("lib_sysconfig.hookenv.log")
56 @mock.patch("lib_sysconfig.render")
57- def test_update_irqbalance_file(self, render, log, config):
58+ def test_update_irqbalance_file(self, render, log, config, restart):
59 """Update /etc/default/irqbalance.
60
61 Expect file is rendered with correct config.
62@@ -576,6 +577,8 @@ class TestLib:
63 context=expected,
64 )
65
66+ restart.assert_called()
67+
68 @mock.patch("lib_sysconfig.hookenv.config")
69 @mock.patch("lib_sysconfig.os.remove")
70 @mock.patch("lib_sysconfig.hookenv.log")
71@@ -754,16 +757,17 @@ class TestLib:
72 "blocked", "Error parsing sysctl YAML"
73 )
74
75+ @mock.patch("lib_sysconfig.host.service_restart")
76 @mock.patch("lib_sysconfig.hookenv.config")
77 @mock.patch("lib_sysconfig.hookenv.log")
78 @mock.patch("lib_sysconfig.render")
79- def test_remove_irqbalance_configuratioon(self, render, log, config):
80+ def test_remove_irqbalance_configuration(self, render, log, config, restart):
81 """Test remove irqbalance configuration.
82
83 Expect file is rendered with empty context.
84 """
85 sysh = lib_sysconfig.SysConfigHelper()
86- sysh.remove_irqbalance_conifguration()
87+ sysh.remove_irqbalance_configuration()
88
89 render.assert_called_with(
90 source=lib_sysconfig.IRQBALANCE_CONF_TMPL,
91@@ -771,3 +775,5 @@ class TestLib:
92 templates_dir="templates",
93 context={},
94 )
95+
96+ restart.assert_called()

Subscribers

People subscribed via source and target branches

to all changes: