示例#1
0
 def test_that_volume_group_is_child_of_physical_volume(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" "))]
     self.sysinfo.objects += [LvmPhysicalVolume("/dev/sda 1000".split(" "))]
     self.sysinfo.objects += [LvmVolumeGroup(["group", "1000", ["/dev/sda"], "0"])]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[2])
     self.assertListEquivalent([self.sysinfo.objects[1]], tails)
示例#2
0
 def test_that_partition_is_associated_with_right_disk(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" ")),
                              Partition("8 16 1000 sdb".split(" ")),
                              Partition("8 1 1000 sda1".split(" "))]
     dg = DiskGraph(self.sysinfo)
     visited = [x.name for x in list(dg.visit(dg.root))]
     self.assertEqual(["root", "sda", "sda1", "sdb"], visited)
示例#3
0
 def test_that_volume_can_be_child_of_partition(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" ")),
                              Partition("8 1 1000 sda1".split(" "))]
     self.sysinfo.objects += [LvmPhysicalVolume("/dev/sda1 1000".split(" "))]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[2])
     self.assertListEquivalent([self.sysinfo.objects[1]], tails)
示例#4
0
 def test_that_volume_can_be_child_of_raid_array(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" ")),
                              Partition("8 1 1000 sda1".split(" "))]
     self.sysinfo.objects += [RaidArray(("md0 sda1".split(" "), 1000))]
     self.sysinfo.objects += [LvmPhysicalVolume("/dev/md0 1000".split(" "))]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[3])
     self.assertListEquivalent(self.are(RaidArray), tails)
示例#5
0
 def test_graph_with_single_disk_and_partition(self):
     self.sysinfo.objects += [
         Partition("8 0 1000 sda".split(" ")),
         Partition("8 1 1000 sda1".split(" "))
     ]
     dg = DiskGraph(self.sysinfo)
     visited = [x.name for x in list(dg.visit(dg.root))]
     self.assertEqual(["root", "sda", "sda1"], visited)
示例#6
0
 def test_that_mds_and_dms_are_ignored_as_root_level_disks(self):
     self.sysinfo.objects += [
         Partition("252 1 1000 dm-1".split(" ")),
         Partition("9 1 1000 md1".split(" "))
     ]
     dg = DiskGraph(self.sysinfo)
     visited = [x.name for x in list(dg.visit(dg.root))]
     self.assertEqual(["root"], visited)
示例#7
0
 def test_that_raid_array_is_child_of_all_its_devices(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" ")),
                              Partition("8 16 1000 sdb".split(" ")),
                              Partition("9 0 1000 md0".split(" "))]
     self.sysinfo.objects += [RaidArray(("md0 sda sdb".split(" "), 1000))]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[3])
     self.assertListEquivalent([self.sysinfo.objects[0], self.sysinfo.objects[1]], tails)
示例#8
0
 def test_that_raid_array_can_be_child_of_partition(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" ")),
                              Partition("8 1 1000 sda1".split(" ")),
                              Partition("9 0 1000 md0".split(" "))]
     self.sysinfo.objects += [RaidArray(("md0 sda1".split(" "), 1000))]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[3])
     self.assertListEquivalent([self.sysinfo.objects[1]], tails)
示例#9
0
 def test_that_partition_is_associated_with_right_disk(self):
     self.sysinfo.objects += [
         Partition("8 0 1000 sda".split(" ")),
         Partition("8 16 1000 sdb".split(" ")),
         Partition("8 1 1000 sda1".split(" "))
     ]
     dg = DiskGraph(self.sysinfo)
     visited = [x.name for x in list(dg.visit(dg.root))]
     self.assertEqual(["root", "sda", "sda1", "sdb"], visited)
示例#10
0
 def test_that_volume_group_is_child_of_physical_volume(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" "))]
     self.sysinfo.objects += [LvmPhysicalVolume("/dev/sda 1000".split(" "))]
     self.sysinfo.objects += [
         LvmVolumeGroup(["group", "1000", ["/dev/sda"], "0"])
     ]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[2])
     self.assertListEquivalent([self.sysinfo.objects[1]], tails)
示例#11
0
 def test_that_volume_group_can_be_child_of_multiple_physical_volumes(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" ")),
                              Partition("8 16 1000 sdb".split(" "))]
     self.sysinfo.objects += [LvmPhysicalVolume("/dev/sda 1000".split(" ")),
                              LvmPhysicalVolume("/dev/sdb 1000".split(" "))]
     self.sysinfo.objects += [LvmVolumeGroup(["group", "1000", ["/dev/sda", "/dev/sdb"], "0"])]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[4])
     self.assertListEquivalent(self.are(LvmPhysicalVolume), tails)
示例#12
0
 def test_that_raid_array_can_be_child_of_partition(self):
     self.sysinfo.objects += [
         Partition("8 0 1000 sda".split(" ")),
         Partition("8 1 1000 sda1".split(" ")),
         Partition("9 0 1000 md0".split(" "))
     ]
     self.sysinfo.objects += [RaidArray(("md0 sda1".split(" "), 1000))]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[3])
     self.assertListEquivalent([self.sysinfo.objects[1]], tails)
示例#13
0
 def test_that_volume_can_be_child_of_raid_array(self):
     self.sysinfo.objects += [
         Partition("8 0 1000 sda".split(" ")),
         Partition("8 1 1000 sda1".split(" "))
     ]
     self.sysinfo.objects += [RaidArray(("md0 sda1".split(" "), 1000))]
     self.sysinfo.objects += [LvmPhysicalVolume("/dev/md0 1000".split(" "))]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[3])
     self.assertListEquivalent(self.are(RaidArray), tails)
示例#14
0
 def test_graph_with_partition_and_swap(self):
     self.sysinfo.objects += [
         Partition("8 0 1000 sda".split(" ")),
         Partition("8 1 1000 sda1".split(" "))
     ]
     self.sysinfo.objects += [
         SwapArea("/dev/sda1 partition 497660 0 -1".split(" "))
     ]
     dg = DiskGraph(self.sysinfo)
     self.assertListEquivalent(self.are(SwapArea),
                               dg.headsFor(self.sysinfo.objects[1]))
示例#15
0
 def test_that_raid_array_is_child_of_all_its_devices(self):
     self.sysinfo.objects += [
         Partition("8 0 1000 sda".split(" ")),
         Partition("8 16 1000 sdb".split(" ")),
         Partition("9 0 1000 md0".split(" "))
     ]
     self.sysinfo.objects += [RaidArray(("md0 sda sdb".split(" "), 1000))]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[3])
     self.assertListEquivalent(
         [self.sysinfo.objects[0], self.sysinfo.objects[1]], tails)
示例#16
0
 def test_that_volume_can_be_child_of_partition(self):
     self.sysinfo.objects += [
         Partition("8 0 1000 sda".split(" ")),
         Partition("8 1 1000 sda1".split(" "))
     ]
     self.sysinfo.objects += [
         LvmPhysicalVolume("/dev/sda1 1000".split(" "))
     ]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[2])
     self.assertListEquivalent([self.sysinfo.objects[1]], tails)
示例#17
0
 def test_graph_with_partition_and_fs(self):
     self.sysinfo.objects += [
         Partition("8 0 1000 sda".split(" ")),
         Partition("8 1 1000 sda1".split(" "))
     ]
     self.sysinfo.objects += [
         MountedFileSystem(
             "/dev/sda1 3897212928 2526269440 1212547072 68% /boot".split(
                 " "))
     ]
     dg = DiskGraph(self.sysinfo)
     self.assertListEquivalent(self.are(MountedFileSystem),
                               dg.headsFor(self.sysinfo.objects[1]))
示例#18
0
 def test_that_volume_group_can_be_child_of_multiple_physical_volumes(self):
     self.sysinfo.objects += [
         Partition("8 0 1000 sda".split(" ")),
         Partition("8 16 1000 sdb".split(" "))
     ]
     self.sysinfo.objects += [
         LvmPhysicalVolume("/dev/sda 1000".split(" ")),
         LvmPhysicalVolume("/dev/sdb 1000".split(" "))
     ]
     self.sysinfo.objects += [
         LvmVolumeGroup(["group", "1000", ["/dev/sda", "/dev/sdb"], "0"])
     ]
     dg = DiskGraph(self.sysinfo)
     tails = dg.tailsFor(self.sysinfo.objects[4])
     self.assertListEquivalent(self.are(LvmPhysicalVolume), tails)
示例#19
0
 def test_graph_with_single_ide_disk(self):
     self.sysinfo.objects += [Partition("3 0 1000 hda".split(" "))]
     dg = DiskGraph(self.sysinfo)
     visited = [x.name for x in list(dg.visit(dg.root))]
     self.assertEqual(["root", "hda"], visited)
示例#20
0
 def test_graph_with_single_disk_and_partition(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" ")),
                              Partition("8 1 1000 sda1".split(" "))]
     dg = DiskGraph(self.sysinfo)
     visited = [x.name for x in list(dg.visit(dg.root))]
     self.assertEqual(["root", "sda", "sda1"], visited)
示例#21
0
 def test_that_mds_and_dms_are_ignored_as_root_level_disks(self):
     self.sysinfo.objects += [Partition("252 1 1000 dm-1".split(" ")),
                              Partition("9 1 1000 md1".split(" "))]
     dg = DiskGraph(self.sysinfo)
     visited = [x.name for x in list(dg.visit(dg.root))]
     self.assertEqual(["root"], visited)
示例#22
0
 def test_graph_with_single_ide_disk(self):
     self.sysinfo.objects += [Partition("3 0 1000 hda".split(" "))]
     dg = DiskGraph(self.sysinfo)
     visited = [x.name for x in list(dg.visit(dg.root))]
     self.assertEqual(["root", "hda"], visited)
示例#23
0
 def test_graph_with_partition_and_fs(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" ")), Partition("8 1 1000 sda1".split(" "))]
     self.sysinfo.objects += [MountedFileSystem("/dev/sda1 3897212928 2526269440 1212547072 68% /boot".split(" "))]
     dg = DiskGraph(self.sysinfo)
     self.assertListEquivalent(self.are(MountedFileSystem), dg.headsFor(self.sysinfo.objects[1]))
示例#24
0
 def test_graph_with_partition_and_swap(self):
     self.sysinfo.objects += [Partition("8 0 1000 sda".split(" ")), Partition("8 1 1000 sda1".split(" "))]
     self.sysinfo.objects += [SwapArea("/dev/sda1 partition 497660 0 -1".split(" "))]
     dg = DiskGraph(self.sysinfo)
     self.assertListEquivalent(self.are(SwapArea), dg.headsFor(self.sysinfo.objects[1]))