コード例 #1
0
 def test_do_setup_create_hg(self, brick_get_connector_properties, request):
     """Normal case: The host group not exists."""
     drv = hbsd_iscsi.HBSDISCSIDriver(configuration=self.configuration)
     self._setup_config()
     request.side_effect = [
         FakeResponse(200, POST_SESSIONS_RESULT),
         FakeResponse(200, GET_PORTS_RESULT),
         FakeResponse(200, GET_PORT_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']: '%(ip)s:%(port)s' % {
                 'ip': CONFIG_MAP['ipv4Address'],
                 'port': CONFIG_MAP['tcpPort']
             }
         }, drv.common.storage_info['portals'])
     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()
コード例 #2
0
 def _setup_driver(self):
     self.driver = hbsd_iscsi.HBSDISCSIDriver(
         configuration=self.configuration)
     context = None
     db = None
     self.driver.common = hbsd_common.HBSDCommon(
         self.configuration, self.driver, context, db)
コード例 #3
0
 def _setup_driver(self):
     self.driver = hbsd_iscsi.HBSDISCSIDriver(
         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.horcmgr_flock = \
         self.driver.common.command.set_horcmgr_flock()
コード例 #4
0
 def _setup_driver(self, brick_get_connector_properties=None, request=None):
     """Set up the driver environment."""
     self.driver = hbsd_iscsi.HBSDISCSIDriver(
         configuration=self.configuration)
     request.side_effect = [
         FakeResponse(200, POST_SESSIONS_RESULT),
         FakeResponse(200, GET_PORTS_RESULT),
         FakeResponse(200, GET_PORT_RESULT),
         FakeResponse(200, GET_HOST_ISCSIS_RESULT),
         FakeResponse(200, GET_HOST_GROUP_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()
コード例 #5
0
 def test_do_setup(self, brick_get_connector_properties, request):
     drv = hbsd_iscsi.HBSDISCSIDriver(configuration=self.configuration)
     self._setup_config()
     request.side_effect = [
         FakeResponse(200, POST_SESSIONS_RESULT),
         FakeResponse(200, GET_PORTS_RESULT),
         FakeResponse(200, GET_PORT_RESULT),
         FakeResponse(200, GET_HOST_ISCSIS_RESULT),
         FakeResponse(200, GET_HOST_GROUP_RESULT)
     ]
     drv.do_setup(None)
     self.assertEqual(
         {
             CONFIG_MAP['port_id']: '%(ip)s:%(port)s' % {
                 'ip': CONFIG_MAP['ipv4Address'],
                 'port': CONFIG_MAP['tcpPort']
             }
         }, drv.common.storage_info['portals'])
     self.assertEqual(1, brick_get_connector_properties.call_count)
     self.assertEqual(5, 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()