Browse files

Setup the new snapshot process as an external process and update the …

…message appropriately. Also make sure that we parse every single line in the log, just to make sure that we don't miss an important message (keep it quiet during the initial startup phase though).
  • Loading branch information...
1 parent 2ac57ce commit 845aaf65a1fb408a2590d396a7ec1d172bbb2e0b Ken Moore committed Aug 27, 2013
@@ -161,11 +161,13 @@ bool LPBackend::datasetInfo(QString dataset, int& time, int& numToKeep){
// ==================
// Snapshop Management
// ==================
-bool LPBackend::newSnapshot(QString dataset, QString snapshotname){
+void LPBackend::newSnapshot(QString dataset, QString snapshotname){
+ //This needs to run externally - since the snapshot is simply added to the queue, and the replication
+ // afterwards may take a long time.
QString cmd = "lpreserver mksnap --replicate "+dataset+" "+snapshotname;
- int ret = LPBackend::runCmd(cmd);
+ QProcess::startDetached(cmd);
- return (ret == 0);
+ return;
bool LPBackend::removeSnapshot(QString dataset, QString snapshot){
@@ -25,7 +25,7 @@ class LPBackend{
static bool removeDataset(QString dataset);
static bool datasetInfo(QString dataset, int& time, int& numToKeep); //get current settings for a dataset
//Snapshop Management
- static bool newSnapshot(QString dataset, QString snapshotname);
+ static void newSnapshot(QString dataset, QString snapshotname);
static bool removeSnapshot(QString dataset, QString snapshot);
static bool revertSnapshot(QString dataset, QString snapshot); //revert to given snapshot
static QString revertSnapshotFile(QString dataset, QString snapshot, QString filepath);
@@ -201,10 +201,8 @@ void LPTray::slotNewLogMessage(QString file){
if(file == "/var/log/lpreserver/lpreserver.log"){
//Backend Status Update
//get the last line from the log file
- QString log;
- while( !LFStream->atEnd() ){ log = LFStream->readLine(); }
- //Now parse the log line and do stuff with it
- parseLogMessage(log,initPhase);
+ //Now parse the log lines and do stuff with it
+ while( !LFStream->atEnd() ){ parseLogMessage(LFStream->readLine(), initPhase); }
//Replication status update
//get the last line from the file
@@ -299,12 +299,8 @@ void mainUI::on_tool_newsnapshot_clicked(){
if(!ok || name.isEmpty()){ return; } //cancelled
qDebug() << "Creating a new snapshot:" << ds << name;
//Now create the new snapshot
- ok = LPBackend::newSnapshot(ds,name);
- if( ok ){
- QMessageBox::information(this,tr("Success"), tr("The new snapshot has been created"));
- }else{
- QMessageBox::warning(this,tr("Failure"), tr("The new snapshot could not be created"));
- }
+ LPBackend::newSnapshot(ds,name);
+ QMessageBox::information(this,tr("Snapshot Pending"), tr("The new snapshot creation has been added to the queue"));

0 comments on commit 845aaf6

Please sign in to comment.