コード例 #1
0
 def _discover_initiator():
     if vios_id in _ISCSI_INITIATORS and _ISCSI_INITIATORS[vios_id]:
         return
     else:
         try:
             initiator = hdisk.discover_iscsi_initiator(
                 adapter, vios_id)
             _ISCSI_INITIATORS[vios_id] = initiator
         except (pvm_exc.ISCSIDiscoveryFailed,
                 pvm_exc.JobRequestFailed) as e:
             # TODO(chhagarw): handle differently based on
             # error codes
             LOG.error(e)
コード例 #2
0
ファイル: __init__.py プロジェクト: esberglu/nova-powervm
def get_iscsi_initiator(adapter):
    """Gets the iSCSI initiator.

    This is looked up once at process start up.  Stored in memory thereafter.

    :param adapter: The pypowervm adapter.
    :return: The initiator name.  If the NovaLink is not capable of supporting
             iSCSI, None will be returned.
    """
    global _ISCSI_INITIATOR, _ISCSI_LOOKUP_COMPLETE
    if not _ISCSI_LOOKUP_COMPLETE:
        mgmt_w = partition.get_mgmt_partition(adapter)
        if isinstance(mgmt_w, pvm_vios.VIOS):
            _ISCSI_INITIATOR = hdisk.discover_iscsi_initiator(
                adapter, mgmt_w.uuid).strip()

    _ISCSI_LOOKUP_COMPLETE = True
    return _ISCSI_INITIATOR