def __init__(self, mountPoint, objectStorePath):
     self._objectStore = objectstore.ObjectStore(objectStorePath)
     before = disk.dfPercent(mountPoint)
     if self._objectStoreExists():
         self._attemptObjectStoreCleanup()
     logging.info("Disk usage: before cleanup: %(before)s%%, after: %(after)s%%", dict(
         before=before, after=disk.dfPercent(mountPoint)))
     if disk.dfPercent(mountPoint) > self.ALLOWED_DISK_USAGE_PERCENT:
         logging.info("Erasing disk - osmosis cleanup did not help")
         self._eraseEverything(mountPoint)
Beispiel #2
0
 def __init__(self, mountPoint):
     objectStorePath = os.path.join(mountPoint, "var", "lib", "osmosis",
                                    "objectstore")
     self._objectStore = objectstore.ObjectStore(objectStorePath)
     before = disk.dfPercent(mountPoint)
     if self._objectStoreExists():
         self._attemptObjectStoreCleanup()
     logging.info(
         "Disk usage: before cleanup: %(before)s%%, after: %(after)s%%",
         dict(before=before, after=disk.dfPercent(mountPoint)))
     if disk.dfPercent(mountPoint) > self.ALLOWED_DISK_USAGE_PERCENT:
         logging.info("Erasing disk - osmosis cleanup did not help")
         self._eraseEverything(mountPoint)
 def __init__(self, mountPoint, usageUpperThreshold=ALLOWED_DISK_USAGE_PERCENT, isErase=False):
     self._usageUpperThreshold = usageUpperThreshold
     objectStorePath = os.path.join(mountPoint, "var", "lib", "osmosis", "objectstore")
     self._objectStore = objectstore.ObjectStore(objectStorePath)
     before = disk.dfPercent(mountPoint)
     if self._objectStoreExists() and isErase:
         self._attemptObjectStoreCleanup()
     logging.info("Disk usage: before cleanup: %(before)s%%, after: %(after)s%%", dict(
         before=before, after=disk.dfPercent(mountPoint)))
     diskUsage = disk.dfPercent(mountPoint)
     if diskUsage > self._usageUpperThreshold:
         if isErase:
             logging.info("Erasing disk - osmosis cleanup did not help")
             self._eraseEverything(mountPoint)
         else:
             msg = "Disk usage is - %s bigger than the upper threshold - %s" \
                   "and inaugurator was configured not to wipe objectstore" % \
                   (diskUsage, self._usageUpperThreshold)
             raise Exception(msg)
Beispiel #4
0
 def __init__(self,
              mountPoint,
              usageUpperThreshold=ALLOWED_DISK_USAGE_PERCENT,
              isErase=False):
     self._usageUpperThreshold = usageUpperThreshold
     objectStorePath = os.path.join(mountPoint, "var", "lib", "osmosis",
                                    "objectstore")
     self._objectStore = objectstore.ObjectStore(objectStorePath)
     before = disk.dfPercent(mountPoint)
     if self._objectStoreExists() and isErase:
         self._attemptObjectStoreCleanup()
     logging.info(
         "Disk usage: before cleanup: %(before)s%%, after: %(after)s%%",
         dict(before=before, after=disk.dfPercent(mountPoint)))
     diskUsage = disk.dfPercent(mountPoint)
     if diskUsage > self._usageUpperThreshold:
         if isErase:
             logging.info("Erasing disk - osmosis cleanup did not help")
             self._eraseEverything(mountPoint)
         else:
             msg = "Disk usage is - %s bigger than the upper threshold - %s" \
                   "and inaugurator was configured not to wipe objectstore" % \
                   (diskUsage, self._usageUpperThreshold)
             raise Exception(msg)
 def _diskUsage(self):
     return disk.dfPercent(self._objectStore.root())