Esempio n. 1
0
    def __init__(self, target, iface=None, credentials=None):
        self._target = target

        if iface is None:
            iface = iscsi.IscsiInterface('default')

        self._iface = iface
        self._cred = credentials
Esempio n. 2
0
 def _maybe_connect_iser(self):
     """
     Tries to connect the storage server over iSER.
     This applies if 'iser' is in the configuration option
     'iscsi_default_ifaces'.
     """
     # FIXME: remove this method when iface selection is in higher interface
     try:
         self._iface.initiatorName
     except KeyError:
         ifaces = config.get('irs', 'iscsi_default_ifaces').split(',')
         if 'iser' in ifaces:
             orig_iface = self._iface
             self._iface = iscsi.IscsiInterface('iser')
             try:
                 self._connect_iscsi()
                 self._disconnect_iscsi()
             except:
                 log.warning(
                     "Cannot connect to storage over iSER, using original "
                     "iface %r", orig_iface)
                 self._iface = orig_iface