From 4b5d0f64067693844f0981f447c37a505e245b2d Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 20 Nov 2008 09:39:38 +0000 Subject: [PATCH] ebl Apply 2.4.3-unique-inchanger.patch fix for #1175 about bad slot number if the volume is not in autochanger. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.4@8067 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/Patchnotes-2.4 | 2 ++ bacula/patches/2.4.3-unique-inchanger.patch | 39 +++++++++++++++++++++ bacula/src/cats/sql_update.c | 6 ++-- bacula/technotes-2.4 | 3 ++ 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 bacula/patches/2.4.3-unique-inchanger.patch diff --git a/bacula/Patchnotes-2.4 b/bacula/Patchnotes-2.4 index fe58141cf2..aefda16a41 100644 --- a/bacula/Patchnotes-2.4 +++ b/bacula/Patchnotes-2.4 @@ -5,6 +5,8 @@ Patches Released to Source Forge: 2.4.3-orphaned-jobs.patch Patches Committed: +20Nov08 +2.4.3-unique-inchanger.patch 18Nov08 2.4.3-purge-bug.patch 2.4.3-getmsg.patch diff --git a/bacula/patches/2.4.3-unique-inchanger.patch b/bacula/patches/2.4.3-unique-inchanger.patch new file mode 100644 index 0000000000..1cfa99c80c --- /dev/null +++ b/bacula/patches/2.4.3-unique-inchanger.patch @@ -0,0 +1,39 @@ + + This patch should fix the bug #1175 about Slot field + that is not reset after update slots. + Should work for 2.4.3 with 2.4.3-update-slots.patch + + cd + patch -p0 <2.4.3-unique-inchanger.patch + ./configure + make + ... + make install + +Index: src/cats/sql_update.c +=================================================================== +--- src/cats/sql_update.c (révision 8063) ++++ src/cats/sql_update.c (copie de travail) +@@ -448,19 +448,19 @@ + if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0) { + + if (mr->MediaId != 0) { +- Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " ++ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0, Slot=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[0]) { /* We have a volume name */ +- Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " ++ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0, Slot=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 " ++ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0, Slot=0 WHERE " + "Slot=%d AND StorageId=%s", + mr->Slot, + edit_int64(mr->StorageId, ed1), mr->VolumeName); diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index 46c62ed973..ad1116645d 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -448,19 +448,19 @@ db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0) { if (mr->MediaId != 0) { - Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " + Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0, Slot=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[0]) { /* We have a volume name */ - Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " + Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0, Slot=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 " + Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0, Slot=0 WHERE " "Slot=%d AND StorageId=%s", mr->Slot, edit_int64(mr->StorageId, ed1), mr->VolumeName); diff --git a/bacula/technotes-2.4 b/bacula/technotes-2.4 index cd4b21f66b..102b2dbb90 100644 --- a/bacula/technotes-2.4 +++ b/bacula/technotes-2.4 @@ -1,6 +1,9 @@ Technical notes on version 2.4 General: +20Nov08 +ebl Apply 2.4.3-unique-inchanger.patch fix for #1175 about bad slot + number if the volume is not in autochanger. 18Nov08 kes Probably fix for bug #1188 where Volume is purged while writing on it. -- 2.39.5