From: Kern Sibbald Date: Mon, 14 Apr 2008 09:49:18 +0000 (+0000) Subject: kes Stop searching for Volumes in SD askdir if DIR returns the X-Git-Tag: Release-3.0.0~1553 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c326757fd31a78bdef28df7a41adfab2f813c23c;p=bacula%2Fbacula kes Stop searching for Volumes in SD askdir if DIR returns the same volume name twice in a row. kes Close bat console windows first to eliminate error message from the notifier. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6814 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 0465ac3cd9..0e65eb8c06 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -253,6 +253,16 @@ void MainWin::closeEvent(QCloseEvent *event) { m_isClosing = true; writeSettings(); + /* + * Close the console pages before non-console pages so that + * the notifier is turned off. Otherwise it prints an error when + * the page it is using gets destroyed. + */ + foreach(Console *console, m_consoleHash){ + console->writeSettings(); + console->terminate(); + console->closeStackPage(); + } /* close all non console pages, this will call settings in destructors */ while (m_consoleHash.count() < m_pagehash.count()) { foreach(Pages *page, m_pagehash) { @@ -265,12 +275,6 @@ void MainWin::closeEvent(QCloseEvent *event) } } } - /* close the console pages and terminate connection */ - foreach(Console *console, m_consoleHash){ - console->writeSettings(); - console->terminate(); - console->closeStackPage(); - } event->accept(); } diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index 2bf8e43b8e..a5ad1a6976 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -253,6 +253,7 @@ bool dir_find_next_appendable_volume(DCR *dcr) JCR *jcr = dcr->jcr; BSOCK *dir = jcr->dir_bsock; bool rtn; + char lastVolume[MAX_NAME_LENGTH]; Dmsg2(200, "dir_find_next_appendable_volume: reserved=%d Vol=%s\n", dcr->is_reserved(), dcr->VolumeName); @@ -265,6 +266,7 @@ bool dir_find_next_appendable_volume(DCR *dcr) lock_volumes(); P(vol_info_mutex); dcr->clear_found_in_use(); + lastVolume[0] = 0; for (int vol_index=1; vol_index < 20; vol_index++) { bash_spaces(dcr->media_type); bash_spaces(dcr->pool_name); @@ -273,6 +275,12 @@ bool dir_find_next_appendable_volume(DCR *dcr) unbash_spaces(dcr->pool_name); Dmsg1(100, ">dird %s", dir->msg); if (do_get_volume_info(dcr)) { + /* Give up if we get the same volume name twice */ + if (lastVolume[0] && strcmp(lastVolume, dcr->VolumeName) == 0) { + Dmsg1(100, "Got same vol = %s\n", lastVolume); + break; + } + bstrncpy(lastVolume, dcr->VolumeName, sizeof(lastVolume)); if (dcr->can_i_use_volume()) { Dmsg1(100, "Call reserve_volume. Vol=%s\n", dcr->VolumeName); if (reserve_volume(dcr, dcr->VolumeName) == 0) { diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 8b7802ee0d..4ba346bb2a 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -24,6 +24,11 @@ Add long term statistics job table General: +14Apr08 +kes Stop searching for Volumes in SD askdir if DIR returns the + same volume name twice in a row. +kes Close bat console windows first to eliminate error message + from the notifier. 13Apr08 kes Tweak the swap Volume from one drive to another code so that it now seems to work.