context.get_admin_context(),
[volume],
'default')
+
+ def test__create_replication_client(self):
+ # set up driver with default config
+ self.setup_driver()
+
+ # Ensure creating a replication client works without specifiying
+ # ssh_conn_timeout or san_private_key.
+ remote_array = {
+ 'hpelefthand_api_url': 'https://1.1.1.1:8080/lhos',
+ 'hpelefthand_username': 'user',
+ 'hpelefthand_password': 'password',
+ 'hpelefthand_ssh_port': '16022'}
+ cl = self.driver._create_replication_client(remote_array)
+ cl.setSSHOptions.assert_called_with(
+ '1.1.1.1',
+ 'user',
+ 'password',
+ conn_timeout=30,
+ known_hosts_file=mock.ANY,
+ missing_key_policy='AutoAddPolicy',
+ port='16022',
+ privatekey='')
+
+ # Verify we can create a replication client with custom values for
+ # ssh_conn_timeout and san_private_key.
+ cl.reset_mock()
+ remote_array['ssh_conn_timeout'] = 45
+ remote_array['san_private_key'] = 'foobarkey'
+ cl = self.driver._create_replication_client(remote_array)
+ cl.setSSHOptions.assert_called_with(
+ '1.1.1.1',
+ 'user',
+ 'password',
+ conn_timeout=45,
+ known_hosts_file=mock.ANY,
+ missing_key_policy='AutoAddPolicy',
+ port='16022',
+ privatekey='foobarkey')
2.0.5 - Changed minimum client version to be 2.1.0
2.0.6 - Update replication to version 2.1
2.0.7 - Fixed bug #1554746, Create clone volume with new size.
+ 2.0.8 - Add defaults for creating a replication client, bug #1556331
"""
- VERSION = "2.0.7"
+ VERSION = "2.0.8"
device_stats = {}
remote_array['hpelefthand_username'],
remote_array['hpelefthand_password'])
+ ssh_conn_timeout = remote_array.get('ssh_conn_timeout', 30)
+ san_private_key = remote_array.get('san_private_key', '')
+
# Extract IP address from API URL
ssh_ip = self._extract_ip_from_url(
remote_array['hpelefthand_api_url'])
remote_array['hpelefthand_username'],
remote_array['hpelefthand_password'],
port=remote_array['hpelefthand_ssh_port'],
- conn_timeout=remote_array['ssh_conn_timeout'],
- privatekey=remote_array['san_private_key'],
+ conn_timeout=ssh_conn_timeout,
+ privatekey=san_private_key,
missing_key_policy=policy,
known_hosts_file=known_hosts_file)
raise exception.InvalidReplicationTarget(reason=msg)
target_id = failover_target['backend_id']
- self._active_backend_id = target_id
volume_update_list = []
for volume in volumes:
if self._volume_of_replicated_type(volume):
cl = None
try:
cl = self._create_replication_client(failover_target)
- # Make the volume primary so it can be attached after a
- # fail-over.
- cl.makeVolumePrimary(volume['name'])
# Stop snapshot schedule
try:
name = volume['name'] + (
{'volume_id': volume['id'],
'updates': {'status': 'error'}})
+ self._active_backend_id = target_id
+
return target_id, volume_update_list
def _do_replication_setup(self):