/** Discover logical disks. Logical disks are identified by the /etc/mnttab file (by design). If ever seen in that file, the disk will be discovered. If the disk is removed it will be marked as offline. */ void StatisticalLogicalDiskEnumeration::FindLogicalDisks() { for (EntityIterator iter=Begin(); iter!=End(); iter++) { SCXCoreLib::SCXHandle<StatisticalLogicalDiskInstance> disk = *iter; disk->m_online = false; } m_deps->RefreshMNTTab(); for (std::vector<MntTabEntry>::const_iterator it = m_deps->GetMNTTab().begin(); it != m_deps->GetMNTTab().end(); it++) { if ( ! m_deps->FileSystemIgnored(it->fileSystem) && ! m_deps->DeviceIgnored(it->device)) { SCXCoreLib::SCXHandle<StatisticalLogicalDiskInstance> disk = FindDiskByDevice(it->device); if (0 == disk) { disk = new StatisticalLogicalDiskInstance(m_deps); disk->m_device = it->device; disk->m_mountPoint = it->mountPoint; disk->m_fsType = it->fileSystem; disk->SetId(disk->m_mountPoint); #if defined(linux) static SCXLVMUtils lvmUtils; if (lvmUtils.IsDMDevice(it->device)) { try { // Try to convert the potential LVM device path into its matching // device mapper (dm) device path. std::wstring dmDevice = lvmUtils.GetDMDevice(it->device); SCXASSERT(!dmDevice.empty()); disk->m_samplerDevices.push_back(dmDevice); } catch (SCXCoreLib::SCXException& e) { static SCXCoreLib::LogSuppressor suppressor(SCXCoreLib::eWarning, SCXCoreLib::eTrace); std::wstringstream out; out << L"An exception occurred resolving the dm device that represents the LVM partition " << it->device << L" : " << e.What(); SCX_LOG(m_log, suppressor.GetSeverity(out.str()), out.str()); } } // no else required; device was not an LVM device #endif AddInstance(disk); #if defined(hpux) if (m_pathToRdev.end() == m_pathToRdev.find(disk->m_device)) { SCXCoreLib::SCXFilePath fp(disk->m_device); fp.SetFilename(L""); UpdatePathToRdev(fp.Get()); } SCXASSERT(m_pathToRdev.end() != m_pathToRdev.find(disk->m_device)); m_deps->AddDeviceInstance(disk->m_device, L"", disk->FindLVInfoByID(m_pathToRdev.find(disk->m_device)->second), m_pathToRdev.find(disk->m_device)->second); #endif } disk->m_online = true; } } }