From: Eric Bollengier Date: Mon, 27 Oct 2008 18:44:55 +0000 (+0000) Subject: ebl Make this patch "official" X-Git-Tag: Release-2.4.4~53 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f8acfd95fd86c54546355674637f06bf7e3bb581;p=bacula%2Fbacula ebl Make this patch "official" git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.4@7918 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/patches/2.4.3-update-slots.patch b/bacula/patches/2.4.3-update-slots.patch new file mode 100644 index 0000000000..0e019e3617 --- /dev/null +++ b/bacula/patches/2.4.3-update-slots.patch @@ -0,0 +1,79 @@ + + This patch corrects a problem when removing a volume from + an autochanger and the slot is still empty when running + update slots command. #1175 + + Apply it to version 2.4.3 with: + + cd + patch -p0 <2.4.3-update-slots.patch + ./configure + make + ... + make install + +Index: src/cats/sql_update.c +=================================================================== +--- src/cats/sql_update.c (revision 7854) ++++ src/cats/sql_update.c (working copy) +@@ -445,14 +445,28 @@ + db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) + { + char ed1[50], ed2[50]; +- if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0 && +- mr->MediaId != 0) { +- Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " +- "Slot=%d AND StorageId=%s AND MediaId!=%s", +- mr->Slot, +- edit_int64(mr->StorageId, ed1), edit_int64(mr->MediaId, ed2)); +- Dmsg1(400, "%s\n", mdb->cmd); +- UPDATE_DB(jcr, mdb, mdb->cmd); ++ if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0) { ++ ++ if (mr->MediaId != 0) { ++ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " ++ "Slot=%d AND StorageId=%s AND MediaId!=%s", ++ mr->Slot, ++ edit_int64(mr->StorageId, ed1), edit_int64(mr->MediaId, ed2)); ++ ++ } else if (*mr->VolumeName) { ++ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " ++ "Slot=%d AND StorageId=%s AND VolumeName!='%s'", ++ mr->Slot, ++ edit_int64(mr->StorageId, ed1), mr->VolumeName); ++ ++ } else { /* used by ua_label to reset all volume with this slot */ ++ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " ++ "Slot=%d AND StorageId=%s", ++ mr->Slot, ++ edit_int64(mr->StorageId, ed1), mr->VolumeName); ++ } ++ Dmsg1(100, "%s\n", mdb->cmd); ++ UPDATE_DB(jcr, mdb, mdb->cmd); + } + } + +Index: src/cats/sql_create.c +=================================================================== +--- src/cats/sql_create.c (revision 7854) ++++ src/cats/sql_create.c (working copy) +@@ -459,14 +459,13 @@ + "WHERE MediaId=%d", dt, mr->MediaId); + stat = UPDATE_DB(jcr, mdb, mdb->cmd); + } ++ /* ++ * Make sure that if InChanger is non-zero any other identical slot ++ * has InChanger zero. ++ */ ++ db_make_inchanger_unique(jcr, mdb, mr); + } + +- /* +- * Make sure that if InChanger is non-zero any other identical slot +- * has InChanger zero. +- */ +- db_make_inchanger_unique(jcr, mdb, mr); +- + db_unlock(mdb); + return stat; + } diff --git a/bacula/patches/testing/2.4.3-next-vol.patch b/bacula/patches/testing/2.4.3-next-vol.patch index cd3450064d..0d6e7033c0 100644 --- a/bacula/patches/testing/2.4.3-next-vol.patch +++ b/bacula/patches/testing/2.4.3-next-vol.patch @@ -187,3 +187,21 @@ Index: src/cats/sql_find.c } Dmsg1(050, "fnextvol=%s\n", mdb->cmd); if (!QUERY_DB(jcr, mdb, mdb->cmd)) { +Index: src/dird/autoprune.c +=================================================================== +--- src/dird/autoprune.c (revision 7854) ++++ src/dird/autoprune.c (working copy) +@@ -204,13 +204,6 @@ + memcpy(mr, &lmr, sizeof(lmr)); + break; /* got a volume */ + } +- /* +- * We purged something but did not get a volume in the current pool. +- * It must be a scratch volume, so try to get it. +- */ +- if (ok && get_scratch_volume(jcr, InChanger, mr)) { +- break; /* got a volume */ +- } + ok = false; /* clear OK, in case we fall out */ + } else { + Dmsg2(050, "Nothing pruned MediaId=%d Volume=%s\n", (int)lmr.MediaId, lmr.VolumeName); diff --git a/bacula/patches/testing/2.4.3-update-slots.patch b/bacula/patches/testing/2.4.3-update-slots.patch deleted file mode 100644 index 0e019e3617..0000000000 --- a/bacula/patches/testing/2.4.3-update-slots.patch +++ /dev/null @@ -1,79 +0,0 @@ - - This patch corrects a problem when removing a volume from - an autochanger and the slot is still empty when running - update slots command. #1175 - - Apply it to version 2.4.3 with: - - cd - patch -p0 <2.4.3-update-slots.patch - ./configure - make - ... - make install - -Index: src/cats/sql_update.c -=================================================================== ---- src/cats/sql_update.c (revision 7854) -+++ src/cats/sql_update.c (working copy) -@@ -445,14 +445,28 @@ - db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) - { - char ed1[50], ed2[50]; -- if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0 && -- mr->MediaId != 0) { -- Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " -- "Slot=%d AND StorageId=%s AND MediaId!=%s", -- mr->Slot, -- edit_int64(mr->StorageId, ed1), edit_int64(mr->MediaId, ed2)); -- Dmsg1(400, "%s\n", mdb->cmd); -- UPDATE_DB(jcr, mdb, mdb->cmd); -+ if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0) { -+ -+ if (mr->MediaId != 0) { -+ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " -+ "Slot=%d AND StorageId=%s AND MediaId!=%s", -+ mr->Slot, -+ edit_int64(mr->StorageId, ed1), edit_int64(mr->MediaId, ed2)); -+ -+ } else if (*mr->VolumeName) { -+ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " -+ "Slot=%d AND StorageId=%s AND VolumeName!='%s'", -+ mr->Slot, -+ edit_int64(mr->StorageId, ed1), mr->VolumeName); -+ -+ } else { /* used by ua_label to reset all volume with this slot */ -+ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " -+ "Slot=%d AND StorageId=%s", -+ mr->Slot, -+ edit_int64(mr->StorageId, ed1), mr->VolumeName); -+ } -+ Dmsg1(100, "%s\n", mdb->cmd); -+ UPDATE_DB(jcr, mdb, mdb->cmd); - } - } - -Index: src/cats/sql_create.c -=================================================================== ---- src/cats/sql_create.c (revision 7854) -+++ src/cats/sql_create.c (working copy) -@@ -459,14 +459,13 @@ - "WHERE MediaId=%d", dt, mr->MediaId); - stat = UPDATE_DB(jcr, mdb, mdb->cmd); - } -+ /* -+ * Make sure that if InChanger is non-zero any other identical slot -+ * has InChanger zero. -+ */ -+ db_make_inchanger_unique(jcr, mdb, mr); - } - -- /* -- * Make sure that if InChanger is non-zero any other identical slot -- * has InChanger zero. -- */ -- db_make_inchanger_unique(jcr, mdb, mr); -- - db_unlock(mdb); - return stat; - }