From e9d157fb7b51f189fae3734bfe143094418f9c40 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 4 Mar 2007 10:24:39 +0000 Subject: [PATCH] Add smartctl call to bacula-sd.conf as an example of getting tape alert info. More bat work git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4307 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/restore/restore.cpp | 42 +++++++++++++++++------ bacula/src/qt-console/restore/restore.h | 14 +++++++- bacula/src/stored/bacula-sd.conf.in | 14 ++++++++ bacula/technotes-2.1 | 3 ++ 4 files changed, 61 insertions(+), 12 deletions(-) diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index d5dc381263..f6ba6a8186 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -101,6 +101,9 @@ restoreDialog::restoreDialog(Console *console) { m_console = console; setupUi(this); + connect(fileWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), + this, SLOT(fileDoubleClicked(QTreeWidgetItem *, int))); + setFont(m_console->get_font()); fillDirectory("/home/kern/bacula/k"); this->show(); } @@ -113,7 +116,6 @@ void restoreDialog::fillDirectory(const char *dir) char pathbuf[MAXSTRING]; char modes[20], user[20], group[20], size[20], date[30]; char marked[10]; - int row = 0; int pnl, fnl; POOLMEM *file = get_pool_memory(PM_FNAME); POOLMEM *path = get_pool_memory(PM_FNAME); @@ -146,7 +148,6 @@ void restoreDialog::fillDirectory(const char *dir) if (*p == '$') { break; } -// Dmsg1(000, "Got: %s\n", p); if (!*p) { continue; } @@ -186,19 +187,38 @@ void restoreDialog::fillDirectory(const char *dir) } else { bstrncpy(marked, " ", sizeof(marked)); } - split_path_and_filename(p, &path, &pnl, - &file, &fnl); - -// printf("modes=%s user=%s group=%s size=%s date=%s path=%s file=%s\n", -// modes, user, group, size, date, path, file); - + split_path_and_filename(p, &path, &pnl, &file, &fnl); item.clear(); item << "" << file << modes << user << group << size << date; - items.append(new QTreeWidgetItem((QTreeWidget *)0, item)); - - row++; + QTreeWidgetItem *ti = new QTreeWidgetItem((QTreeWidget *)0, item); + ti->setTextAlignment(5, Qt::AlignRight); /* right align size */ + items.append(ti); } + fileWidget->clear(); fileWidget->insertTopLevelItems(0, items); m_console->setEnabled(true); + free_pool_memory(file); + free_pool_memory(path); +} + +void restoreDialog::accept() +{ + this->hide(); + m_console->write("done"); + delete this; +} + + +void restoreDialog::reject() +{ + this->hide(); + m_console->write("quit"); + mainWin->set_status("Canceled"); + delete this; +} + +void restoreDialog::fileDoubleClicked(QTreeWidgetItem *item, int column) +{ + printf("Text=%s column=%d\n", item->text(1).toUtf8().data(), column); } diff --git a/bacula/src/qt-console/restore/restore.h b/bacula/src/qt-console/restore/restore.h index 1f5be13ded..2ed83a771c 100644 --- a/bacula/src/qt-console/restore/restore.h +++ b/bacula/src/qt-console/restore/restore.h @@ -41,6 +41,10 @@ class Console; +/* + * The pre-restore dialog selects the Job/Client to be restored + * It really could use considerable enhancement. + */ class prerestoreDialog : public QDialog, public Ui::prerestoreForm { Q_OBJECT @@ -58,6 +62,11 @@ private: }; +/* + * The restore dialog is brought up once we are in the Bacula + * restore tree routines. It handles putting up a GUI tree + * representation of the files to be restored. + */ class restoreDialog : public QDialog, public Ui::restoreForm { Q_OBJECT @@ -66,7 +75,10 @@ public: restoreDialog(Console *parent); void fillDirectory(const char *path); -public slots: +private slots: + void accept(); + void reject(); + void fileDoubleClicked(QTreeWidgetItem *item, int column); private: Console *m_console; diff --git a/bacula/src/stored/bacula-sd.conf.in b/bacula/src/stored/bacula-sd.conf.in index 4d20586b3b..3840520914 100644 --- a/bacula/src/stored/bacula-sd.conf.in +++ b/bacula/src/stored/bacula-sd.conf.in @@ -76,6 +76,8 @@ Device { # AutoChanger = yes # # Enable the Alert command only if you have the mtx package loaded # Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" +# If you have smartctl, enable this, it has more info than tapeinfo +# Alert Command = "sh -c 'smartctl -H -l error %c'" #} #Device { @@ -90,6 +92,8 @@ Device { # AutoChanger = yes # # Enable the Alert command only if you have the mtx package loaded # Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" +# If you have smartctl, enable this, it has more info than tapeinfo +# Alert Command = "sh -c 'smartctl -H -l error %c'" #} # @@ -108,6 +112,8 @@ Device { ## AutoChanger = yes # # Enable the Alert command only if you have the mtx package loaded ## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'" +## If you have smartctl, enable this, it has more info than tapeinfo +## Alert Command = "sh -c 'smartctl -H -l error %c'" #} # @@ -126,6 +132,8 @@ Device { # Backward Space Record = no # Fast Forward Space File = no # TWO EOF = yes +# If you have smartctl, enable this, it has more info than tapeinfo +# Alert Command = "sh -c 'smartctl -H -l error %c'" #} # @@ -144,6 +152,8 @@ Device { ## The min/max blocksizes of 32768 are *required* # Minimum Block Size = 32768 # Maximum Block Size = 32768 +# If you have smartctl, enable this, it has more info than tapeinfo +# Alert Command = "sh -c 'smartctl -H -l error %c'" #} # @@ -182,6 +192,8 @@ Device { # AlwaysOpen = yes; # RemovableMedia = yes; # RandomAccess = no; +# If you have smartctl, enable this, it has more info than tapeinfo +# Alert Command = "sh -c 'smartctl -H -l error %c'" #} # @@ -196,6 +208,8 @@ Device { # AlwaysOpen = Yes; # RemovableMedia = yes; # RandomAccess = no; +# If you have smartctl, enable this, it has more info than tapeinfo +# Alert Command = "sh -c 'smartctl -H -l error %c'" #} # diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index d545766264..87a250d9e2 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,9 @@ Technical notes on version 2.1 General: +04Mar07 +kes Add smartctl call to bacula-sd.conf as an example of getting + tape alert info. 02Mar07 kes Modify jobq.c to let simultaneous restore jobs run. This may cause them to fail if they cannot get a drive. -- 2.39.5