Skip to content

Commit bec8f47

Browse files
sbauzanotartom
authored andcommitted
fup for power management series
Emptying the cpu init file and directly calling the submodule API. NOTE(artom) Backporting this makes the whole stack on top of this pass functional and unit tests without any stable-only modifications. Otherwise we'd have to refactor nova/virt/libvirt/cpu/__init__.py to use the new per-driver API objects. Relates to blueprint libvirt-cpu-state-mgmt Change-Id: I1299ca4b49743f58bec6f541785dd9fbee0ae9e2 (cherry picked from commit 37fa501)
1 parent fab81c3 commit bec8f47

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

nova/tests/functional/libvirt/test_power_manage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from nova.tests.fixtures import libvirt as fakelibvirt
2222
from nova.tests.functional.libvirt import base
2323
from nova.virt import hardware
24-
from nova.virt.libvirt import cpu
24+
from nova.virt.libvirt.cpu import api as cpu_api
2525

2626

2727
class PowerManagementTestsBase(base.ServersTestBase):
@@ -73,7 +73,7 @@ def _assert_server_cpus_state(self, server, expected='online'):
7373

7474
def _assert_cpu_set_state(self, cpu_set, expected='online'):
7575
for i in cpu_set:
76-
core = cpu.Core(i)
76+
core = cpu_api.Core(i)
7777
if expected == 'online':
7878
self.assertTrue(core.online, f'{i} is not online')
7979
elif expected == 'offline':
@@ -211,7 +211,7 @@ def test_create(self):
211211

212212
def test_changing_strategy_fails(self):
213213
# Arbitratly set a core governor strategy to be performance
214-
cpu.Core(1).set_high_governor()
214+
cpu_api.Core(1).set_high_governor()
215215
# and then forget about it while changing the strategy.
216216
self.flags(cpu_power_management_strategy='cpu_state', group='libvirt')
217217
# This time, this wouldn't be acceptable as some core would have a

nova/virt/libvirt/cpu/__init__.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +0,0 @@
1-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2-
# not use this file except in compliance with the License. You may obtain
3-
# a copy of the License at
4-
#
5-
# http://www.apache.org/licenses/LICENSE-2.0
6-
#
7-
# Unless required by applicable law or agreed to in writing, software
8-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10-
# License for the specific language governing permissions and limitations
11-
# under the License.
12-
13-
from nova.virt.libvirt.cpu import api
14-
15-
16-
Core = api.Core
17-
18-
19-
power_up = api.power_up
20-
power_down = api.power_down
21-
validate_all_dedicated_cpus = api.validate_all_dedicated_cpus
22-
power_down_all_dedicated_cpus = api.power_down_all_dedicated_cpus

nova/virt/libvirt/driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
from nova.virt import images
115115
from nova.virt.libvirt import blockinfo
116116
from nova.virt.libvirt import config as vconfig
117-
from nova.virt.libvirt import cpu as libvirt_cpu
117+
from nova.virt.libvirt.cpu import api as libvirt_cpu
118118
from nova.virt.libvirt import designer
119119
from nova.virt.libvirt import event as libvirtevent
120120
from nova.virt.libvirt import guest as libvirt_guest

0 commit comments

Comments
 (0)