Permalink
Browse files

Merge branch 'master' of github.com:pcbsd/pcbsd

  • Loading branch information...
2 parents b5e5e3e + 31283ea commit 7a97446c680ed22b78ff3124b15775fc291cc22d @kmoore134 kmoore134 committed Aug 23, 2013
@@ -71,7 +71,7 @@ QStringList LPBackend::listSnapshots(QString dsmountpoint){
QDir dir(dsmountpoint+"/.zfs/snapshot");
QStringList list;
if(dir.exists()){
- list = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed);
+ list = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time | QDir::Reversed);
}
return list;
}
@@ -203,8 +203,8 @@ bool LPBackend::datasetInfo(QString dataset, int& time, int& numToKeep){
// ==================
// Snapshop Management
// ==================
-bool LPBackend::newSnapshot(QString dataset){
- QString cmd = "lpreserver mksnap "+dataset;
+bool LPBackend::newSnapshot(QString dataset, QString snapshotname){
+ QString cmd = "lpreserver mksnap --replicate "+dataset+" "+snapshotname;
int ret = system(cmd.toUtf8());
return (ret == 0);
@@ -24,7 +24,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);
+ static bool 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);
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,5 +1,6 @@
<RCC>
<qresource>
+ <file>images/camera_add.png</file>
<file>images/upload.png</file>
<file>images/key.png</file>
<file>images/lifepreserver.png</file>
@@ -157,10 +157,11 @@ void mainUI::updateMenus(){
if(ds.isEmpty()){
ui->tool_remove->setVisible(false);
ui->tool_config->setVisible(false);
-
+ ui->tool_newsnapshot->setVisible(false);
}else{
ui->tool_remove->setVisible(true);
ui->tool_config->setVisible(true);
+ ui->tool_newsnapshot->setVisible(true);
}
//Enabled/disable the SSH key management
if(RLIST.contains(ds) && !ds.isEmpty()){
@@ -275,6 +276,23 @@ void mainUI::on_tool_remove_clicked(){
setupUI();
}
+void mainUI::on_tool_newsnapshot_clicked(){
+ QString ds = getSelectedDS();
+ if(ds.isEmpty()){return; }
+ //Get the new snapshot name from the user
+ bool ok;
+ QString name = QInputDialog::getText(this,tr("New Snapshot Name"), tr("Snapshot Name:"), QLineEdit::Normal, tr("Name"), &ok, 0, Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly | Qt::ImhDigitsOnly );
+ 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"));
+ }
+ setupUI();
+}
// --- Menu Items Clicked
void mainUI::slotRevertToSnapshot(QAction *act){
@@ -56,6 +56,7 @@ private slots:
void on_treeWidget_itemSelectionChanged();
void on_tool_config_clicked();
void on_tool_remove_clicked();
+ void on_tool_newsnapshot_clicked();
void slotRevertToSnapshot(QAction*);
void slotBrowseSnapshot(QAction*);
@@ -142,6 +142,20 @@
</property>
</spacer>
</item>
+ <item>
+ <widget class="QToolButton" name="tool_newsnapshot">
+ <property name="statusTip">
+ <string>Make a new snapshot immediately</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="icon">
+ <iconset resource="lPreserve.qrc">
+ <normaloff>:/images/camera_add.png</normaloff>:/images/camera_add.png</iconset>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="QToolButton" name="tool_browse">
<property name="statusTip">
@@ -297,7 +297,7 @@ void ProcessManager::slotOtProcMessage(){
}
void ProcessManager::slotOtProcFinished(){
- if(otProc->exitStatus() != QProcess::NormalExit || otProc->exitCode() != 0){
+ if(otProc->exitStatus() != QProcess::NormalExit){
QString msg = otProc->readAllStandardError();
if(msg.isEmpty()){ msg = otProc->readAllStandardOutput(); }
if(msg.isEmpty()){ msg = tr("Unknown Error"); }

0 comments on commit 7a97446

Please sign in to comment.