예제 #1
0
def get_connector_properties(root_helper, my_ip, multipath, enforce_multipath):
    """Get the connection properties for all protocols.

    When the connector wants to use multipath, multipath=True should be
    specified. If enforce_multipath=True is specified too, an exception is
    thrown when multipathd is not running. Otherwise, it falls back to
    multipath=False and only the first path shown up is used.
    For the compatibility reason, even if multipath=False is specified,
    some cinder storage drivers may export the target for multipath, which
    can be found via sendtargets discovery.
    """

    iscsi = ISCSIConnector(root_helper=root_helper)
    fc = linuxfc.LinuxFibreChannel(root_helper=root_helper)

    props = {}
    props['ip'] = my_ip
    props['host'] = socket.gethostname()
    initiator = iscsi.get_initiator()
    if initiator:
        props['initiator'] = initiator
    wwpns = fc.get_fc_wwpns()
    if wwpns:
        props['wwpns'] = wwpns
    wwnns = fc.get_fc_wwnns()
    if wwnns:
        props['wwnns'] = wwnns
    props['multipath'] = (multipath and _check_multipathd_running(
        root_helper, enforce_multipath))
    return props
예제 #2
0
 def __init__(self, root_helper, driver=None,
              execute=putils.execute, use_multipath=False,
              *args, **kwargs):
     self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute)
     self._linuxfc = linuxfc.LinuxFibreChannel(root_helper, execute)
     super(FibreChannelConnector, self).__init__(root_helper, driver,
                                                 execute, *args, **kwargs)
     self.use_multipath = use_multipath
예제 #3
0
 def __init__(self, root_helper, driver=None,
              execute=putils.execute, use_multipath=False,
              device_scan_attempts=DEVICE_SCAN_ATTEMPTS_DEFAULT,
              *args, **kwargs):
     self._linuxscsi = linuxscsi.LinuxSCSI(root_helper, execute)
     self._linuxfc = linuxfc.LinuxFibreChannel(root_helper, execute)
     super(FibreChannelConnector, self).__init__(root_helper, driver=driver,
                                                 execute=execute,
                                                 device_scan_attempts=
                                                 device_scan_attempts,
                                                 *args, **kwargs)
     self.use_multipath = use_multipath
예제 #4
0
def get_connector_properties(root_helper, my_ip):
    """Get the connection properties for all protocols."""

    iscsi = ISCSIConnector(root_helper=root_helper)
    fc = linuxfc.LinuxFibreChannel(root_helper=root_helper)

    props = {}
    props['ip'] = my_ip
    props['host'] = socket.gethostname()
    initiator = iscsi.get_initiator()
    if initiator:
        props['initiator'] = initiator
    wwpns = fc.get_fc_wwpns()
    if wwpns:
        props['wwpns'] = wwpns
    wwnns = fc.get_fc_wwnns()
    if wwnns:
        props['wwnns'] = wwnns

    return props
예제 #5
0
 def setUp(self):
     super(LinuxFCTestCase, self).setUp()
     self.cmds = []
     self.stubs.Set(os.path, 'exists', lambda x: True)
     self.lfc = linuxfc.LinuxFibreChannel(None, execute=self.fake_execute)