Пример #1
0
 def testLogicalVolumeList(self):
     storage.PROC_MOUNTS = 'testdata/storage/proc.mounts'
     service = storage.StorageServiceLinux26()
     volumes = service.LogicalVolumeList
     self.assertEqual(len(volumes), 3)
     self.assertEqual(service.LogicalVolumeNumberOfEntries, 3)
     expectedFs = {
         '/': 'X_CATAWAMPUS-ORG_squashfs',
         '/foo': 'X_CATAWAMPUS-ORG_ubifs',
         '/tmp': 'X_CATAWAMPUS-ORG_tmpfs'
     }
     expectedRo = {'/': False, '/foo': True, '/tmp': False}
     found = set()
     for vol in volumes.values():
         found.add(vol.Name)
         t = OsStatVfs(vol.Name)
         self.assertEqual(vol.Status, 'Online')
         self.assertTrue(vol.Enable)
         self.assertEqual(vol.FileSystem, expectedFs[vol.Name])
         self.assertEqual(vol.Capacity,
                          t.f_bsize * t.f_blocks / 1024 / 1024)
         expected = t.f_bsize * (t.f_blocks - t.f_bavail) / 1024 / 1024
         self.assertEqual(vol.UsedSpace, expected)
         self.assertEqual(vol.X_CATAWAMPUS_ORG_ReadOnly,
                          expectedRo[vol.Name])
     self.assertEqual(found, set(expectedFs.keys()))
Пример #2
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()