Ignore:
Timestamp:
09/11/13 14:07:34 (13 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
b5a7675
Parents:
9599cf7
Message:

Get the new watcher class up to the same (or slightly more) functionality thatn the old implementation. Now to start adding the new checking for mirroring/resilvering and or zpool errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/life-preserver/LPWatcher.cpp

    r9ba89ba rf698804  
    66    "replication" status: 20-29 
    77    "critical" status: 30-39 
     8    "mirror" status: 40-49 
    89  Within each set: 
    910    *0 = ID Code (for internal identification as necessary) 
     
    1617  Valid Internal ID's: 
    1718    SNAPCREATED -> new snapshot created 
    18     REPSTARTED    -> Replication task started 
    19     REPFINISHED  -> Replication task finished 
    20     REPERROR       -> Replication task failed 
     19    STARTED     -> Task started 
     20    RUNNING     -> Task running (I.E. status update) 
     21    FINISHED    -> Task finished 
     22    ERROR               -> Task failed 
    2123     
    2224*/ 
     
    8385  unsigned int base; 
    8486  if(type=="message"){base=10;} 
    85   else if(type=="running"){base=20;} 
     87  else if(type=="replicate"){base=20;} 
    8688  else if(type=="critical"){base=30;} 
     89  else if(type=="mirror"){base=40;} 
    8790  else{ return output; } //invalid input type 
    8891  //Now fill the output array based upon requested outputs 
     
    99102  //Return the output list 
    100103  return output; 
     104} 
     105 
     106QStringList LPWatcher::getAllCurrentMessages(){ 
     107  //Useful for quickly displaying all latest messages in a tooltip or summary 
     108  QStringList output; 
     109  if(LOGS.contains(12) && LOGS.contains(14)){ output << LOGS[14]+" -- "+LOGS[12]; } 
     110  if(LOGS.contains(22) && LOGS.contains(24)){ output << LOGS[24]+" -- "+LOGS[22]; } 
     111  if(LOGS.contains(32) && LOGS.contains(34)){ output << LOGS[34]+" -- "+LOGS[32]; } 
     112  if(LOGS.contains(42) && LOGS.contains(44)){ output << LOGS[44]+" -- "+LOGS[42]; } 
     113  return output; 
     114} 
     115 
     116bool LPWatcher::isRunning(){ 
     117  if(LOGS.value(20) == "STARTED" || LOGS.value(20) == "RUNNING"){ return true; } 
     118  else if(LOGS.value(40) == "STARTED" || LOGS.value(40) == "RUNNING"){ return true; } 
     119  else{ return false; } 
     120} 
     121 
     122bool LPWatcher::hasError(){ 
     123  return (LOGS.value(20)=="ERROR" || LOGS.contains(30) || LOGS.value(40)=="ERROR"); 
    101124} 
    102125 
     
    135158      // 23 - Full message set on update ping 
    136159      LOGS.insert(24, timestamp); //full timestamp 
    137       LOGS.insert(25, time); // time only       
    138       //let the first ping of the replication file watcher emit the signal - don't do it now 
     160      LOGS.insert(25, time); // time only 
     161      if(!quiet){ emit MessageAvailable("replication"); } 
    139162    }else if(message.contains("finished replication")){ 
    140163      stopRepFileWatcher(); 
     
    201224      lastSize = cSize; //save the current size for later 
    202225      //Now set the current process status 
     226      LOGS.insert(20,"RUNNING"); 
    203227      LOGS.insert(21,dataset); 
    204228      LOGS.insert(23,txt); 
     
    253277void LPWatcher::checkErrorFile(){ 
    254278  return; 
    255   //Check zpool status and report any errors/processes 
    256279  if(QFile::exists(FILE_ERROR)){ 
    257280    //Read the file to determine the cause of the error 
Note: See TracChangeset for help on using the changeset viewer.