Ignore:
Timestamp:
09/13/13 14:48:34 (11 months ago)
Author:
Ken <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
4f9718b, bb55337, b26c1ac
Parents:
74b4950
Message:

Add the parsing for running/finished resilvering to the new LPWatcher (needs testing)

File:
1 edited

Legend:

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

    rb5a7675 r23f66b8  
    331331            LOGS.insert(60,"RUNNING"); 
    332332            LOGS.insert(61,pool); 
    333             LOGS.insert(62, QString(tr("Resilvering: %1")).arg(percent) ); 
    334             LOGS.insert(63, QString(tr("Resilvering: %1 (%2 remaining)")).arg(percent, remain) ); 
     333            LOGS.insert(62, QString(tr("Scrubbing: %1 (%2 remaining)")).arg(percent, remain) ); 
     334            LOGS.insert(63, QString(tr("Scrubbing: %1 (%2 remaining)")).arg(percent, remain) ); 
    335335            LOGS.insert(64, timestamp); 
    336336            LOGS.insert(65, timestamp.section(" ",3,3) ); 
     
    338338          } 
    339339          if(isnew){ emit MessageAvailable("scrub"); } 
    340           if(LOGS.value(50) == "RUNNING"){ 
    341             //Resilvering is done - remove the info and send a ping 
    342             LOGS.insert(50,"FINISHED"); 
    343             LOGS.insert(51,pool); 
    344             LOGS.insert(52, tr("Resilvering complete")); 
    345             LOGS.insert(53, tr("Resilvering completed successfully")); 
    346             LOGS.insert(54, timestamp); 
    347             LOGS.insert(55, timestamp.section(" ",3,3) ); 
    348             emit MessageAvailable("resilvering"); 
     340          if(LOGS.contains(50) ){ 
     341            //Only resilvering OR scrub is shown at a time - so remove the resilver info 
     342            LOGS.remove(50); 
     343            LOGS.remove(51); 
     344            LOGS.remove(52); 
     345            LOGS.remove(53); 
     346            LOGS.remove(54); 
     347            LOGS.remove(55); 
    349348          } 
    350349        // --------- RESILVERING ------- 
    351         }else if(zstat[i].contains("resilver")){ 
     350        }else if(zstat[i].contains("resilver in progress")){ 
     351          //Resilvering is currently running 
     352          timestamp = zstat[i].section(" ",5,9,QString::SectionSkipEmpty); 
     353          //need info from the next two lines 
     354          i++; QString timeleft = zstat[i].section(" ",7,7,QString::SectionSkipEmpty); 
     355          i++; QString percent = zstat[i].section(" ", 2,2,QString::SectionSkipEmpty); 
    352356          //Setup the running re-silvering progress 
    353           if(LOGS.value(50)!= " " && LOGS.value(50)!="RUNNING"){newresilver=true; } 
     357          if(LOGS.value(50)!="RUNNING"){newresilver=true; } 
    354358          LOGS.insert(50, "RUNNING"); 
    355359          // 51 - need to put the actual device in here (not available on this line) 
    356           LOGS.insert(52, tr("Resilvering in progress")); 
    357           if(newresilver){ LOGS.insert(53, tr("Resilvering started") ); } 
    358           else{ LOGS.insert(53, tr("Resilvering in progress")); } 
     360          LOGS.insert(52, QString(tr("Resilvering: %1 (%2 remaining)")).arg(percent, timeleft) ); 
     361          if(newresilver){ LOGS.insert(53, QString(tr("Resilvering Started: %1 remaining ")).arg( timeleft) ); } 
     362          else{ LOGS.insert(53,QString(tr("Resilvering: %1 (%2 remaining)")).arg(percent, timeleft) ); } 
    359363          LOGS.insert(54, timestamp); 
    360364          LOGS.insert(55, timestamp.section(" ",3,3) ); 
    361           if(isnew){ emit MessageAvailable("resilvering"); } 
     365          if(LOGS.contains(60) ){ 
     366            //Only resilvering OR scrub is shown at a time - so remove the scrub info 
     367            LOGS.remove(60); 
     368            LOGS.remove(61); 
     369            LOGS.remove(62); 
     370            LOGS.remove(63); 
     371            LOGS.remove(64); 
     372            LOGS.remove(65); 
     373          } 
     374        }else if(zstat[i].contains("resilvered")){ 
     375          //Resilvering is finished 
     376          timestamp = zstat[i].section(" ",9,13,QString::SectionSkipEmpty); 
     377          QString timecomplete = zstat[i].section(" ",4,4,QString::SectionSkipEmpty); 
     378          QString errors = zstat[i].section(" ", 6,6,QString::SectionSkipEmpty); 
     379          //Setup the running re-silvering progress 
     380          if(LOGS.value(50)!= " "){newresilver=true; } //don't display message for first run 
     381          if(errors.toInt() > 0){  
     382            LOGS.insert(50, "ERROR"); 
     383            LOGS.insert(52, QString(tr("Resilver completed in &1 with %2 errors")).arg(timecomplete, errors) ); 
     384            LOGS.insert(53, QString(tr("Resilver completed in &1 with %2 errors")).arg(timecomplete, errors) ); 
     385          }else{ 
     386            LOGS.insert(50, "FINISHED"); 
     387            LOGS.insert(52, QString(tr("Resilver completed successfully in &1")).arg(timecomplete) ); 
     388            LOGS.insert(53, QString(tr("Resilver completed successfully in &1")).arg(timecomplete) );  
     389          } 
     390          // 51 - need to put the actual device in here (not available on this line) 
     391          LOGS.insert(54, timestamp); 
     392          LOGS.insert(55, timestamp.section(" ",3,3) ); 
     393          if(LOGS.contains(60) ){ 
     394            //Only resilvering OR scrub is shown at a time - so remove the scrub info 
     395            LOGS.remove(60); 
     396            LOGS.remove(61); 
     397            LOGS.remove(62); 
     398            LOGS.remove(63); 
     399            LOGS.remove(64); 
     400            LOGS.remove(65); 
     401          } 
    362402        } 
    363403      }else if(zstat[i].startsWith("errors:")){ 
     
    365405          qDebug() << "New zpool status error line that needs parsing:" << zstat[i]; 
    366406        } 
    367       }else if( state != "ONLINE" ){ 
     407      }else if( state != "ONLINE" || !LOGS.value(50).isEmpty() ){ 
    368408        //Check for state/resilvering of all real devices 
    369409        if(zstat[i].contains("NAME\tSTATE\tREAD")){continue;} //nothing on this header line 
Note: See TracChangeset for help on using the changeset viewer.