コード例 #1
0
ファイル: test_blockmgr.py プロジェクト: OpenSight/StorLever
    def test_block_dev(self):

        mgr = block_mgr()
        device = get_block_dev()
        if device == "":
            return  # no test
        block_name = os.path.basename(device)
        block = mgr.get_block_dev_by_name(block_name)
        self.assertEquals(block.name, block_name)
        self.assertEquals(block.dev_file, device)
        block.refresh_property()
        block.flush_block_buf()
        block.clean_meta()
コード例 #2
0
    def test_block_dev(self):

        mgr = block_mgr()
        device = get_block_dev()
        if device == "":
            return  # no test
        block_name = os.path.basename(device)
        block = mgr.get_block_dev_by_name(block_name)
        self.assertEquals(block.name, block_name)
        self.assertEquals(block.dev_file, device)
        block.refresh_property()
        block.flush_block_buf()
        block.clean_meta()
コード例 #3
0
ファイル: test_lvmmgr.py プロジェクト: OpenSight/StorLever
 def test_lvm(self):
     lvm = lvm_mgr()
     # create VG
     device = get_block_dev()
     if device == "":
         return  # no test
     lvm.new_vg('test_vg', [device])
     vg = lvm.get_vg('test_vg')
     self.assertIn(os.path.basename(device), vg.pvs)
     pv = vg.get_pv(device)
     self.assertEqual(pv.dev_file, device)
     # create LV
     vg.create_lv('test_lv1', 64*1024*1024*10)
     self.assertIn('test_lv1', vg.lvs)
     lv = vg.get_lv('test_lv1')
     self.assertEqual(lv.name, 'test_lv1')
     # resize LV
     lv.resize(64*1024*1024*15)
     self.assertEqual(lv.size, 64*1024*1024*15)
     # remove LV
     lv.delete()
     self.assertNotIn('test_lv1', vg.lvs)
     # grow VG
     device_extra = get_extra_block_dev()
     if device_extra != "":
         vg.grow(device_extra)
         vg = lvm.get_vg('test_vg')
         self.assertEqual(len(vg.pvs), 2)
         self.assertIn(os.path.basename(device), vg.pvs)
         self.assertIn(os.path.basename(device_extra), vg.pvs)
         # shrink VG
         vg.shrink(device)
         vg = lvm.get_vg('test_vg')
         self.assertIn(os.path.basename(device_extra), vg.pvs)
         self.assertNotIn(os.path.basename(device), vg.pvs)
     # delete VG
     vg.delete()
     self.assertRaises(StorLeverError, lvm.get_vg, 'test_vg')
コード例 #4
0
 def test_lvm(self):
     lvm = lvm_mgr()
     # create VG
     device = get_block_dev()
     if device == "":
         return  # no test
     lvm.new_vg('test_vg', [device])
     vg = lvm.get_vg('test_vg')
     self.assertIn(os.path.basename(device), vg.pvs)
     pv = vg.get_pv(device)
     self.assertEqual(pv.dev_file, device)
     # create LV
     vg.create_lv('test_lv1', 64 * 1024 * 1024 * 10)
     self.assertIn('test_lv1', vg.lvs)
     lv = vg.get_lv('test_lv1')
     self.assertEqual(lv.name, 'test_lv1')
     # resize LV
     lv.resize(64 * 1024 * 1024 * 15)
     self.assertEqual(lv.size, 64 * 1024 * 1024 * 15)
     # remove LV
     lv.delete()
     self.assertNotIn('test_lv1', vg.lvs)
     # grow VG
     device_extra = get_extra_block_dev()
     if device_extra != "":
         vg.grow(device_extra)
         vg = lvm.get_vg('test_vg')
         self.assertEqual(len(vg.pvs), 2)
         self.assertIn(os.path.basename(device), vg.pvs)
         self.assertIn(os.path.basename(device_extra), vg.pvs)
         # shrink VG
         vg.shrink(device)
         vg = lvm.get_vg('test_vg')
         self.assertIn(os.path.basename(device_extra), vg.pvs)
         self.assertNotIn(os.path.basename(device), vg.pvs)
     # delete VG
     vg.delete()
     self.assertRaises(StorLeverError, lvm.get_vg, 'test_vg')