From: Kern Sibbald Date: Sat, 7 Jul 2007 11:16:18 +0000 (+0000) Subject: kes Tweak some code in ua_update.c to use POOL_MEM instead of POOLMEM. X-Git-Tag: Release-7.0.0~6043 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4de11845286add9992a45295fc2f9bb0694eb1c3;p=bacula%2Fbacula kes Tweak some code in ua_update.c to use POOL_MEM instead of POOLMEM. kes Enhance Autochanger error messages to include Volume and device name. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5126 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/ua_update.c b/bacula/src/dird/ua_update.c index 4bbd113c59..b55e3dd97b 100644 --- a/bacula/src/dird/ua_update.c +++ b/bacula/src/dird/ua_update.c @@ -298,7 +298,7 @@ static void update_volslot(UAContext *ua, char *val, MEDIA_DBR *mr) void update_vol_pool(UAContext *ua, char *val, MEDIA_DBR *mr, POOL_DBR *opr) { POOL_DBR pr; - POOLMEM *query; + POOL_MEM query(PM_MESSAGE); char ed1[50], ed2[50]; memset(&pr, 0, sizeof(pr)); @@ -309,12 +309,10 @@ void update_vol_pool(UAContext *ua, char *val, MEDIA_DBR *mr, POOL_DBR *opr) mr->PoolId = pr.PoolId; /* set new PoolId */ /* */ - query = get_pool_memory(PM_MESSAGE); db_lock(ua->db); Mmsg(query, "UPDATE Media SET PoolId=%s WHERE MediaId=%s", - edit_int64(mr->PoolId, ed1), - edit_int64(mr->MediaId, ed2)); - if (!db_sql_query(ua->db, query, NULL, NULL)) { + edit_int64(mr->PoolId, ed1), edit_int64(mr->MediaId, ed2)); + if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { ua->error_msg("%s", db_strerror(ua->db)); } else { ua->info_msg(_("New Pool is: %s\n"), pr.Name); @@ -328,14 +326,13 @@ void update_vol_pool(UAContext *ua, char *val, MEDIA_DBR *mr, POOL_DBR *opr) } } db_unlock(ua->db); - free_pool_memory(query); } /* Modify the RecyclePool of a Volume */ void update_vol_recyclepool(UAContext *ua, char *val, MEDIA_DBR *mr) { POOL_DBR pr; - POOLMEM *query; + POOL_MEM query(PM_MESSAGE); char ed1[50], ed2[50]; memset(&pr, 0, sizeof(pr)); @@ -346,18 +343,15 @@ void update_vol_recyclepool(UAContext *ua, char *val, MEDIA_DBR *mr) /* pool = select_pool_resource(ua); */ mr->RecyclePoolId = pr.PoolId; /* get the PoolId */ - query = get_pool_memory(PM_MESSAGE); db_lock(ua->db); Mmsg(query, "UPDATE Media SET RecyclePoolId=%s WHERE MediaId=%s", - edit_int64(mr->RecyclePoolId, ed1), - edit_int64(mr->MediaId, ed2)); - if (!db_sql_query(ua->db, query, NULL, NULL)) { + edit_int64(mr->RecyclePoolId, ed1), edit_int64(mr->MediaId, ed2)); + if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { ua->error_msg("%s", db_strerror(ua->db)); } else { ua->info_msg(_("New RecyclePool is: %s\n"), pr.Name); } db_unlock(ua->db); - free_pool_memory(query); } /* diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index 2edd3f66c3..3776f92e2e 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -146,13 +146,17 @@ int autoload_device(DCR *dcr, int writing, BSOCK *dir) changer = get_pool_memory(PM_FNAME); if (slot <= 0) { - Jmsg(jcr, M_INFO, 0, _("Invalid slot=%d defined in catalog. Manual load my be required.\n"), slot); + Jmsg(jcr, M_INFO, 0, _("Invalid slot=%d defined in catalog for Volume \"%s\" " + "on %s. Manual load my be required.\n"), slot, dcr->VolCatInfo.VolCatName, + dev->print_name()); rtn_stat = 0; } else if (!dcr->device->changer_name) { - Jmsg(jcr, M_INFO, 0, _("No \"Changer Device\" manual load of Volume may be required.\n")); + Jmsg(jcr, M_INFO, 0, _("No \"Changer Device\" for %s. Manual load of Volume may be required.\n"), + dev->print_name()); rtn_stat = 0; } else if (!dcr->device->changer_command) { - Jmsg(jcr, M_INFO, 0, _("No \"Changer Command\" manual load of Volume may be requird.\n")); + Jmsg(jcr, M_INFO, 0, _("No \"Changer Command\" for %s. Manual load of Volume may be requird.\n"), + dev->print_name()); rtn_stat = 0; } else { /* Attempt to load the Volume */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 79d444adcb..837d191eda 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -2,6 +2,8 @@ General: 07Jul07 +kes Tweak some code in ua_update.c to use POOL_MEM instead of POOLMEM. +kes Enhance Autochanger error messages to include Volume and device name. kes Rework prune_volumes() code to take account of InChanger flag, and to handle recycling volumes going to the Scratch pool and current pool because the RecyclePool directive.