Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions hpe3parclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4286,7 +4286,6 @@ def admitRemoteCopyLinks(
cmd = ['admitrcopylink', targetName, source_target_port_pair]
response = self._run(cmd)
if response != []:
response = response[0]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially we were returning only part of the message, now it will return whole message that
we are getting from storeserv

raise exceptions.SSHException(response)
except exceptions.SSHException as ex:
raise exceptions.SSHException(ex)
Expand All @@ -4307,7 +4306,6 @@ def dismissRemoteCopyLinks(
cmd = ['dismissrcopylink', targetName, source_target_port_pair]
response = self._run(cmd)
if response != []:
response = response[0]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

raise exceptions.SSHException(response)
except exceptions.SSHException as ex:
raise exceptions.SSHException(ex)
Expand All @@ -4321,7 +4319,6 @@ def startrCopy(self):
cmd = ['startrcopy']
response = self._run(cmd)
if response != []:
response = response[0]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

raise exceptions.SSHException(response)
except exceptions.SSHException as ex:
raise exceptions.SSHException(ex)
Expand Down Expand Up @@ -4394,7 +4391,6 @@ def admitRemoteCopyTarget(self, targetName, mode, remote_copy_group_name,
try:
response = self._run(cmd)
if response != []:
response = response[0]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

raise exceptions.SSHException(response)
except exceptions.SSHException as ex:
raise exceptions.SSHException(ex)
Expand All @@ -4413,7 +4409,6 @@ def dismissRemoteCopyTarget(self, targetName, remote_copy_group_name):
try:
response = self._run(cmd)
if response != []:
response = response[0]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

raise exceptions.SSHException(response)
except exceptions.SSHException as ex:
raise exceptions.SSHException(ex)
Expand Down
69 changes: 68 additions & 1 deletion test/test_HPE3ParClient_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import time
import unittest
from testconfig import config

import mock
from test import HPE3ParClient_base as hpe3parbase

from hpe3parclient import exceptions
Expand Down Expand Up @@ -45,10 +45,15 @@
SKIP_RCOPY_MESSAGE = ("Only works with flask server.")
SKIP_FLASK_RCOPY_MESSAGE = ("Remote copy is not configured to be tested "
"on live arrays.")
TARGET_NAME = 'testtarget'
SOURCE_PORT = '1:1:1'
TARGET_PORT = '10.10.10.1'
RCOPY_STARTED = 3
RCOPY_STOPPED = 5
FAILOVER_GROUP = 7
RESTORE_GROUP = 10
MODE = 'sync'
VOLUME_PAIR_LIST = [('primary_vol1','secondary_vol1'),('primary_vol2','secondary_vol2')]


def is_live_test():
Expand Down Expand Up @@ -2189,6 +2194,68 @@ def test_25_promote_vcopy_on_rep_vol_with_bad_param(self):

self.printFooter('promote_vcopy_on_rep_vol_with_bad_param')

@mock.patch('hpe3parclient.client.HPE3ParClient._run')
@mock.patch('hpe3parclient.client.HPE3ParClient.getRemoteCopyLink')
def test_admit_rcopy_link(self,mock_get_rcopy_link, mock_run):
self.printHeader('admit_rcopy_link_test')
mock_run.return_value = []
mock_get_rcopy_link.return_value = {'address':'10.10.10.1'}
res = self.cl.admitRemoteCopyLinks(TARGET_NAME, SOURCE_PORT, TARGET_PORT)
self.assertEqual(res, [])
res = self.cl.rcopyLinkExists(TARGET_NAME, SOURCE_PORT, TARGET_PORT)
self.assertEqual(res, True)
self.printFooter('admit_rcopy_link_test')


@mock.patch('hpe3parclient.client.HPE3ParClient._run')
@mock.patch('hpe3parclient.client.HPE3ParClient.getRemoteCopyLink')
def test_dismiss_rcopy_link(self,mock_get_rcopy_link, mock_run):
self.printHeader('dismiss_rcopy_link_test')
mock_run.return_value = []
mock_get_rcopy_link.return_value = {}
res = self.cl.dismissRemoteCopyLinks(TARGET_NAME, SOURCE_PORT, TARGET_PORT)
self.assertEqual(res, [])
res = self.cl.rcopyLinkExists(TARGET_NAME, SOURCE_PORT, TARGET_PORT)
self.assertEqual(res, False)
self.printFooter('dismiss_rcopy_link_test')


@mock.patch('hpe3parclient.client.HPE3ParClient._run')
def test_start_rcopy(self, mock_run):
self.printHeader('start_rcopy_test')
mock_run.return_value = []
res = self.cl.startrCopy()
self.assertEqual(res, [])
mock_run.return_value = ['x','y','Started']
res = self.cl.rcopyServiceExists()
self.assertEqual(res, True)
self.printFooter('start_rcopy_test')


@mock.patch('hpe3parclient.client.HPE3ParClient._run')
@mock.patch('hpe3parclient.client.HPE3ParClient.getRemoteCopyGroup')
def test_admit_rcopy_target(self,mock_target_in_rcg, mock_run):
self.printHeader('admit_rcopy_target_test')
mock_run.return_value = []
res = self.cl.admitRemoteCopyTarget(TARGET_NAME, MODE, REMOTE_COPY_GROUP_NAME1, VOLUME_PAIR_LIST)
self.assertEqual(res, [])
mock_run.return_value = []
res = self.cl.admitRemoteCopyTarget(TARGET_NAME, MODE, REMOTE_COPY_GROUP_NAME1)
self.assertEqual(res, [])
mock_target_in_rcg.return_value = {'targets':[{'target':TARGET_NAME}]}
res = self.cl.targetInRemoteCopyGroupExists(TARGET_NAME, REMOTE_COPY_GROUP_NAME1)
self.assertEqual(res, True)
self.printFooter('admit_rcopy_target_test')


@mock.patch('hpe3parclient.client.HPE3ParClient._run')
@mock.patch('hpe3parclient.client.HPE3ParClient.getRemoteCopyGroup')
def test_dismiss_rcopy_target(self,mock_target_in_rcg, mock_run):
self.printHeader('dismiss_rcopy_target_test')
mock_run.return_value = []
res = self.cl.dismissRemoteCopyTarget(TARGET_NAME, REMOTE_COPY_GROUP_NAME1)
self.assertEqual(res, [])
self.printFooter('dismiss_rcopy_target_test')
# testing
# suite = unittest.TestLoader().
# loadTestsFromTestCase(HPE3ParClientVolumeTestCase)
Expand Down