]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Merge "IBM Storwize with pool-aware-cinder-scheduler"
authorJenkins <jenkins@review.openstack.org>
Tue, 1 Mar 2016 16:38:10 +0000 (16:38 +0000)
committerGerrit Code Review <review@openstack.org>
Tue, 1 Mar 2016 16:38:10 +0000 (16:38 +0000)
1  2 
cinder/tests/unit/test_storwize_svc.py
cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py

index 9cb4ce1b790994a6102c220577226a10555abdd2,368ff0d24a62773a2edd522a76909cb2f3779c1f..e189528419d72047f088ac52d8dedc2cd33c6521
@@@ -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}
          # 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,