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()
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])
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])
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"
def success(self): self.completed = True self.progress = 100 self.lastOpTime = linux.get_current_timestamp()
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))