From 450009b7d7c3d14224e95fa26c72230ca62890f5 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 10 Jun 2004 13:08:01 +0000 Subject: [PATCH] update barcodes removes Volumes not in magazine git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1407 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 29 ++++++++++++++++++++++++++- bacula/src/dird/ua_label.c | 41 +++++++++++++++++++++++++++++--------- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index e2ead7b6f0..0852b32866 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -13,6 +13,34 @@ The BACULA-FD file is linked to missing export KERNEL32.DLL:GetFileAttributesExA. +Documentation from Christopher Hull on new client job requests: +=== +The command can be anything that cmd.exe or command.com will recognize +as a executable file. Specifiying the executable's extention is +optional, unless there is an ambiguity. (i.e. ls.bat, ls.exe) + +The System %Path% will be searched for the command. (under the +envrionment variable dialog you have have both System Environment and +User Environment, we believe that only the System environment will be +available to bacual-fd, if it is running as a service.) + +System environment varaible can be called out using the %var% syntax and +used as either part of the command name or arguments. + +When specifiying a full path to an executable if the path or executable +name contains whitespace or special characters they will need to be +quoted. Arguments containing whitespace or special characters will also +have to be quoted. + + ClientRunBeforeJob = "\"C:/Program Files/Software +Vendor/Executable\" /arg1 /arg2 \"foo bar\"" + +The special characters &()[]{}^=;!'+,`~ will need to be quoted if part +of a filename or argument. + +If someone is logged in a blank "command" window running the commands +will be present during the execution of the command. +=== Documentation to do: (any release a little bit at a time) - Document query file format. @@ -1060,4 +1088,3 @@ Block Position: 0 ... - Add regression of btape "fill" - diff --git a/bacula/src/dird/ua_label.c b/bacula/src/dird/ua_label.c index 1043855b05..d6a7364478 100644 --- a/bacula/src/dird/ua_label.c +++ b/bacula/src/dird/ua_label.c @@ -189,6 +189,10 @@ int update_slots(UAContext *ua) /* Walk through the list updating the media records */ for (vl=vol_list; vl; vl=vl->next) { + if (vl->Slot >= max_slots) { + bsendmsg(ua, _("Slot %d larger than max %d ignored.\n")); + continue; + } /* Check if user wants us to look at this slot */ if (!slot_list[vl->Slot]) { Dmsg1(100, "Skipping slot=%d\n", vl->Slot); @@ -203,8 +207,17 @@ int update_slots(UAContext *ua) vl->VolName = get_volume_name_from_SD(ua, vl->Slot); Dmsg2(100, "Got Vol=%s from SD for Slot=%d\n", vl->VolName, vl->Slot); } + slot_list[vl->Slot] = 0; /* clear Slot */ if (!vl->VolName) { - Dmsg1(100, "No VolName for Slot=%d skipping.\n", vl->Slot); + Dmsg1(100, "No VolName for Slot=%d setting InChanger to zero.\n", vl->Slot); + memset(&mr, 0, sizeof(mr)); + mr.Slot = vl->Slot; + mr.InChanger = 1; + /* Set InChanger to zero for this Slot */ + db_lock(ua->db); + db_make_inchanger_unique(ua->jcr, ua->db, &mr); + db_unlock(ua->db); + bsendmsg(ua, _("No VolName for Slot=%d set InChanger to zero.\n"), vl->Slot); continue; } memset(&mr, 0, sizeof(mr)); @@ -233,8 +246,19 @@ int update_slots(UAContext *ua) } db_unlock(ua->db); } - - + memset(&mr, 0, sizeof(mr)); + mr.InChanger = 1; + for (int i=1; idb); + db_make_inchanger_unique(ua->jcr, ua->db, &mr); + db_unlock(ua->db); + bsendmsg(ua, _("No VolName for Slot=%d set InChanger to zero.\n"), i); + } + } + bail_out: free_vol_list(vol_list); @@ -419,8 +443,7 @@ static void label_from_barcodes(UAContext *ua) slot_list = (char *)malloc(max_slots); if (!get_user_slot_list(ua, slot_list, max_slots)) { - free(slot_list); - return; + goto bail_out; } vol_list = get_vol_list_from_SD(ua, false /*no scan*/); @@ -498,13 +521,12 @@ static void label_from_barcodes(UAContext *ua) bstrncpy(mr.MediaType, store->media_type, sizeof(mr.MediaType)); mr.Slot = vl->Slot; - if (!send_label_request(ua, &mr, &omr, &pr, 0, media_record_exists)) { - goto bail_out; - } + send_label_request(ua, &mr, &omr, &pr, 0, media_record_exists); } bail_out: + free(slot_list); free_vol_list(vol_list); close_sd_bsock(ua); @@ -611,7 +633,7 @@ static int send_label_request(UAContext *ua, MEDIA_DBR *mr, MEDIA_DBR *omr, } } } else { - bsendmsg(ua, _("Label command failed.\n")); + bsendmsg(ua, _("Label command failed for Volume %s.\n"), mr->VolumeName); } return ok; } @@ -778,6 +800,7 @@ static vol_list_t *get_vol_list_from_SD(UAContext *ua, bool scan) static void free_vol_list(vol_list_t *vol_list) { vol_list_t *vl; + /* Free list */ for (vl=vol_list; vl; ) { vol_list_t *ovl; -- 2.39.5