예제 #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)