diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index acac70eb52..9eb0c2fd0f 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -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: diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py index cca54d58de..6deb0e6f3a 100644 --- a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py +++ b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py @@ -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)) diff --git a/releasenotes/notes/fixed-netapp-cdot-autosupport-3fabd8ac2e407f70.yaml b/releasenotes/notes/fixed-netapp-cdot-autosupport-3fabd8ac2e407f70.yaml new file mode 100644 index 0000000000..9b9d79cf80 --- /dev/null +++ b/releasenotes/notes/fixed-netapp-cdot-autosupport-3fabd8ac2e407f70.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - The NetApp cDOT driver's autosupport reporting + now works on Python 2.7.12 and later. +