# InActive is used on the CS model, Banned is the equivalent in RSS if read and seOptions.has_key( 'ReadAccess' ): if not seOptions[ 'ReadAccess' ] in [ "InActive", "Banned", "Probing", "Degraded" ]: gLogger.notice( 'Read option for %s is %s, instead of %s' % ( se, seOptions[ 'ReadAccess' ], [ "InActive", "Banned", "Probing", "Degraded" ] ) ) gLogger.notice( 'Try specifying the command switches' ) continue if 'ARCHIVE' in se: gLogger.notice( '%s is not supposed to change Read status to Active' % se ) resR[ 'OK' ] = True else: resR = resourceStatus.setStorageElementStatus( se, 'ReadAccess', 'Active', reason, userName ) if not resR['OK']: gLogger.error( "Failed to update %s read access to Active" % se ) else: gLogger.notice( "Successfully updated %s read access to Active" % se ) readAllowed.append( se ) # InActive is used on the CS model, Banned is the equivalent in RSS if write and seOptions.has_key( 'WriteAccess' ): if not seOptions[ 'WriteAccess' ] in [ "InActive", "Banned", "Probing", "Degraded" ]: gLogger.notice( 'Write option for %s is %s, instead of %s' % ( se, seOptions[ 'WriteAccess' ], [ "InActive", "Banned", "Probing", "Degraded" ] ) ) gLogger.notice( 'Try specifying the command switches' ) continue
for se, seOptions in res['Value'].items(): resW = resC = resR = {'OK': False} # Eventually, we will get rid of the notion of InActive, as we always write Banned. if read and seOptions.has_key('ReadAccess'): if not seOptions['ReadAccess'] in ['Active', 'Degraded', 'Probing']: gLogger.notice('Read option for %s is %s, instead of %s' % (se, seOptions['ReadAccess'], ['Active', 'Degraded', 'Probing'])) gLogger.notice('Try specifying the command switches') else: resR = resourceStatus.setStorageElementStatus( se, 'ReadAccess', 'Banned', reason, userName) #res = csAPI.setOption( "%s/%s/ReadAccess" % ( storageCFGBase, se ), "InActive" ) if not resR['OK']: gLogger.error('Failed to update %s read access to Banned' % se) else: gLogger.notice( 'Successfully updated %s read access to Banned' % se) readBanned.append(se) # Eventually, we will get rid of the notion of InActive, as we always write Banned. if write and seOptions.has_key('WriteAccess'): if not seOptions['WriteAccess'] in ['Active', 'Degraded', 'Probing']: gLogger.notice('Write option for %s is %s, instead of %s' % (se, seOptions['WriteAccess'], ['Active', 'Degraded', 'Probing']))
# InActive is used on the CS model, Banned is the equivalent in RSS for statusType in STATUS_TYPES: if statusFlagDict[statusType]: if seOptions.get(statusType) == "Active": gLogger.notice("%s status of %s is already Active" % (statusType, se)) continue if seOptions.has_key(statusType): if not seOptions[statusType] in ALLOWED_STATUSES: gLogger.notice( "%s option for %s is %s, instead of %s" % (statusType, se, seOptions["ReadAccess"], ALLOWED_STATUSES) ) gLogger.notice("Try specifying the command switches") continue resR = resourceStatus.setStorageElementStatus(se, statusType, "Active", reason, userName) if not resR["OK"]: gLogger.error("Failed to update %s %s to Active" % (se, statusType)) else: gLogger.notice("Successfully updated %s %s to Active" % (se, statusType)) statusAllowedDict[statusType].append(se) if not (resR["OK"] or resW["OK"] or resC["OK"]): DIRAC.exit(-1) totalAllowed = 0 totalAllowedSEs = [] for statusType in STATUS_TYPES: totalAllowed += len(statusAllowedDict[statusType]) totalAllowedSEs += statusAllowedDict[statusType] totalAllowedSEs = list(set(totalAllowedSEs))
reason = 'Forced with dirac-admin-ban-se by %s' % userName for se, seOptions in res[ 'Value' ].items(): resW = resC = resR = { 'OK' : False } # Eventually, we will get rid of the notion of InActive, as we always write Banned. if read and seOptions.has_key( 'Read' ): if not seOptions[ 'Read' ] in [ 'Active', 'Bad' ]: gLogger.notice( 'Read option for %s is %s, instead of %s' % ( se, seOptions[ 'Read' ], [ 'Active', 'Bad' ] ) ) gLogger.notice( 'Try specifying the command switchs' ) continue resR = resourceStatus.setStorageElementStatus( se, 'Read', 'Banned', reason, userName ) #res = csAPI.setOption( "%s/%s/ReadAccess" % ( storageCFGBase, se ), "InActive" ) if not resR['OK']: gLogger.error( 'Failed to update %s read access to Banned' % se ) else: gLogger.notice( 'Successfully updated %s read access to Banned' % se ) readBanned.append( se ) # Eventually, we will get rid of the notion of InActive, as we always write Banned. if write and seOptions.has_key( 'Write' ): if not seOptions[ 'Write' ] in [ 'Active', 'Bad' ]: gLogger.notice( 'Write option for %s is %s, instead of %s' % ( se, seOptions[ 'Write' ], [ 'Active', 'Bad' ] ) ) gLogger.notice( 'Try specifying the command switchs' ) continue
# InActive is used on the CS model, Banned is the equivalent in RSS if read and seOptions.has_key('Read'): if not seOptions['Read'] in ["InActive", "Banned", "Probing"]: gLogger.notice( 'Read option for %s is %s, instead of %s' % (se, seOptions['Read'], ["InActive", "Banned", "Probing"])) gLogger.notice('Try specifying the command switchs') continue if 'ARCHIVE' in se: gLogger.notice( '%s is not supposed to change Read status to Active' % se) continue resR = resourceStatus.setStorageElementStatus(se, 'Read', 'Active', reason, userName) if not resR['OK']: gLogger.error("Failed to update %s read access to Active" % se) else: gLogger.notice("Successfully updated %s read access to Active" % se) readAllowed.append(se) # InActive is used on the CS model, Banned is the equivalent in RSS if write and seOptions.has_key('Write'): if not seOptions['Write'] in ["InActive", "Banned", "Probing"]: gLogger.notice( 'Write option for %s is %s, instead of %s' % (se, seOptions['Write'], ["InActive", "Banned", "Probing"])) gLogger.notice('Try specifying the command switchs')
for se, seOptions in res[ 'Value' ].iteritems(): # InActive is used on the CS model, Banned is the equivalent in RSS for statusType in STATUS_TYPES: if statusFlagDict[statusType]: if seOptions.get( statusType ) == "Active": gLogger.notice( '%s status of %s is already Active' % ( statusType, se ) ) continue if statusType in seOptions: if not seOptions[ statusType ] in ALLOWED_STATUSES: gLogger.notice( '%s option for %s is %s, instead of %s' % ( statusType, se, seOptions[ 'ReadAccess' ], ALLOWED_STATUSES ) ) gLogger.notice( 'Try specifying the command switches' ) else: resR = resourceStatus.setStorageElementStatus( se, statusType, 'Active', reason, userName ) if not resR['OK']: gLogger.fatal( "Failed to update %s %s to Active, exit -" % ( se, statusType ), resR['Message'] ) DIRAC.exit( -1 ) else: gLogger.notice( "Successfully updated %s %s to Active" % ( se, statusType ) ) statusAllowedDict[statusType].append( se ) totalAllowed = 0 totalAllowedSEs = [] for statusType in STATUS_TYPES: totalAllowed += len( statusAllowedDict[statusType] ) totalAllowedSEs += statusAllowedDict[statusType] totalAllowedSEs = list( set( totalAllowedSEs ) ) if not totalAllowed: