Exemplo n.º 1
0
def test_meta_size_enough_free_space(monkeypatch):
    monkeypatch.setattr(
        lvm, 'getVG', lambda x: fake_vg(extent_size=str(128 * constants.MEGAB),
                                        extent_count='77',
                                        free=str(512 * constants.MEGAB)))
    meta_size = blockSD.BlockStorageDomain.metaSize('sd-uuid')
    assert meta_size == 512
Exemplo n.º 2
0
def test_meta_size_max_val(monkeypatch):
    monkeypatch.setattr(
        lvm, 'getVG', lambda x: fake_vg(extent_size=(128 * constants.MEGAB),
                                        extent_count='1048577',
                                        free=str(1024 * constants.MEGAB)))
    meta_size = blockSD.BlockStorageDomain.metaSize('sd-uuid')
    assert meta_size == 513
Exemplo n.º 3
0
def test_meta_size_vg_too_small(monkeypatch):
    # Creating a VG with size=10GB and 512MB - 1 byte of free space
    # Should raise an exception - VG too small
    monkeypatch.setattr(
        lvm, 'getVG', lambda x: fake_vg(extent_size=(128 * constants.MEGAB),
                                        extent_count='77',
                                        free=str((512 - 1) * constants.MEGAB)))
    with pytest.raises(se.VolumeGroupSizeError):
        blockSD.BlockStorageDomain.metaSize('sd-uuid')
Exemplo n.º 4
0
 def test_threshold_bad(self):
     vg = fake_vg(vg_mda_size=self.MIN_MD_SIZE,
                  vg_mda_free=self.MIN_MD_FREE)
     assert not blockSD.metadataValidity(vg)['mdathreshold']
Exemplo n.º 5
0
 def test_valid_ok(self):
     vg = fake_vg(vg_mda_size=self.MIN_MD_SIZE,
                  vg_mda_free=self.MIN_MD_FREE)
     assert blockSD.metadataValidity(vg)['mdavalid']
Exemplo n.º 6
0
 def test_threshold_ok(self):
     vg = fake_vg(vg_mda_size=self.MIN_MD_SIZE,
                  vg_mda_free=self.MIN_MD_FREE + 1)
     self.assertEqual(True, blockSD.metadataValidity(vg)['mdathreshold'])
Exemplo n.º 7
0
 def test_valid_bad(self):
     vg = fake_vg(vg_mda_size=self.MIN_MD_SIZE - 1,
                  vg_mda_free=self.MIN_MD_FREE)
     self.assertEqual(False, blockSD.metadataValidity(vg)['mdavalid'])
Exemplo n.º 8
0
 def test_threshold_bad(self):
     vg = fake_vg(
         vg_mda_size=self.MIN_MD_SIZE, vg_mda_free=self.MIN_MD_FREE)
     assert not blockSD.metadataValidity(vg)['mdathreshold']
Exemplo n.º 9
0
 def test_valid_ok(self):
     vg = fake_vg(
         vg_mda_size=self.MIN_MD_SIZE, vg_mda_free=self.MIN_MD_FREE)
     assert blockSD.metadataValidity(vg)['mdavalid']