-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove traces of now unused host capabilities from scheduler
Host capabilities updates are no longer used by the scheduler. All host state is instead fetched from the DB. Some left over fields are still kept by the host manager but contain no data. This change remove the last traces of host capabilities from the scheduler. The baremetal host manager used to rely on capabilities info to decide which host state class to use, VM or baremetal. This has been broken since host capabilities were removed (bug 1260265). The logic to decide on host state class to use is updated to use DB data instead and a test is added to verify the same. Change-Id: I350109492c2addf5fdfaadee7cec4784f244e102 Closes-Bug: #1260265
- Loading branch information
Showing
3 changed files
with
60 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright (c) 2014 OpenStack Foundation | ||
# All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
""" | ||
Tests For BaremetalHostManager | ||
""" | ||
import mock | ||
|
||
from nova.scheduler import baremetal_host_manager | ||
from nova.scheduler import host_manager | ||
from nova import test | ||
|
||
|
||
class BaremetalHostManagerTestCase(test.NoDBTestCase): | ||
"""Test case for BaremetalHostManager class.""" | ||
|
||
def setUp(self): | ||
super(BaremetalHostManagerTestCase, self).setUp() | ||
self.host_manager = baremetal_host_manager.BaremetalHostManager() | ||
|
||
@mock.patch.object(baremetal_host_manager.BaremetalNodeState, | ||
'update_from_compute_node') | ||
def test_create_baremetal_node_state(self, update_mock): | ||
compute = {'cpu_info': 'baremetal cpu'} | ||
host_state = self.host_manager.host_state_cls('fake-host', 'fake-node', | ||
compute) | ||
self.assertIs(baremetal_host_manager.BaremetalNodeState, | ||
type(host_state)) | ||
|
||
@mock.patch.object(host_manager.HostState, 'update_from_compute_node') | ||
def test_create_non_baremetal_host_state(self, update_mock): | ||
compute = {'cpu_info': 'other cpu'} | ||
host_state = self.host_manager.host_state_cls('fake-host', 'fake-node', | ||
compute) | ||
self.assertIs(host_manager.HostState, type(host_state)) |