NetApp cDOT driver autosupport broken

The autosupport functionality of the NetApp cDOT driver is not working
with Python 2.7.12, the default in Xenial. Root cause is a deep copy
of the controller connection context, which includes some SSL context
stuff that doesn't play well with copy.deepcopy. So we can do a shallow
copy instead.

Change-Id: Ia2adc4ce27834e384e6d994fcb012ebf1d97c85c
Closes-Bug: #1621260
This commit is contained in:
Clinton Knight 2016-09-07 18:38:50 -04:00
parent 8328ebde24
commit 91b1d2ce53
3 changed files with 14 additions and 7 deletions

View File

@ -2456,7 +2456,9 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
def send_ems_log_message(self, message_dict):
"""Sends a message to the Data ONTAP EMS log."""
node_client = copy.deepcopy(self)
# NOTE(cknight): Cannot use deepcopy on the connection context
node_client = copy.copy(self)
node_client.connection = copy.copy(self.connection)
node_client.connection.set_timeout(25)
try:

View File

@ -4311,9 +4311,9 @@ class NetAppClientCmodeTestCase(test.TestCase):
def test_send_ems_log_message(self):
# Mock client lest we not be able to see calls on its copy.
self.mock_object(copy,
'deepcopy',
mock.Mock(return_value=self.client))
self.mock_object(
copy, 'copy',
mock.Mock(side_effect=[self.client, self.client.connection]))
self.mock_object(self.client,
'_get_ems_log_destination_vserver',
mock.Mock(return_value=fake.ADMIN_VSERVER_NAME))
@ -4328,9 +4328,9 @@ class NetAppClientCmodeTestCase(test.TestCase):
def test_send_ems_log_message_api_error(self):
# Mock client lest we not be able to see calls on its copy.
self.mock_object(copy,
'deepcopy',
mock.Mock(return_value=self.client))
self.mock_object(
copy, 'copy',
mock.Mock(side_effect=[self.client, self.client.connection]))
self.mock_object(self.client,
'_get_ems_log_destination_vserver',
mock.Mock(return_value=fake.ADMIN_VSERVER_NAME))

View File

@ -0,0 +1,5 @@
---
fixes:
- The NetApp cDOT driver's autosupport reporting
now works on Python 2.7.12 and later.