detect frozen drives and show that the user
This commit is contained in:
@ -91,6 +91,7 @@ void Drive::setTaskPercentage(double d32TaskPercentage)
|
||||
if(d32TaskPercentage <= 100)
|
||||
{
|
||||
this->d32TaskPercentage = d32TaskPercentage;
|
||||
this->setTimestamp(); //set timestamp for this progress for detecting a frozen drive
|
||||
}
|
||||
}
|
||||
double Drive::getTaskPercentage(void)
|
||||
@ -125,4 +126,24 @@ void Drive::setDriveSMARTData( string modelFamily,
|
||||
u32ErrorCount = errorCount;
|
||||
u32PowerOnHours = powerOnHours;
|
||||
u32PowerCycles = powerCycle;
|
||||
}
|
||||
|
||||
|
||||
void Drive::setTimestamp()
|
||||
{
|
||||
time(&this->u32Timestamp);
|
||||
}
|
||||
|
||||
void Drive::checkFrozenDrive(void)
|
||||
{
|
||||
time_t u32localtime;
|
||||
time(&u32localtime);
|
||||
|
||||
if((u32localtime - this->u32Timestamp) >= (FROZEN_TIMEOUT*60) && (this->u32Timestamp > 0))
|
||||
{
|
||||
Logger::logThis()->warning("Drive Frozen: " + this->getModelName() + " " + this->getSerial());
|
||||
this->bWasDeleteted = false;
|
||||
this->bWasShredded = false;
|
||||
this->state = Drive::FROZEN;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user