From 23f17bf6cbcd45f7f35da73c80fd17e3f140f184 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sat, 25 Oct 2008 08:09:23 +0000 Subject: [PATCH] ebl Add fix for #1175 git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.4@7898 91ce42f0-d328-0410-95d8-f526ca767f89 --- .../patches/testing/2.4.3-update-slots.patch | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 bacula/patches/testing/2.4.3-update-slots.patch diff --git a/bacula/patches/testing/2.4.3-update-slots.patch b/bacula/patches/testing/2.4.3-update-slots.patch new file mode 100644 index 0000000000..bdb7832e70 --- /dev/null +++ b/bacula/patches/testing/2.4.3-update-slots.patch @@ -0,0 +1,55 @@ + + 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 (révision 7854) ++++ src/cats/sql_update.c (copie de travail) +@@ -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); + } + } + -- 2.39.5