示例#1
0
 def testValidateExports(self):
   storage.PROC_FILESYSTEMS = 'testdata/storage/proc.filesystems'
   storage.PROC_MOUNTS = 'testdata/storage/proc.mounts'
   storage.SYS_BLOCK = 'testdata/storage/sys/block'
   service = storage.StorageServiceLinux26()
   service.ValidateExports()
   stor = storage.LogicalVolumeLinux26('/fakepath', 'fstype')
   stor.ValidateExports()
   pm = storage.PhysicalMediumDiskLinux26('sda')
   pm.ValidateExports()
示例#2
0
 def testUsedSpace(self):
   stor = storage.LogicalVolumeLinux26('/fakepath', 'fstype')
   teststatvfs = OsStatVfs('/fakepath')
   used = (teststatvfs.f_blocks - teststatvfs.f_bavail) * teststatvfs.f_bsize
   self.assertEqual(stor.UsedSpace, used / 1024 / 1024)
示例#3
0
 def testLogicalVolumeCapacity(self):
   stor = storage.LogicalVolumeLinux26('/fakepath', 'fstype')
   teststatvfs = OsStatVfs('/fakepath')
   expected = teststatvfs.f_bsize * teststatvfs.f_blocks / 1024 / 1024
   self.assertEqual(stor.Capacity, expected)
示例#4
0
 def testLogicalVolumeThresholdReached(self):
   stor = storage.LogicalVolumeLinux26('/fakepath', 'fstype')
   stor.ThresholdLimit = 1
   self.assertFalse(stor.ThresholdReached)
   stor.ThresholdLimit = 4
   self.assertTrue(stor.ThresholdReached)
示例#5
0
 def testOsError(self):
     stor = storage.LogicalVolumeLinux26('/raise_os_error', 'fstype')
     self.assertEqual(stor.Capacity, 0)