Beispiel #1
0
    def test__extract_path_groups_details_rhel6_several_path_groups(self, extract_lines):
        extract_lines.return_value = """
        mpathc (200173800fe0000aa) dm-4 IBM,2810XIV
        size=16G features='1 queue_if_no_path' hwhandler='0' wp=rw
        `-+- policy='round-robin 0' prio=1 status=active
        |- 3:0:0:2  sdc 8:32 active faulty running
        `- 4:0:0:2  sde 8:64 active ready running
        `-+- policy='round-robin 0' prio=1 status=active
        |- 5:0:0:2  sdf 8:33 active shaky running
        `- 6:0:0:2  sdg 8:65 active ready running
        """.strip().splitlines()
        ldm = LinuxDeviceMapper()
        expected_results = [
            LinuxPathGroupEntry(
                "active",
                1,
                "round-robin",
                0,
                [LinuxPathEntry("faulty", "active", "sdc"), LinuxPathEntry("ready", "active", "sde")],
            ),
            LinuxPathGroupEntry(
                "active",
                1,
                "round-robin",
                0,
                [LinuxPathEntry("shaky", "active", "sdf"), LinuxPathEntry("ready", "active", "sdg")],
            ),
        ]

        self.assertEqual(expected_results, ldm._extract_path_groups_details("fake_device"))
Beispiel #2
0
    def test__extract_path_groups_details_rhel5_several_path_groups(self, extract_lines):
        extract_lines.return_value = """
        mydev1 (3600a0b800011a1ee0000040646828cc5) dm-1 IBM,1815      FAStT
        [size=512M][features=1 queue_if_no_path][hwhandler=1 rdac]
        \_ round-robin 0 [prio=6][active]
        \_ 29:0:0:1 sdf 8:80  [active][ready]
        \_ 28:0:1:1 sdl 8:176 [active][ready]
        \_ round-robin 0 [prio=1][enabled]
        \_ 28:0:0:1 sdb 8:16  [active][ghost]
        \_ 29:0:1:1 sdq 65:0  [active][ghost]
       """.strip().splitlines()
        ldm = LinuxDeviceMapper()
        expected_results = [
            LinuxPathGroupEntry(
                "active",
                6,
                "round-robin",
                0,
                [LinuxPathEntry("ready", "active", "sdf"), LinuxPathEntry("ready", "active", "sdl")],
            ),
            LinuxPathGroupEntry(
                "enabled",
                1,
                "round-robin",
                0,
                [LinuxPathEntry("ghost", "active", "sdb"), LinuxPathEntry("ghost", "active", "sdq")],
            ),
        ]

        self.assertEqual(expected_results, ldm._extract_path_groups_details("fake_device"))
Beispiel #3
0
 def test_get_multipath_disks_details_rhel5(self, run_cmd_mock):
     run_cmd_mock.return_value = FAKE_MULTIPATH_LIST_RHEL5_OUTPUT
     ldm = LinuxDeviceMapper()
     expected_results = {
         "mydev1": ("3600a0b800011a1ee0000040646828cc5", "IBM,1815", "dm-1", "mydev1"),
         "mpatha": ("200173800fe0000aa", "IBM,1815", "dm-2", "mpatha"),
     }
     self.assertEqual(expected_results, ldm.get_multipath_disks_details())
Beispiel #4
0
 def test_get_multipath_disks_details_rhel6(self, run_cmd_mock):
     run_cmd_mock.return_value = FAKE_MULTIPATH_LIST_RHEL6_OUTPUT
     ldm = LinuxDeviceMapper()
     expected_results = {
         "mpathc": ("200173800fe0000aa", "IBM,2810XIV", "dm-4", "mpathc"),
         "mpatha": ("200173800fdfd12b8", "IBM,2810XIV", "dm-2", "mpatha"),
         "pablodev": ("200173800fe0000a9", "IBM,2810XIV", "dm-3", "pablodev"),
     }
     self.assertEqual(expected_results, ldm.get_multipath_disks_details())
Beispiel #5
0
 def test__extract_relevant_device_lines_from_multipath_multiple_devices_rhel6(self, run_cmd_mock):
     run_cmd_mock.return_value = FAKE_MULTIPATH_LIST_RHEL6_OUTPUT
     ldm = LinuxDeviceMapper()
     expected_result = """
     mpatha (200173800fdfd12b8) dm-2 IBM,2810XIV
     size=16G features='1 queue_if_no_path' hwhandler='0' wp=rw
     `-+- policy='round-robin 0' prio=1 status=active
         `- 5:0:0:77 sdf 8:80 active ready running
     """.strip().splitlines()
     self.assertEqual(
         [l.strip() for l in expected_result], ldm._extract_relevant_device_lines_from_multipath("mpatha")
     )
Beispiel #6
0
 def test__extract_relevant_device_lines_from_multipath_single_device_rhel5(self, run_cmd_mock):
     run_cmd_mock.return_value = FAKE_MULTIPATH_LIST_RHEL5_SINGLE_DEVICE_SEVERAL_PATH_GROUPS_OUTPUT
     ldm = LinuxDeviceMapper()
     expected_result = """mydev1 (3600a0b800011a1ee0000040646828cc5) dm-1 IBM,1815      FAStT
     [size=512M][features=1 queue_if_no_path][hwhandler=1 rdac]
     \_ round-robin 0 [prio=6][active]
      \_ 29:0:0:1 sdf 8:80  [active][ready]
      \_ 28:0:1:1 sdl 8:176 [active][ready]
     \_ round-robin 0 [prio=1][enabled]
      \_ 28:0:0:1 sdb 8:16  [active][ghost]
      \_ 29:0:1:1 sdq 65:0  [active][ghost]
     """.strip().splitlines()
     self.assertEqual(
         [l.strip() for l in expected_result], ldm._extract_relevant_device_lines_from_multipath("mydev1")
     )
Beispiel #7
0
 def test__extract_relevant_device_lines_from_multipath_single_device_rhel6(self, run_cmd_mock):
     run_cmd_mock.return_value = FAKE_MULTIPATH_LIST_RHEL6_SINGLE_DEVICE_SEVERAL_PATH_GROUPS_OUTPUT
     ldm = LinuxDeviceMapper()
     expected_result = """
     mpathc (200173800fe0000aa) dm-4 IBM,2810XIV
     size=16G features='1 queue_if_no_path' hwhandler='0' wp=rw
     `-+- policy='round-robin 0' prio=1 status=active
         |- 3:0:0:2  sdc 8:32 active faulty running
         `- 4:0:0:2  sde 8:64 active ready running
     `-+- policy='round-robin 0' prio=1 status=active
         |- 5:0:0:2  sdf 8:33 active shaky running
         `- 6:0:0:2  sdg 8:65 active ready running
     """.strip().splitlines()
     self.assertEqual(
         [l.strip() for l in expected_result], ldm._extract_relevant_device_lines_from_multipath("mpathc")
     )
Beispiel #8
0
 def test__extract_paths_details_rhel6(self):
     ldm = LinuxDeviceMapper()
     expected_results = LinuxPathEntry("faulty", "active", "sdc")
     self.assertEqual(expected_results, ldm._extract_paths_details("  |- 3:0:0:2  sdc 8:32 active faulty running"))
Beispiel #9
0
 def test__extract_paths_details_rhel5(self):
     ldm = LinuxDeviceMapper()
     expected_results = LinuxPathEntry("ready", "active", "sdf")
     self.assertEqual(expected_results, ldm._extract_paths_details(" \_ 29:0:0:1 sdf 8:80  [active][ready]"))