Adds another validation step when using dynamic allocation

The OneView driver currently allows nodes to use Server Profile
Templates (SPTs) that are marked to use Virtual MACs. This is an issue
because the MAC the machine is going to use will only be specified at
profile application. The driver only works with physical MACs in the
dynamic allocation case. This should be checked in all interfaces'
validations.

Change-Id: I5b779ac58ce096a52876bace77702e828aaac711
Depends-On: I21a1ebfc14ec33c661a1e7c7c1dbdcdcab04f119
Closes-Bug: 1627818
Co-Authored-By: Charlle Daniel <charlledaniel@lsd.ufcg.edu.br>
This commit is contained in:
Stenio Araujo 2016-09-26 19:59:20 +00:00
parent 83b2d563a9
commit acfe366566
4 changed files with 38 additions and 11 deletions

View File

@ -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

View File

@ -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(

View File

@ -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(

View File

@ -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.