diff --git a/src/DIRAC/Resources/Storage/StorageElement.py b/src/DIRAC/Resources/Storage/StorageElement.py index 6ac1003ea28..621d58a2ab6 100755 --- a/src/DIRAC/Resources/Storage/StorageElement.py +++ b/src/DIRAC/Resources/Storage/StorageElement.py @@ -438,10 +438,6 @@ def getOccupancy(self, unit="MB", **kwargs): kwargs["occupancyLFN"] = occupancyLFN - filteredPlugins = self.__filterPlugins("getOccupancy") - if not filteredPlugins: - return S_ERROR(errno.EPROTONOSUPPORT, "No storage plugins to query the occupancy") - # Call occupancy plugin if requested occupancyPlugin = self.options.get("OccupancyPlugin") if occupancyPlugin: @@ -459,6 +455,10 @@ def getOccupancy(self, unit="MB", **kwargs): except Exception as e: return S_ERROR(f"Occupancy plugin failed: {str(e)}") + filteredPlugins = self.__filterPlugins("getOccupancy") + if not filteredPlugins: + return S_ERROR(errno.EPROTONOSUPPORT, "No storage plugins to query the occupancy") + # Try all of the storages one by one for storage in filteredPlugins: # The result of the plugin is always in B