driver_startup_call_stack = [
mock.call.login('foo1', 'bar2'),
mock.call.getClusterByName('CloudCluster1'),
- ]
-
- driver_startup_ssh = [
mock.call.setSSHOptions(
HPELEFTHAND_SSH_IP,
HPELEFTHAND_USERNAME,
ctxt, cgsnapshot, expected_snaps)
self.assertEqual('deleting', cgsnap['status'])
- @mock.patch('hpelefthandclient.version', "2.0.1")
@mock.patch.object(volume_types, 'get_volume_type')
def test_create_volume_replicated_managed(self, _mock_get_volume_type):
# set up driver with default config
mock_client.assert_has_calls(
self.driver_startup_call_stack +
- self.driver_startup_ssh +
expected)
prov_location = '10.0.1.6:3260,1 iqn.1993-08.org.debian:01:222 0'
rep_data = json.dumps({"location": HPELEFTHAND_API_URL})
'provider_location': prov_location},
return_model)
- @mock.patch('hpelefthandclient.version', "2.0.1")
@mock.patch.object(volume_types, 'get_volume_type')
def test_create_volume_replicated_unmanaged(self, _mock_get_volume_type):
# set up driver with default config
mock_client.assert_has_calls(
self.driver_startup_call_stack +
- self.driver_startup_ssh +
expected)
prov_location = '10.0.1.6:3260,1 iqn.1993-08.org.debian:01:222 0'
rep_data = json.dumps({"location": HPELEFTHAND_API_URL})
'provider_location': prov_location},
return_model)
- @mock.patch('hpelefthandclient.version', "2.0.1")
@mock.patch.object(volume_types, 'get_volume_type')
def test_delete_volume_replicated(self, _mock_get_volume_type):
# set up driver with default config
mock.call.deleteVolume(1)]
mock_client.assert_has_calls(
self.driver_startup_call_stack +
- self.driver_startup_ssh +
expected)
- @mock.patch('hpelefthandclient.version', "2.0.1")
@mock.patch.object(volume_types, 'get_volume_type')
def test_replication_enable_no_snapshot_schedule(self,
_mock_get_volume_type):
'bar2')]
mock_client.assert_has_calls(
self.driver_startup_call_stack +
- self.driver_startup_ssh +
expected)
self.assertEqual({'replication_status': 'enabled'},
return_model)
- @mock.patch('hpelefthandclient.version', "2.0.1")
@mock.patch.object(volume_types, 'get_volume_type')
def test_replication_enable_with_snapshot_schedule(self,
_mock_get_volume_type):
'fakevolume_replicated_SCHED_Pri')]
mock_client.assert_has_calls(
self.driver_startup_call_stack +
- self.driver_startup_ssh +
expected)
self.assertEqual({'replication_status': 'enabled'},
return_model)
- @mock.patch('hpelefthandclient.version', "2.0.1")
@mock.patch.object(volume_types, 'get_volume_type')
def test_replication_disable(self, _mock_get_volume_type):
# set up driver with default config
'fakevolume_replicated_SCHED_Pri')]
mock_client.assert_has_calls(
self.driver_startup_call_stack +
- self.driver_startup_ssh +
expected)
self.assertEqual({'replication_status': 'disabled'},
return_model)
- @mock.patch('hpelefthandclient.version', "2.0.1")
@mock.patch.object(volume_types, 'get_volume_type')
def test_replication_disable_fail(self, _mock_get_volume_type):
# set up driver with default config
'fakevolume_replicated_SCHED_Pri')]
mock_client.assert_has_calls(
self.driver_startup_call_stack +
- self.driver_startup_ssh +
expected)
self.assertEqual({'replication_status': 'disable_failed'},
return_model)
- @mock.patch('hpelefthandclient.version', "2.0.1")
@mock.patch.object(volume_types, 'get_volume_type')
def test_list_replication_targets(self, _mock_get_volume_type):
# set up driver with default config
'targets': targets},
return_model)
- @mock.patch('hpelefthandclient.version', "2.0.1")
@mock.patch.object(volume_types, 'get_volume_type')
def test_replication_failover_managed(self, _mock_get_volume_type):
ctxt = context.get_admin_context()
'host': FAKE_FAILOVER_HOST},
return_model)
- @mock.patch('hpelefthandclient.version', "2.0.1")
@mock.patch.object(volume_types, 'get_volume_type')
def test_replication_failover_unmanaged(self, _mock_get_volume_type):
ctxt = context.get_admin_context()
CONF.register_opts(hpelefthand_opts)
MIN_API_VERSION = "1.1"
-MIN_CLIENT_VERSION = '2.0.0'
-MIN_REP_CLIENT_VERSION = '2.0.1'
+MIN_CLIENT_VERSION = '2.1.0'
# map the extra spec key to the REST client option key
extra_specs_key_map = {
2.0.2 - Adds v2 managed replication support
2.0.3 - Adds v2 unmanaged replication support
2.0.4 - Add manage/unmanage snapshot support
+ 2.0.5 - Changed minimum client version to be 2.1.0
"""
- VERSION = "2.0.4"
+ VERSION = "2.0.5"
device_stats = {}
virtual_ips = cluster_info['virtualIPAddresses']
self.cluster_vip = virtual_ips[0]['ipV4Address']
- # SSH is only available in the 2.0.1 release of the
- # python-lefthandclient.
- if hpelefthandclient.version >= MIN_REP_CLIENT_VERSION:
- # Extract IP address from API URL
- ssh_ip = self._extract_ip_from_url(
- self._client_conf['hpelefthand_api_url'])
- known_hosts_file = CONF.ssh_hosts_key_file
- policy = "AutoAddPolicy"
- if CONF.strict_ssh_host_key_policy:
- policy = "RejectPolicy"
- client.setSSHOptions(
- ssh_ip,
- self._client_conf['hpelefthand_username'],
- self._client_conf['hpelefthand_password'],
- port=self._client_conf['hpelefthand_ssh_port'],
- conn_timeout=self._client_conf['ssh_conn_timeout'],
- privatekey=self._client_conf['san_private_key'],
- missing_key_policy=policy,
- known_hosts_file=known_hosts_file)
+ # Extract IP address from API URL
+ ssh_ip = self._extract_ip_from_url(
+ self._client_conf['hpelefthand_api_url'])
+ known_hosts_file = CONF.ssh_hosts_key_file
+ policy = "AutoAddPolicy"
+ if CONF.strict_ssh_host_key_policy:
+ policy = "RejectPolicy"
+ client.setSSHOptions(
+ ssh_ip,
+ self._client_conf['hpelefthand_username'],
+ self._client_conf['hpelefthand_password'],
+ port=self._client_conf['hpelefthand_ssh_port'],
+ conn_timeout=self._client_conf['ssh_conn_timeout'],
+ privatekey=self._client_conf['san_private_key'],
+ missing_key_policy=policy,
+ known_hosts_file=known_hosts_file)
return client
except hpeexceptions.HTTPNotFound:
# Timeout is only supported in version 2.0.1 and greater of the
# python-lefthandclient.
hpelefthand_api_url = self._client_conf['hpelefthand_api_url']
- if hpelefthandclient.version >= MIN_REP_CLIENT_VERSION:
- client = hpe_lh_client.HPELeftHandClient(
- hpelefthand_api_url, timeout=timeout)
- else:
- client = hpe_lh_client.HPELeftHandClient(hpelefthand_api_url)
+ client = hpe_lh_client.HPELeftHandClient(
+ hpelefthand_api_url, timeout=timeout)
return client
def _create_replication_client(self, remote_array):
LOG.error(ex_msg)
raise exception.InvalidInput(reason=ex_msg)
- # v2 replication check
- if hpelefthandclient.version >= MIN_REP_CLIENT_VERSION:
- self._do_replication_setup()
+ self._do_replication_setup()
def check_for_setup_error(self):
"""Checks for incorrect LeftHand API being used on backend."""
data['filter_function'] = self.get_filter_function()
data['goodness_function'] = self.get_goodness_function()
data['consistencygroup_support'] = True
-
- if hpelefthandclient.version >= MIN_REP_CLIENT_VERSION:
- data['replication_enabled'] = self._replication_enabled
- data['replication_type'] = ['periodic']
- data['replication_count'] = len(self._replication_targets)
+ data['replication_enabled'] = self._replication_enabled
+ data['replication_type'] = ['periodic']
+ data['replication_count'] = len(self._replication_targets)
self.device_stats = data