From: Jenkins Date: Tue, 1 Mar 2016 16:38:10 +0000 (+0000) Subject: Merge "IBM Storwize with pool-aware-cinder-scheduler" X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ca90a150b8dc9629ae8761278fdc4d81567380eb;p=openstack-build%2Fcinder-build.git Merge "IBM Storwize with pool-aware-cinder-scheduler" --- ca90a150b8dc9629ae8761278fdc4d81567380eb diff --cc cinder/tests/unit/test_storwize_svc.py index 9cb4ce1b7,368ff0d24..e18952841 --- a/cinder/tests/unit/test_storwize_svc.py +++ b/cinder/tests/unit/test_storwize_svc.py @@@ -2527,14 -2561,12 +2563,15 @@@ class StorwizeSVCCommonDriverTestCase(t if self.USESIM: self.driver = StorwizeSVCISCSIFakeDriver( configuration=conf.Configuration(None)) + self._driver = storwize_svc_iscsi.StorwizeSVCISCSIDriver( + configuration=conf.Configuration(None)) self._def_flags = {'san_ip': 'hostname', + 'storwize_san_secondary_ip': 'secondaryname', 'san_login': 'user', 'san_password': 'pass', - 'storwize_svc_volpool_name': 'openstack', + 'storwize_svc_volpool_name': + ['openstack', 'openstack1'], 'storwize_svc_flashcopy_timeout': 20, 'storwize_svc_flashcopy_rate': 49, 'storwize_svc_allow_tenant_qos': True} @@@ -2644,60 -2677,8 +2682,61 @@@ # Finally, check with good parameters self.driver.do_setup(None) + @mock.patch.object(ssh_utils, 'SSHPool') + @mock.patch.object(processutils, 'ssh_execute') + def test_run_ssh_set_up_with_san_ip(self, mock_ssh_execute, mock_ssh_pool): + ssh_cmd = ['svcinfo'] + self._driver._run_ssh(ssh_cmd) + + mock_ssh_pool.assert_called_once_with( + self._driver.configuration.san_ip, + self._driver.configuration.san_ssh_port, + self._driver.configuration.ssh_conn_timeout, + self._driver.configuration.san_login, + password=self._driver.configuration.san_password, + privatekey=self._driver.configuration.san_private_key, + min_size=self._driver.configuration.ssh_min_pool_conn, + max_size=self._driver.configuration.ssh_max_pool_conn) + + @mock.patch.object(ssh_utils, 'SSHPool') + @mock.patch.object(processutils, 'ssh_execute') + def test_run_ssh_set_up_with_secondary_ip(self, mock_ssh_execute, + mock_ssh_pool): + mock_ssh_pool.side_effect = [paramiko.SSHException, mock.MagicMock()] + ssh_cmd = ['svcinfo'] + self._driver._run_ssh(ssh_cmd) + + mock_ssh_pool.assert_called_with( + self._driver.configuration.storwize_san_secondary_ip, + self._driver.configuration.san_ssh_port, + self._driver.configuration.ssh_conn_timeout, + self._driver.configuration.san_login, + password=self._driver.configuration.san_password, + privatekey=self._driver.configuration.san_private_key, + min_size=self._driver.configuration.ssh_min_pool_conn, + max_size=self._driver.configuration.ssh_max_pool_conn) + + @mock.patch.object(ssh_utils, 'SSHPool') + @mock.patch.object(processutils, 'ssh_execute') + def test_run_ssh_fail_to_secondary_ip(self, mock_ssh_execute, + mock_ssh_pool): + mock_ssh_execute.side_effect = [processutils.ProcessExecutionError, + mock.MagicMock()] + ssh_cmd = ['svcinfo'] + self._driver._run_ssh(ssh_cmd) + + mock_ssh_pool.assert_called_with( + self._driver.configuration.storwize_san_secondary_ip, + self._driver.configuration.san_ssh_port, + self._driver.configuration.ssh_conn_timeout, + self._driver.configuration.san_login, + password=self._driver.configuration.san_password, + privatekey=self._driver.configuration.san_private_key, + min_size=self._driver.configuration.ssh_min_pool_conn, + max_size=self._driver.configuration.ssh_max_pool_conn) + def _generate_vol_info(self, vol_name, vol_id): + pool = self._def_flags['storwize_svc_volpool_name'][0] rand_id = six.text_type(random.randint(10000, 99999)) if vol_name: return {'name': 'snap_volume%s' % rand_id,