Exemplo n.º 1
0
def test_reinstated_last_failed(tmp_monitor):
    devicemapper.multipath_status.out = {
        "uuid-1": [
            PathStatus("8:11", "A"),
            PathStatus("6:66", "F")
        ]
    }
    tmp_monitor.start()
    tmp_monitor.callback.wait()

    assert tmp_monitor.status() == {
        "uuid-1": {
            "failed_paths": ["6:66"],
            "valid_paths": 1
        }
    }

    devicemapper.multipath_status.out = {
        "uuid-1": [
            PathStatus("8:11", "A"),
            PathStatus("6:66", "A")
        ]
    }
    tmp_monitor.callback.resume()
    tmp_monitor.callback.wait()

    assert tmp_monitor.status() == {}
Exemplo n.º 2
0
 def status_before_fail():
     return {
         "uuid-1": [
             PathStatus("8:11", "A"),
             PathStatus("6:66", "F")
         ]
     }
Exemplo n.º 3
0
def test_multiple_mpath(tmp_monitor):

    devicemapper.multipath_status.out = {
        "uuid-1" : [
            PathStatus("8:11", "F"),
            PathStatus("6:66", "A")
        ],
        "uuid-2" : [
            PathStatus("7:12", "A"),
            PathStatus("8:32", "F"),
            PathStatus("12:16", "A")
        ]
    }
    tmp_monitor.start()
    tmp_monitor.callback.wait()

    assert tmp_monitor.status() == {
        "uuid-2": {
            "failed_paths": ["8:32"],
            "valid_paths": 2
        },
        "uuid-1": {
            "failed_paths": ["8:11"],
            "valid_paths": 1
        }
    }
Exemplo n.º 4
0
def test_removed_device(tmp_monitor):
    devicemapper.multipath_status.out = {
        "uuid-1": [
            PathStatus("8:44", "A"),
            PathStatus("8:11", "A"),
            PathStatus("8:32", "F")
        ]
    }
    tmp_monitor.start()
    tmp_monitor.callback.wait()

    assert tmp_monitor.status() == {
        "uuid-1": {
            "failed_paths": ["8:32"],
            "valid_paths": 2
        }
    }

    devicemapper.multipath_status.out = {
        "uuid-1": [
            PathStatus("8:44", "A"),
            PathStatus("8:32", "F")
        ]
    }
    tmp_monitor.callback.resume()
    tmp_monitor.callback.wait()

    assert tmp_monitor.status() == {
        "uuid-1": {
            "failed_paths": ["8:32"],
            "valid_paths": 1
        }
    }
Exemplo n.º 5
0
 def fake_status():
     return {
         'uuid-1': [
             PathStatus('sda', 'F'),
             PathStatus('sdb', 'A'),
             PathStatus('sdc', 'A')
         ]
     }
Exemplo n.º 6
0
 def status_after_fail():
     return {
         "uuid-1": [
             PathStatus("8:11", "A"),
             PathStatus("6:66", "A")
         ],
         "uuid-2": [
             PathStatus("3:34", "F"),
             PathStatus("7:17", "A")
         ]
     }
Exemplo n.º 7
0
def test_dm_status(fake_dmsetup):
    res = devicemapper.multipath_status()
    expected = {
        '360014053d0b83eff3d347c48509fc426': [
            PathStatus('67:16', 'F'),
            PathStatus('65:240', 'A'),
            PathStatus('66:64', 'A')
        ],
        '3600140543cb8d7510d54f058c7b3f7ec': [
            PathStatus('65:224', 'A'),
            PathStatus('65:160', 'A'),
            PathStatus('66:176', 'F')
        ]
    }

    assert res == expected
Exemplo n.º 8
0
def test_dm_status(fake_dmsetup):
    fake_dmsetup.write(DMSETUP_SCRIPT.format(FAKE_DMSETUP_OUTPUT))

    res = devicemapper.multipath_status()
    expected = {
        '360014053d0b83eff3d347c48509fc426': [
            PathStatus('67:16', 'F'),
            PathStatus('65:240', 'A'),
            PathStatus('66:64', 'A')
        ],
        '3600140543cb8d7510d54f058c7b3f7ec': [
            PathStatus('65:224', 'A'),
            PathStatus('65:160', 'A'),
            PathStatus('66:176', 'F')
        ]
    }

    assert res == expected
Exemplo n.º 9
0
def test_dm_status(monkeypatch):
    monkeypatch.setattr(devicemapper, "EXT_DMSETUP", FAKE_DMSETUP)
    monkeypatch.setenv("FAKE_STDOUT", FAKE_DMSETUP + ".status.out")
    monkeypatch.setattr(
        devicemapper, "device_name", lambda major_minor: major_minor)

    res = devicemapper._multipath_status()
    expected = {
        '360014053d0b83eff3d347c48509fc426':
            [
                PathStatus('67:16', 'F'),
                PathStatus('65:240', 'A'),
                PathStatus('66:64', 'A')
            ],
        '3600140543cb8d7510d54f058c7b3f7ec':
            [
                PathStatus('65:224', 'A'),
                PathStatus('65:160', 'A'),
                PathStatus('66:176', 'F')
            ]
    }

    assert res == expected