예제 #1
0
파일: vmstorage_test.py 프로젝트: nirs/vdsm
    def test_block_threshold_stale_path(self):
        conf = drive_config(diskType=DISK_TYPE.BLOCK, path='/new/path')
        drive = Drive(self.log, **conf)
        drive.threshold_state = BLOCK_THRESHOLD.SET

        drive.on_block_threshold('/old/path')
        self.assertEqual(drive.threshold_state, BLOCK_THRESHOLD.SET)
예제 #2
0
    def test_block_threshold_stale_path(self):
        conf = drive_config(diskType=DISK_TYPE.BLOCK, path='/new/path')
        drive = Drive(self.log, **conf)
        drive.threshold_state = BLOCK_THRESHOLD.SET

        drive.on_block_threshold('/old/path')
        assert drive.threshold_state == BLOCK_THRESHOLD.SET
예제 #3
0
파일: vmstorage_test.py 프로젝트: nirs/vdsm
    def test_block_threshold_set_state(self):
        path = '/old/path'
        conf = drive_config(diskType=DISK_TYPE.BLOCK, path=path)
        drive = Drive(self.log, **conf)
        drive.threshold_state = BLOCK_THRESHOLD.SET

        drive.on_block_threshold(path)
        self.assertEqual(drive.threshold_state, BLOCK_THRESHOLD.EXCEEDED)
예제 #4
0
    def test_block_threshold_set_state(self):
        path = '/old/path'
        conf = drive_config(diskType=DISK_TYPE.BLOCK, path=path)
        drive = Drive(self.log, **conf)
        drive.threshold_state = BLOCK_THRESHOLD.SET

        drive.on_block_threshold(path)
        assert drive.threshold_state == BLOCK_THRESHOLD.EXCEEDED
예제 #5
0
def test_drive_exceeded_time(monkeypatch):
    conf = drive_config(diskType=DISK_TYPE.BLOCK, path="/path")
    drive = Drive(log, **conf)

    # Exceeded time not set yet.
    assert drive.exceeded_time is None

    # Setting threshold state does not set exceeded time.
    drive.threshold_state = BLOCK_THRESHOLD.SET
    assert drive.exceeded_time is None

    # Getting threshold event sets exceeded time.
    monkeypatch.setattr(time, "monotonic_time", lambda: 123.0)
    drive.on_block_threshold("/path")
    assert drive.exceeded_time == 123.0

    # Changing threshold clears exceeded time.
    drive.threshold_state = BLOCK_THRESHOLD.SET
    assert drive.exceeded_time is None