Remove old validations of memory_mb before manage state

This patch serves to correct the problem presented in UFCG OneView CI,
in which the node was being created and changed the state to manageable,
and only validate the memory_mb after that.

Change-Id: Id0ef20b320a622da6990f6ffaf26256059582743
This commit is contained in:
Fellype Cavalcante 2017-08-22 14:52:57 -03:00
parent 69c43a41b8
commit 000809f779
2 changed files with 2 additions and 63 deletions
oneview_client

@ -706,15 +706,8 @@ class Client(BaseClient):
def validate_node_server_hardware(
self, node_info, node_memorymb, node_cpus
):
node_sh_uri = node_info.get('server_hardware_uri')
server_hardware = self.get_server_hardware(node_info)
if str(server_hardware.memory_mb) != str(node_memorymb):
message = (
"Node memory_mb is inconsistent with OneView's"
" server hardware %(server_hardware_uri)s memoryMb."
% {'server_hardware_uri': node_sh_uri}
)
raise exceptions.OneViewInconsistentResource(message)
# NOTE(fellypefca): This is temporary to fix the problems of CI.
pass
@auditing.audit
def validate_node_server_hardware_type(self, node_info):

@ -601,37 +601,6 @@ class OneViewClientTestCase(unittest.TestCase):
with self.assertRaises(exceptions.OneViewInconsistentResource):
self.oneview_client._validate_connection_mac(driver_info, ports)
@mock.patch.object(client.Client, 'get_server_hardware', autospec=True)
def test_validate_node_server_hardware_inconsistent_memorymb_value(
self, mock_get_server_hardware
):
server_hardware_mock = models.ServerHardware()
setattr(server_hardware_mock, "processor_core_count", 1)
setattr(server_hardware_mock, "processor_count", 1)
setattr(server_hardware_mock, "memory_mb", 1)
mock_get_server_hardware.return_value = server_hardware_mock
driver_info = {
"server_hardware_uri": "/any_uri",
}
node_memorymb = 2
node_cpus = 1
exc_expected_msg = (
"Node memory_mb is inconsistent with OneView's server"
" hardware /any_uri memoryMb."
)
self.assertRaisesRegexp(
exceptions.OneViewInconsistentResource,
exc_expected_msg,
self.oneview_client.validate_node_server_hardware,
driver_info,
node_memorymb,
node_cpus
)
@mock.patch.object(client.Client, 'get_server_hardware', autospec=True)
def test_validate_node_server_hardware_type_inconsistent_sht_uri(
self, mock_get_server_hardware
@ -686,29 +655,6 @@ class OneViewClientTestCase(unittest.TestCase):
driver_info
)
@mock.patch.object(client.Client, 'get_server_hardware', autospec=True)
def test_validate_node_server_hardware_values_as_string(
self, mock_get_server_hardware
):
server_hardware_mock = models.ServerHardware()
setattr(server_hardware_mock, "processor_core_count", 2)
setattr(server_hardware_mock, "processor_count", 3)
setattr(server_hardware_mock, "memory_mb", 1)
mock_get_server_hardware.return_value = server_hardware_mock
driver_info = {
"server_hardware_uri": "/any_uri",
"enclosure_group_uri": "/inconsistent_uri"
}
node_memorymb = '1'
node_cpus = '6'
self.assertIsNone(
self.oneview_client.validate_node_server_hardware(
driver_info, node_memorymb, node_cpus)
)
@mock.patch.object(client.Client, 'get_server_hardware_by_uuid',
autospec=True)
@mock.patch.object(client.Client, 'get_server_hardware',