From: Michael Stapelberg Date: Wed, 30 Sep 2009 17:01:59 +0000 (+0200) Subject: Little fixes for the action_on_purge command X-Git-Tag: Release-5.0.0~282^2~16^2~7 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4570adc1c7c9177a3b1638793426c8b65598d51a;p=bacula%2Fbacula Little fixes for the action_on_purge command --- diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 255d7bbf27..37b32d77c9 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -952,7 +952,7 @@ bool db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) "MaxVolFiles,Recycle,Slot,FirstWritten,LastWritten,InChanger," "EndFile,EndBlock,VolParts,LabelType,LabelDate,StorageId," "Enabled,LocationId,RecycleCount,InitialWrite," - "ScratchPoolId,RecyclePoolId,VolReadTime,VolWriteTime " + "ScratchPoolId,RecyclePoolId,VolReadTime,VolWriteTime,ActionOnPurge " "FROM Media WHERE MediaId=%s", edit_int64(mr->MediaId, ed1)); } else { /* find by name */ @@ -962,7 +962,7 @@ bool db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) "MaxVolFiles,Recycle,Slot,FirstWritten,LastWritten,InChanger," "EndFile,EndBlock,VolParts,LabelType,LabelDate,StorageId," "Enabled,LocationId,RecycleCount,InitialWrite," - "ScratchPoolId,RecyclePoolId,VolReadTime,VolWriteTime " + "ScratchPoolId,RecyclePoolId,VolReadTime,VolWriteTime,ActionOnPurge " "FROM Media WHERE VolumeName='%s'", mr->VolumeName); } @@ -1020,6 +1020,7 @@ bool db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) mr->RecyclePoolId = str_to_int64(row[34]); mr->VolReadTime = str_to_int64(row[35]); mr->VolWriteTime = str_to_int64(row[36]); + mr->ActionOnPurge = str_to_int32(row[37]); ok = true; } diff --git a/bacula/src/dird/ua_purge.c b/bacula/src/dird/ua_purge.c index d9c967c504..e63cf1197a 100644 --- a/bacula/src/dird/ua_purge.c +++ b/bacula/src/dird/ua_purge.c @@ -599,7 +599,10 @@ bool mark_media_purged(UAContext *ua, MEDIA_DBR *mr) sd->signal(BNET_TERMINATE); sd->close(); ua->jcr->store_bsock = NULL; - } + } else { + ua->error_msg(_("Could not connect to storage daemon")); + return false; + } } pm_strcpy(jcr->VolumeName, mr->VolumeName); diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index c7d564c6ec..042a4ea3d7 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -887,9 +887,9 @@ static bool action_on_purge_cmd(JCR *jcr) int drive; int action; - if (sscanf(dir->msg, "action_on_purge_cmd %127s vol=%s action=%d", + if (sscanf(dir->msg, "action_on_purge %127s vol=%s action=%d", devname.c_str(), volumename.c_str(), &action) != 3) { - dir->fsend(_("3916 Error scanning action_on_purge_cmd command\n")); + dir->fsend(_("3916 Error scanning action_on_purge command\n")); goto done; }