Changeset 490345a


Ignore:
Timestamp:
10/01/13 13:18:24 (15 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, releng/10.1
Children:
302f10d, c823860f
Parents:
65fd31b2
Message:

Add a check for the replication PID file when starting up the replication file watcher. This should prevent possible watcher conflicts down the road.

Location:
src-qt4/life-preserver
Files:
2 edited

Legend:

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

    r65fd31b2 r490345a  
    267267  }*/ 
    268268  //Check to make sure that lpreserver actually has a process running before starting this 
    269   //if(!QFile::exists("/var/run/<something.pid>"){ FILE_REPLICATION.clear(); return; } 
     269  if( !isReplicationRunning() ){ FILE_REPLICATION.clear(); return; } 
    270270  //Check for the existance of the file to watch and create it as necessary   
    271271  if(!QFile::exists(FILE_REPLICATION)){ system( QString("touch "+FILE_REPLICATION).toUtf8() ); } 
     
    310310} 
    311311 
     312bool LPWatcher::isReplicationRunning(){ 
     313  //Check for the replication PID 
     314  QDir dir("/var/db/lpreserver"); 
     315  QStringList files = dir.entryList( QStringList() << ".reptask-*" ); 
     316  return ( !files.isEmpty() ); 
     317} 
     318 
    312319// ------------------------------ 
    313320//    PRIVATE SLOTS 
     
    324331    QString pool, state, timestamp; 
    325332    QStringList cDev, cStat, cMsg, cSummary; 
    326     qDebug() << "-----zpool status------\n" << zstat.join("\n"); 
     333    //qDebug() << "-----zpool status------\n" << zstat.join("\n"); 
    327334    bool newresilver = false; bool newscrub = false; bool newerror = false; 
    328335    for(int i=0; i<zstat.length(); i++){ 
     
    450457        else if(zstat[i].contains("ONLINE")){continue;} //do nothing for this device - it is good 
    451458        else if(zstat[i].contains("OFFLINE")){ continue; } //do nothing - this status must be set manually - it is not a "random" status 
    452         else if(zstat[i].contains("DEGRADED")){  
     459        else if(zstat[i].contains("DEGRADED")){ 
     460          // This should only happen on pools, not actual devices 
    453461          cStat << "DEGRADED"; 
    454462          cMsg << tr("The pool is in a degraded state. See additional device error(s)."); 
  • src-qt4/life-preserver/LPWatcher.h

    r8c6a630 r490345a  
    5050 
    5151        double displayToDoubleK(QString); // string->double conversion 
    52  
     52        bool isReplicationRunning(); //check for replication PID file 
     53         
    5354private slots: 
    5455        void fileChanged(QString); //file system watcher saw a change 
Note: See TracChangeset for help on using the changeset viewer.