Пример #1
0
 def __init__(self, imageUuid, installPath, dstPath, tmpPath):
     self.completed = False
     self.imageUuid = imageUuid
     self.installPath = installPath
     self.dstPath = dstPath  # without 'ceph://'
     self.tmpPath = tmpPath  # where image firstly imported to
     self.expectedSize = 0
     self.downloadedSize = 0
     self.progress = 0
     self.lastError = None
     self.lastOpTime = linux.get_current_timestamp()
Пример #2
0
    def _expunge_oldest_task(self):
        key, ts = '', linux.get_current_timestamp()
        for k in self.tasks:
            task = self.tasks[k]

            if task.is_running():
                continue

            if task.lastOpTime < ts:
                key, ts = k, task.lastOpTime

        if key != '': del (self.tasks[key])
Пример #3
0
    def _expunge_oldest_task(self):
        key, ts = '',  linux.get_current_timestamp()
        for k in self.tasks:
            task = self.tasks[k]

            if task.is_running():
                continue

            if task.lastOpTime < ts:
                key, ts = k, task.lastOpTime

        if key != '': del(self.tasks[key])
Пример #4
0
 def __init__(self, imageUuid, installPath, dstPath, tmpPath):
     self.completed = False
     self.imageUuid = imageUuid
     self.installPath = installPath
     self.dstPath = dstPath # without 'ceph://'
     self.tmpPath = tmpPath # where image firstly imported to
     self.expectedSize = 0
     self.downloadedSize = 0
     self.progress = 0
     self.lastError = None
     self.lastOpTime = linux.get_current_timestamp()
     self.image_format = "raw"
Пример #5
0
 def success(self):
     self.completed = True
     self.progress = 100
     self.lastOpTime = linux.get_current_timestamp()
Пример #6
0
 def fail(self, reason):
     self.completed = True
     self.lastError = reason
     self.lastOpTime = linux.get_current_timestamp()
     logger.info('task failed for %s: %s' % (self.imageUuid, reason))
Пример #7
0
 def success(self):
     self.completed = True
     self.progress = 100
     self.lastOpTime = linux.get_current_timestamp()
Пример #8
0
 def fail(self, reason):
     self.completed = True
     self.lastError = reason
     self.lastOpTime = linux.get_current_timestamp()
     logger.info('task failed for %s: %s' % (self.imageUuid, reason))