def testPhysicalMediumConnType(self): storage.SYS_BLOCK = 'testdata/storage/sys/block' pm = storage.PhysicalMediumDiskLinux26('sda', conn_type='IDE') self.assertEqual(pm.ConnectionType, 'IDE') self.assertRaises(AssertionError, storage.PhysicalMediumDiskLinux26, 'sda', conn_type='NotValid')
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()
def testPhysicalMediumFields(self): storage.SYS_BLOCK = 'testdata/storage/sys/block' pm = storage.PhysicalMediumDiskLinux26('sda') self.assertEqual(pm.Vendor, 'vendor_name') self.assertEqual(pm.Model, 'model_name') self.assertEqual(pm.SerialNumber, 'serial_number') self.assertEqual(pm.FirmwareVersion, 'firmware_version') self.assertTrue(pm.SMARTCapable) self.assertEqual(pm.Health, 'OK') self.assertFalse(pm.Removable)
def testPhysicalMediumHotSwappable(self): storage.SYS_BLOCK = 'testdata/storage/sys/block' pm = storage.PhysicalMediumDiskLinux26('sda') self.assertFalse(pm.HotSwappable) storage.SYS_BLOCK = 'testdata/storage/sys/blockRemovable' self.assertTrue(pm.HotSwappable)
def testPhysicalMediumCapacity(self): storage.SYS_BLOCK = 'testdata/storage/sys/block' pm = storage.PhysicalMediumDiskLinux26('sda') self.assertEqual(pm.Capacity, 512)
def testPhysicalMediumVendorATA(self): storage.SYS_BLOCK = 'testdata/storage/sys/block_ATA' pm = storage.PhysicalMediumDiskLinux26('sda') # vendor 'ATA' is suppressed, as it is useless self.assertEqual(pm.Vendor, '')
def testHealthError(self): storage.SMARTCTL = 'testdata/storage/smartctl_healtherr' storage.SYS_BLOCK = 'testdata/storage/sys/block' pm = storage.PhysicalMediumDiskLinux26('sda') self.assertEqual(pm.Health, 'Error')
def testHealthFailing(self): storage.SMARTCTL = 'testdata/storage/smartctl_healthfail' storage.SYS_BLOCK = 'testdata/storage/sys/block' pm = storage.PhysicalMediumDiskLinux26('sda') self.assertEqual(pm.Health, 'Failing')
def testNotSmartCapable(self): storage.SMARTCTL = 'testdata/storage/smartctl_disabled' storage.SYS_BLOCK = 'testdata/storage/sys/block' pm = storage.PhysicalMediumDiskLinux26('sda') self.assertFalse(pm.SMARTCapable)
def testPhysicalMediumName(self): pm = storage.PhysicalMediumDiskLinux26('sda') self.assertEqual(pm.Name, 'sda') pm.Name = 'sdb' self.assertEqual(pm.Name, 'sdb')