diff --git a/driver-requirements.txt b/driver-requirements.txt index b5a418fdc7..8e931be0bf 100644 --- a/driver-requirements.txt +++ b/driver-requirements.txt @@ -8,7 +8,7 @@ proliantutils>=2.1.11 pyghmi>=0.8.0 pysnmp python-ironic-inspector-client>=1.5.0 -python-oneviewclient<3.0.0,>=2.5.1 +python-oneviewclient<3.0.0,>=2.5.2 python-scciclient>=0.4.0 python-seamicroclient>=0.4.0 UcsSdk==0.8.2.2 diff --git a/ironic/drivers/modules/oneview/common.py b/ironic/drivers/modules/oneview/common.py index 736d6c9d48..912a29709a 100644 --- a/ironic/drivers/modules/oneview/common.py +++ b/ironic/drivers/modules/oneview/common.py @@ -26,6 +26,7 @@ from ironic.drivers import utils LOG = logging.getLogger(__name__) client = importutils.try_import('oneview_client.client') +oneview_utils = importutils.try_import('oneview_client.utils') oneview_states = importutils.try_import('oneview_client.states') oneview_exceptions = importutils.try_import('oneview_client.exceptions') @@ -166,6 +167,10 @@ def validate_oneview_resources_compatibility(oneview_client, task): oneview_info = get_oneview_info(task.node) try: + spt_uuid = oneview_utils.get_uuid_from_uri( + oneview_info.get("server_profile_template_uri") + ) + oneview_client.validate_node_server_profile_template(oneview_info) oneview_client.validate_node_server_hardware_type(oneview_info) oneview_client.validate_node_enclosure_group(oneview_info) @@ -176,11 +181,15 @@ def validate_oneview_resources_compatibility(oneview_client, task): ) # NOTE(thiagop): Support to pre-allocation will be dropped in the Pike - # release + # release. + # NOTE(mrtenio): The Server Profile Template needs to have a physical + # MAC when using dynamic_allocation. This will be the default behavior + # in the Pike Release. if is_dynamic_allocation_enabled(task.node): oneview_client.is_node_port_mac_compatible_with_server_hardware( oneview_info, node_ports ) + oneview_client.validate_server_profile_template_mac_type(spt_uuid) else: oneview_client.check_server_profile_is_applied(oneview_info) oneview_client.is_node_port_mac_compatible_with_server_profile( diff --git a/ironic/tests/unit/drivers/modules/oneview/test_common.py b/ironic/tests/unit/drivers/modules/oneview/test_common.py index 5f0c9de7e4..71d6a8c17c 100644 --- a/ironic/tests/unit/drivers/modules/oneview/test_common.py +++ b/ironic/tests/unit/drivers/modules/oneview/test_common.py @@ -238,6 +238,8 @@ class OneViewCommonTestCase(db_base.DbTestCase): with task_manager.acquire(self.context, self.node.uuid) as task: common.validate_oneview_resources_compatibility(oneview_client, task) + self.assertTrue( + oneview_client.validate_node_server_hardware.called) self.assertTrue( oneview_client.validate_node_server_hardware_type.called) self.assertTrue( @@ -254,6 +256,9 @@ class OneViewCommonTestCase(db_base.DbTestCase): is_node_port_mac_compatible_with_server_hardware.called) self.assertFalse( oneview_client.validate_spt_primary_boot_connection.called) + self.assertFalse( + oneview_client. + validate_server_profile_template_mac_type.called) @mock.patch.object(common, 'get_oneview_client', spec_set=True, autospec=True) @@ -263,14 +268,15 @@ class OneViewCommonTestCase(db_base.DbTestCase): """Validate compatibility of resources for Dynamic Allocation model. 1) Set 'dynamic_allocation' flag as True on node's driver_info - 2) Check validate_node_server_hardware_type method is called - 3) Check validate_node_enclosure_group method is called - 4) Check validate_node_server_profile_template method is called - 5) Check is_node_port_mac_compatible_with_server_hardware method + 2) Check validate_node_server_profile_template method is called + 3) Check validate_node_server_hardware_type method is called + 4) Check validate_node_enclosure_group method is called + 5) Check validate_node_server_hardware method is called + 6) Check is_node_port_mac_compatible_with_server_hardware method is called - 6) Check validate_node_server_profile_template method is called - 7) Check check_server_profile_is_applied method is not called - 8) Check is_node_port_mac_compatible_with_server_profile method is + 7) Check validate_server_profile_template_mac_type method is called + 8) Check check_server_profile_is_applied method is not called + 9) Check is_node_port_mac_compatible_with_server_profile method is not called """ @@ -282,17 +288,20 @@ class OneViewCommonTestCase(db_base.DbTestCase): common.validate_oneview_resources_compatibility(oneview_client, task) + self.assertTrue( + oneview_client.validate_node_server_profile_template.called) self.assertTrue( oneview_client.validate_node_server_hardware_type.called) self.assertTrue( oneview_client.validate_node_enclosure_group.called) self.assertTrue( - oneview_client.validate_node_server_profile_template.called) + oneview_client.validate_node_server_hardware.called) self.assertTrue( oneview_client. is_node_port_mac_compatible_with_server_hardware.called) self.assertTrue( - oneview_client.validate_node_server_profile_template.called) + oneview_client. + validate_server_profile_template_mac_type.called) self.assertFalse( oneview_client.check_server_profile_is_applied.called) self.assertFalse( diff --git a/releasenotes/notes/dynamic-allocation-spt-has-physical-mac-8967a1d926ed9301.yaml b/releasenotes/notes/dynamic-allocation-spt-has-physical-mac-8967a1d926ed9301.yaml new file mode 100644 index 0000000000..c28b834dd3 --- /dev/null +++ b/releasenotes/notes/dynamic-allocation-spt-has-physical-mac-8967a1d926ed9301.yaml @@ -0,0 +1,9 @@ +--- +upgrade: + - Minimum required version of python-oneviewclient bumped to 2.5.2 +fixes: + - A validation step is added to verify that the Server Profile + Template's MAC type is set to Physical when dynamic allocation + is enabled. The OneView Driver needs this verification + because the machine is going to use a MAC that will only be + specified at the profile application.