Esempio n. 1
0
 def test_getmetaparam(self):
     with namedTemporaryDir() as tmpdir:
         metadata = {}
         manifest = make_blocksd_manifest(tmpdir, metadata)
         metadata[sd.DMDK_SDUUID] = manifest.sdUUID
         self.assertEquals(manifest.sdUUID,
                           manifest.getMetaParam(sd.DMDK_SDUUID))
Esempio n. 2
0
 def test_getblocksize(self):
     with namedTemporaryDir() as tmpdir:
         metadata = {blockSD.DMDK_LOGBLKSIZE: 2048,
                     blockSD.DMDK_PHYBLKSIZE: 1024}
         manifest = make_blocksd_manifest(tmpdir, metadata)
         self.assertEquals(2048, manifest.logBlkSize)
         self.assertEquals(1024, manifest.phyBlkSize)
Esempio n. 3
0
 def test_getmetaparam(self):
     with namedTemporaryDir() as tmpdir:
         metadata = {}
         manifest = make_blocksd_manifest(tmpdir, metadata)
         metadata[sd.DMDK_SDUUID] = manifest.sdUUID
         self.assertEquals(manifest.sdUUID,
                           manifest.getMetaParam(sd.DMDK_SDUUID))
Esempio n. 4
0
    def test_getreaddelay(self):
        with namedTemporaryDir() as tmpdir:
            manifest = make_blocksd_manifest(tmpdir)
            vg_name = manifest.sdUUID
            lvm = FakeLVM(tmpdir)
            make_file(lvm.lvPath(vg_name, 'metadata'))

            with MonkeyPatchScope([(blockSD, 'lvm', lvm)]):
                self.assertIsInstance(manifest.getReadDelay(), float)
Esempio n. 5
0
 def test_getblocksize(self):
     with namedTemporaryDir() as tmpdir:
         metadata = {
             blockSD.DMDK_LOGBLKSIZE: 2048,
             blockSD.DMDK_PHYBLKSIZE: 1024
         }
         manifest = make_blocksd_manifest(tmpdir, metadata)
         self.assertEquals(2048, manifest.logBlkSize)
         self.assertEquals(1024, manifest.phyBlkSize)
Esempio n. 6
0
    def test_getreaddelay(self):
        with namedTemporaryDir() as tmpdir:
            manifest = make_blocksd_manifest(tmpdir)
            vg_name = manifest.sdUUID
            lvm = FakeLVM(tmpdir)
            make_file(lvm.lvPath(vg_name, 'metadata'))

            with MonkeyPatchScope([(blockSD, 'lvm', lvm)]):
                self.assertIsInstance(manifest.getReadDelay(), float)
Esempio n. 7
0
 def test_getvsize_inactive_lv(self):
     # Tests the path when the device file is not present
     with namedTemporaryDir() as tmpdir:
         manifest = make_blocksd_manifest(tmpdir)
         lvm = FakeLVM(tmpdir)
         vg_name = make_vg(lvm, manifest)
         lv_name = str(uuid.uuid4())
         lvm.createLV(vg_name, lv_name, VOLSIZE)
         with MonkeyPatchScope([(blockSD, 'lvm', lvm)]):
             self.assertEqual(VOLSIZE,
                              manifest.getVSize('<imgUUID>', lv_name))
Esempio n. 8
0
 def test_getvsize_inactive_lv(self):
     # Tests the path when the device file is not present
     with namedTemporaryDir() as tmpdir:
         manifest = make_blocksd_manifest(tmpdir)
         lvm = FakeLVM(tmpdir)
         vg_name = make_vg(lvm, manifest)
         lv_name = str(uuid.uuid4())
         lvm.createLV(vg_name, lv_name, VOLSIZE)
         with MonkeyPatchScope([(blockSD, 'lvm', lvm)]):
             self.assertEqual(VOLSIZE,
                              manifest.getVSize('<imgUUID>', lv_name))
Esempio n. 9
0
 def test_getblocksize_defaults(self):
     with namedTemporaryDir() as tmpdir:
         manifest = make_blocksd_manifest(tmpdir)
         self.assertEquals(512, manifest.logBlkSize)
         self.assertEquals(512, manifest.phyBlkSize)
Esempio n. 10
0
 def test_getblocksize_defaults(self):
     with namedTemporaryDir() as tmpdir:
         manifest = make_blocksd_manifest(tmpdir)
         self.assertEquals(512, manifest.logBlkSize)
         self.assertEquals(512, manifest.phyBlkSize)