Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add another function to the backend to get a list of all available zp…

…ools on the system.
  • Loading branch information...
commit 46281f8f9060b7404827c9cee5cf494dc972c0c9 1 parent 37a1106
@beanpole135 beanpole135 authored
Showing with 21 additions and 1 deletion.
  1. +19 −0 life-preserver/LPBackend.cpp
  2. +2 −1  life-preserver/LPBackend.h
View
19 life-preserver/LPBackend.cpp
@@ -3,6 +3,25 @@
// ==============
// Informational
// ==============
+QStringList LPBackend::listPossibleDatasets(){
+ QString cmd = "zpool list -H -o name";
+ //Need output, so run this in a QProcess
+ QProcess *proc = new QProcess;
+ proc->setProcessChannelMode(QProcess::MergedChannels);
+ proc->start(cmd);
+ proc->waitForFinished();
+ QStringList out = QString(proc->readAllStandardOutput()).split("\n");
+ delete proc;
+ //Now process the output (one dataset per line - no headers)
+ QStringList list;
+ for(int i=0; i<out.length(); i++){ //skip the first two lines (headers)
+ QString ds = out[i].section("/",0,0).simplified();
+ if(!ds.isEmpty()){ list << ds; }
+ }
+ list.removeDuplicates();
+ return list;
+}
+
QStringList LPBackend::listDatasets(){
QString cmd = "lpreserver listcron";
//Need output, so run this in a QProcess
View
3  life-preserver/LPBackend.h
@@ -10,7 +10,8 @@ class LPBackend{
public:
//Informational
- static QStringList listDatasets(); //list all lifepreserver datasets
+ static QStringList listPossibleDatasets(); //list all possible datasets on the system
+ static QStringList listDatasets(); //list all current lifepreserver datasets
static QStringList listSnapshots(QString dataset); //list all snapshots for a particular dataset
static QStringList listReplicationTargets(); //list all datasets with replication enabled
//Snapshop Management
Please sign in to comment.
Something went wrong with that request. Please try again.