Пример #1
0
def check_space_increased(step):
    new_size = get_device_size(world.bigger_vol.device)
    assert world.size_before < new_size, "New size is not bigger than old"

    if world.bigger_vol.type == 'raid':
        each_volume_grew = world.grow_cfg.get('disks')
        if int(world.bigger_vol.level) == 5 or each_volume_grew:
            assert world.size_before < new_size, "New size is not bigger than old"
            LOG.info('Size grew on %s' % (new_size - world.size_before))

        mdinfo = mdadm.detail(world.bigger_vol.raid_pv)
        disk_count_should_be = int(world.grow_cfg.get('disks_count') or len(world.initial_cfg['disks']))
        assert mdinfo['raid_devices'] == disk_count_should_be, "Disk count doesn't match"
Пример #2
0
def check_space_increased(step):
    new_size = get_device_size(world.bigger_vol.device)
    assert world.size_before < new_size, "New size is not bigger than old"

    if world.bigger_vol.type == 'raid':
        each_volume_grew = world.grow_cfg.get('disks')
        if int(world.bigger_vol.level) == 5 or each_volume_grew:
            assert world.size_before < new_size, "New size is not bigger than old"
            LOG.info('Size grew on %s' % (new_size - world.size_before))

        mdinfo = mdadm.detail(world.bigger_vol.raid_pv)
        disk_count_should_be = int(
            world.grow_cfg.get('disks_count')
            or len(world.initial_cfg['disks']))
        assert mdinfo[
            'raid_devices'] == disk_count_should_be, "Disk count doesn't match"
Пример #3
0
    def test_detail(self, _mdadm):
        out1 = """
/dev/md0:
Version : 1.2
Creation Time : Tue Sep 18 09:20:25 2012
Raid Level : raid1
Array Size : 1048000 (1023.61 MiB 1073.15 MB)
Used Dev Size : 1048000 (1023.61 MiB 1073.15 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
 
Update Time : Tue Sep 18 09:20:35 2012
  State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
 
   Name : 0
   UUID : 80988291:ca7de4e9:412e93dc:ea6f4c6b
 Events : 17
 
Number   Major   Minor   RaidDevice State
0       7        0        0      active sync   /dev/loop0
1       7        1        1      active sync   /dev/loop1
                        """

        _mdadm.return_value = (out1, '', 0)
        details = mdadm.detail('/dev/md0')
        _mdadm.assert_called_once_with('misc', None, '/dev/md0', detail=True)
        self.assertItemsEqual(
            details, {
                'devices': {
                    '/dev/loop0': 'active sync',
                    '/dev/loop1': 'active sync'
                },
                'level': '1',
                'raid_devices': 2,
                'rebuild_status': None,
                'state': 'clean ',
                'total_devices': 2
            })

        out2 = """
/dev/md0:
Version : 1.2
Creation Time : Tue Sep 18 09:20:25 2012
Raid Level : raid1
Array Size : 1048000 (1023.61 MiB 1073.15 MB)
Used Dev Size : 1048000 (1023.61 MiB 1073.15 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
 
Update Time : Tue Sep 18 11:14:26 2012
  State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1
 
Rebuild Status : 6% complete
 
   Name : 0
   UUID : 80988291:ca7de4e9:412e93dc:ea6f4c6b
 Events : 21
 
Number   Major   Minor   RaidDevice State
0       7        0        0      spare rebuilding   /dev/loop0
1       7        1        1      active sync   /dev/loop1
"""

        _mdadm.return_value = (out2, '', 0)
        _mdadm.reset_mock()
        details = mdadm.detail('/dev/md0')
        self.assertItemsEqual(
            details, {
                'level': '1',
                'total_devices': 2,
                'devices': {
                    '/dev/loop1': 'active sync',
                    '/dev/loop0': 'spare rebuilding'
                },
                'rebuild_status': 6,
                'state': 'clean, degraded, recovering',
                'raid_devices': 2
            })
Пример #4
0
    def test_detail(self, _mdadm):
        out1 = """
/dev/md0:
Version : 1.2
Creation Time : Tue Sep 18 09:20:25 2012
Raid Level : raid1
Array Size : 1048000 (1023.61 MiB 1073.15 MB)
Used Dev Size : 1048000 (1023.61 MiB 1073.15 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent

Update Time : Tue Sep 18 09:20:35 2012
  State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

   Name : 0
   UUID : 80988291:ca7de4e9:412e93dc:ea6f4c6b
 Events : 17

Number   Major   Minor   RaidDevice State
0       7        0        0      active sync   /dev/loop0
1       7        1        1      active sync   /dev/loop1
                        """

        _mdadm.return_value = (out1, '', 0)
        details = mdadm.detail('/dev/md0')
        _mdadm.assert_called_once_with('misc', None, '/dev/md0', detail=True)
        self.assertItemsEqual(details,
                                        {'devices': {
                                                '/dev/loop0': 'active sync',
                                                '/dev/loop1': 'active sync'
                                        },
                                   'level': '1',
                                   'raid_devices': 2,
                                   'rebuild_status': None,
                                   'state': 'clean ',
                                   'total_devices': 2})

        out2 = """
/dev/md0:
Version : 1.2
Creation Time : Tue Sep 18 09:20:25 2012
Raid Level : raid1
Array Size : 1048000 (1023.61 MiB 1073.15 MB)
Used Dev Size : 1048000 (1023.61 MiB 1073.15 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent

Update Time : Tue Sep 18 11:14:26 2012
  State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1

Rebuild Status : 6% complete

   Name : 0
   UUID : 80988291:ca7de4e9:412e93dc:ea6f4c6b
 Events : 21

Number   Major   Minor   RaidDevice State
0       7        0        0      spare rebuilding   /dev/loop0
1       7        1        1      active sync   /dev/loop1
"""

        _mdadm.return_value = (out2, '', 0)
        _mdadm.reset_mock()
        details = mdadm.detail('/dev/md0')
        self.assertItemsEqual(details, {'level': '1',
                                                                        'total_devices': 2,
                                                                        'devices': {
                                                                                '/dev/loop1': 'active sync',
                                                                                '/dev/loop0': 'spare rebuilding'
                                                                        },
                                                                        'rebuild_status': 6,
                                                                        'state': 'clean, degraded, recovering',
                                                                        'raid_devices': 2})