示例#1
0
def _getSEParameters(seName):
    se = StorageElement(seName, hideExceptions=True)

    pluginsList = se.getPlugins()
    if not pluginsList['OK']:
        gLogger.warn(pluginsList['Message'], "SE: %s" % seName)
        return pluginsList
    pluginsList = pluginsList['Value']
    if 'SRM2' in pluginsList:
        pluginsList.remove('SRM2')
        pluginsList.insert(0, 'SRM2')

    for plugin in pluginsList:
        seParameters = se.getStorageParameters(plugin)
        if seParameters['OK']:
            break

    return seParameters
示例#2
0
def _getSEParameters( seName ):
  se = StorageElement( seName, hideExceptions = True )

  pluginsList = se.getPlugins()
  if not pluginsList['OK']:
    gLogger.warn( pluginsList['Message'], "SE: %s" % seName )
    return pluginsList
  pluginsList = pluginsList['Value']
  if 'SRM2' in pluginsList:
    pluginsList.remove( 'SRM2' )
    pluginsList.insert( 0, 'SRM2' )

  for plugin in pluginsList:
    seParameters = se.getStorageParameters( plugin )
    if seParameters['OK']:
      break

  return seParameters
示例#3
0
def _getSEParameters(seName):
    se = StorageElement(seName, hideExceptions=True)

    pluginsList = se.getPlugins()
    if not pluginsList['OK']:
        gLogger.warn(pluginsList['Message'], "SE: %s" % seName)
        return pluginsList
    pluginsList = pluginsList['Value']
    # Put the srm capable protocol first, but why doing that is a
    # mystery that will eventually need to be sorted out...
    for plugin in ('GFAL2_SRM2', 'SRM2'):
        if plugin in pluginsList:
            pluginsList.remove(plugin)
            pluginsList.insert(0, plugin)

    for plugin in pluginsList:
        seParameters = se.getStorageParameters(plugin)
        if seParameters['OK']:
            break

    return seParameters
示例#4
0
def _getSEParameters( seName ):
  se = StorageElement( seName, hideExceptions = True )

  pluginsList = se.getPlugins()
  if not pluginsList['OK']:
    gLogger.warn( pluginsList['Message'], "SE: %s" % seName )
    return pluginsList
  pluginsList = pluginsList['Value']
  # Put the srm capable protocol first, but why doing that is a
  # mystery that will eventually need to be sorted out...
  for plugin in ( 'GFAL2_SRM2', 'SRM2' ):
    if plugin in pluginsList:
      pluginsList.remove( plugin )
      pluginsList.insert( 0, plugin )

  for plugin in pluginsList:
    seParameters = se.getStorageParameters( plugin )
    if seParameters['OK']:
      break

  return seParameters
示例#5
0
  def __writeSEInfo(xml_doc, xml_site, site, site_tier, site_subtier):
    """ Writes SE information in the XML Document

    """
    def __write_SE_XML(site_se_opts):
      """Sub-function just to populate the XML with the SE values

      """
      site_se_name = site_se_opts.get('Host')
      site_se_flavour = site_se_opts.get('Protocol')
      site_se_path = site_se_opts.get('Path', 'UNDEFINED')
      site_se_endpoint = site_se_opts.get('URLBase')
      mappingSEFlavour = {'srm': 'SRMv2',
                          'root': 'XROOTD', 'http': 'HTTPS'}

      xml_se = xml_append(xml_doc, xml_site, 'service',
                 endpoint=site_se_endpoint,
                 flavour=mappingSEFlavour.get(site_se_flavour, 'UNDEFINED'),
                 hostname=site_se_name,
                 path=site_se_path)

      # ipv6 status of the SE
      i6Status = NagiosTopologyAgent.isHostIPV6(site_se_name)
      i6Comment = ""
      if i6Status == -1:
        i6Comment = "Maybe DIRAC Service, not a valid machine"
      xml_append(xml_doc, xml_se, 'queues', ipv6_status=str(i6Status), ipv6_comment=i6Comment)

    has_grid_elem = True

    real_site_name = site.split(".")[1]
    dmsHelper = DMSHelpers()

    if int(site_tier) in (0, 1):
      dst = dmsHelper.getSEInGroupAtSite('Tier1-DST', real_site_name)
      raw = dmsHelper.getSEInGroupAtSite('Tier1-RAW', real_site_name)
      if not raw['OK']:
        gLogger.error(raw['Message'])
        return False
      raw = raw['Value']
      se_RAW = StorageElement(raw)
      se_plugins_RAW = se_RAW.getPlugins()

    if site_subtier == 'T2-D':
      dst = dmsHelper.getSEInGroupAtSite('Tier2D-DST', real_site_name)

    if not dst['OK']:
      gLogger.error(dst['Message'])
      return False

    dst = dst['Value']
    se_DST = StorageElement(dst)
    se_plugins_DST = se_DST.getPlugins()
    if not se_plugins_DST['OK']:
      gLogger.error(se_plugins_DST['Message'])
      return False

    for protocol in se_plugins_DST['Value']:
      site_se_opts_DST = se_DST.getStorageParameters(protocol)
      if not site_se_opts_DST['OK']:
        gLogger.error(site_se_opts_DST['Message'])
        return False
      site_se_opts_DST = site_se_opts_DST['Value']
      __write_SE_XML(site_se_opts_DST)

      if int(site_tier) in (0, 1):
        if protocol in se_plugins_RAW['Value']:
          site_se_opts_RAW = se_RAW.getStorageParameters(protocol)
          if not site_se_opts_RAW['OK']:
            gLogger.error(site_se_opts_RAW['Message'])
            return has_grid_elem
          site_se_opts_RAW = site_se_opts_RAW['Value']
          # This tests if the DST and RAW StorageElements have the same endpoint.
          # If so it only uses the one already added.
          if site_se_opts_RAW['Host'] != site_se_opts_DST['Host']:
            __write_SE_XML(site_se_opts_RAW)

    return has_grid_elem