Skip to content

Commit 03ef4d6

Browse files
committed
Revert "[pwmgmt]ignore missin governor when cpu_state used"
This reverts commit ed2ac71. This is unnecessary as 2c44215 already fixed this bug on master Change-Id: Id2c253a6e223bd5ba22512d9e5a40a9d12680da2
1 parent fed1230 commit 03ef4d6

File tree

2 files changed

+1
-57
lines changed

2 files changed

+1
-57
lines changed

nova/tests/unit/virt/libvirt/cpu/test_api.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -243,42 +243,3 @@ def test_validate_all_dedicated_cpus_no_cpu(self):
243243
api.validate_all_dedicated_cpus()
244244
# no assert we want to make sure the validation won't raise if
245245
# no dedicated cpus are configured
246-
247-
@mock.patch.object(core, 'get_governor')
248-
@mock.patch.object(core, 'get_online')
249-
def test_validate_all_dedicated_cpus_for_cpu_state_no_governor_ignored(
250-
self, mock_get_online, mock_get_governor
251-
):
252-
self.flags(cpu_power_management=True, group='libvirt')
253-
self.flags(cpu_dedicated_set='0-2', group='compute')
254-
self.flags(cpu_power_management_strategy='cpu_state', group='libvirt')
255-
256-
mock_get_online.return_value = True
257-
mock_get_governor.side_effect = FileNotFoundError(
258-
"File /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "
259-
"could not be found.")
260-
261-
api.validate_all_dedicated_cpus()
262-
263-
self.assertEqual(2, len(mock_get_governor.mock_calls))
264-
265-
@mock.patch.object(core, 'get_governor')
266-
@mock.patch.object(core, 'get_online')
267-
def test_validate_all_dedicated_cpus_for_governor_error(
268-
self, mock_get_online, mock_get_governor
269-
):
270-
self.flags(cpu_power_management=True, group='libvirt')
271-
self.flags(cpu_dedicated_set='0-2', group='compute')
272-
self.flags(cpu_power_management_strategy='governor', group='libvirt')
273-
274-
mock_get_online.return_value = True
275-
mock_get_governor.side_effect = FileNotFoundError(
276-
"File /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "
277-
"could not be found.")
278-
279-
ex = self.assertRaises(
280-
exception.InvalidConfiguration, api.validate_all_dedicated_cpus)
281-
self.assertIn(
282-
"[libvirt]cpu_power_management_strategy is 'governor', "
283-
"but the host OS does not support governors for CPU0",
284-
str(ex))

nova/virt/libvirt/cpu/api.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -143,24 +143,7 @@ def validate_all_dedicated_cpus() -> None:
143143
continue
144144
pcpu = Core(pcpu)
145145
# we need to collect the governors strategy and the CPU states
146-
try:
147-
governors.add(pcpu.governor)
148-
except FileNotFoundError as e:
149-
# NOTE(gibi): When
150-
# /sys/devices/system/cpu/cpuX/cpufreq/scaling_governor does
151-
# not exist it means the host OS does not support any governors.
152-
# If cpu_state strategy is requested we can ignore this as
153-
# governors will not be used but if governor strategy is requested
154-
# we need to report an error and stop as the host is not properly
155-
# configured
156-
if CONF.libvirt.cpu_power_management_strategy == 'governor':
157-
msg = _(
158-
"[libvirt]cpu_power_management_strategy is 'governor', "
159-
"but the host OS does not support governors for CPU%d"
160-
% pcpu.ident
161-
)
162-
raise exception.InvalidConfiguration(msg) from e
163-
146+
governors.add(pcpu.governor)
164147
cpu_states.add(pcpu.online)
165148
if CONF.libvirt.cpu_power_management_strategy == 'cpu_state':
166149
# all the cores need to have the same governor strategy

0 commit comments

Comments
 (0)