def _setup_driver(self): self.driver = hbsd_fc.HBSDFCDriver( configuration=self.configuration) context = None db = None self.driver.common = hbsd_common.HBSDCommon( self.configuration, self.driver, context, db)
def _setup_driver(self): self.driver = hbsd_fc.HBSDFCDriver(configuration=self.configuration) context = None db = None self.driver.common = hbsd_common.HBSDCommon(self.configuration, self.driver, context, db) self.driver.common.command = hbsd_snm2.HBSDSNM2(self.configuration) self.driver.common.pair_flock = \ self.driver.common.command.set_pair_flock() self.driver.do_setup_status.set()
def test_do_setup(self, brick_get_connector_properties, request): drv = hbsd_fc.HBSDFCDriver(configuration=self.configuration, db=db) self._setup_config() request.side_effect = [ FakeResponse(200, POST_SESSIONS_RESULT), FakeResponse(200, GET_PORTS_RESULT), FakeResponse(200, GET_HOST_WWNS_RESULT) ] drv.do_setup(None) self.assertEqual({CONFIG_MAP['port_id']: CONFIG_MAP['target_wwn']}, drv.common.storage_info['wwns']) self.assertEqual(1, brick_get_connector_properties.call_count) self.assertEqual(3, request.call_count) # stop the Loopingcall within the do_setup treatment self.driver.common.client.keep_session_loop.stop() self.driver.common.client.keep_session_loop.wait()
def _setup_driver(self, brick_get_connector_properties=None, request=None): """Set up the driver environment.""" self.driver = hbsd_fc.HBSDFCDriver(configuration=self.configuration) request.side_effect = [ FakeResponse(200, POST_SESSIONS_RESULT), FakeResponse(200, GET_PORTS_RESULT), FakeResponse(200, GET_HOST_WWNS_RESULT) ] self.driver.do_setup(None) self.driver.check_for_setup_error() self.driver.local_path(None) self.driver.create_export(None, None, None) self.driver.ensure_export(None, None) self.driver.remove_export(None, None) self.driver.create_export_snapshot(None, None, None) self.driver.remove_export_snapshot(None, None) # stop the Loopingcall within the do_setup treatment self.driver.common.client.keep_session_loop.stop()
def test_do_setup_pool_name(self, brick_get_connector_properties, request): """Normal case: Specify a pool name instead of pool id""" drv = hbsd_fc.HBSDFCDriver(configuration=self.configuration, db=db) self._setup_config() tmp_pool = self.configuration.hitachi_pool self.configuration.hitachi_pool = CONFIG_MAP['pool_name'] request.side_effect = [ FakeResponse(200, POST_SESSIONS_RESULT), FakeResponse(200, GET_POOLS_RESULT), FakeResponse(200, GET_PORTS_RESULT), FakeResponse(200, GET_HOST_WWNS_RESULT) ] drv.do_setup(None) self.assertEqual({CONFIG_MAP['port_id']: CONFIG_MAP['target_wwn']}, drv.common.storage_info['wwns']) self.assertEqual(1, brick_get_connector_properties.call_count) self.assertEqual(4, request.call_count) self.configuration.hitachi_pool = tmp_pool # stop the Loopingcall within the do_setup treatment self.driver.common.client.keep_session_loop.stop() self.driver.common.client.keep_session_loop.wait()
def test_do_setup_create_hg(self, brick_get_connector_properties, request): """Normal case: The host group not exists.""" drv = hbsd_fc.HBSDFCDriver(configuration=self.configuration, db=db) self._setup_config() request.side_effect = [ FakeResponse(200, POST_SESSIONS_RESULT), FakeResponse(200, GET_PORTS_RESULT), FakeResponse(200, NOTFOUND_RESULT), FakeResponse(200, NOTFOUND_RESULT), FakeResponse(200, NOTFOUND_RESULT), FakeResponse(202, COMPLETED_SUCCEEDED_RESULT), FakeResponse(202, COMPLETED_SUCCEEDED_RESULT), FakeResponse(202, COMPLETED_SUCCEEDED_RESULT) ] drv.do_setup(None) self.assertEqual({CONFIG_MAP['port_id']: CONFIG_MAP['target_wwn']}, drv.common.storage_info['wwns']) self.assertEqual(1, brick_get_connector_properties.call_count) self.assertEqual(8, request.call_count) # stop the Loopingcall within the do_setup treatment self.driver.common.client.keep_session_loop.stop() self.driver.common.client.keep_session_loop.wait()