示例#1
0
文件: task.py 项目: drivnal/drivnal
    def __init__(self, id=None, volume=None, snapshot=None):
        DatabaseObject.__init__(self)

        if id is None:
            self.id = uuid.uuid4().hex
            # Transfer the class attribute to the database
            self.type = self.type
            self.state = None
            self.time = None
            self.volume_id = None
            _task_threads[self.id] = None

        else:
            self.id = id

        if volume is None:
            self.volume = None
        else:
            self.volume_id = volume.id
            self.volume = volume

        if snapshot is not None:
            self.snapshot_id = snapshot.id
            self.snapshot = snapshot

        self.update()
示例#2
0
    def __init__(self, id=None, type=None, resource_id=None):
        DatabaseObject.__init__(self)

        if id is None:
            self.id = uuid.uuid4().hex
            self.type = type
            self.resource_id = resource_id
            self.time = int(time.time() * 1000)
        else:
            self.id = id
示例#3
0
    def __init__(self, id=None, type=None, message=None):
        DatabaseObject.__init__(self)

        if id is None:
            self.id = uuid.uuid4().hex
            self.type = type or INFO
            self.time = int(time.time())
            self.message = message
            Event(type=LOG_UPDATED)
        else:
            self.id = id
示例#4
0
文件: event.py 项目: drivnal/drivnal
    def __init__(self, id=None, volume_id=None, type=None):
        DatabaseObject.__init__(self)

        if id is None:
            self.id = uuid.uuid4().hex
            self.type = type
            self.time = int(time.time() * 1000)
            self.volume_id = None
        else:
            self.id = id

        if volume_id is not None:
            self.volume_id = volume_id