]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/ua_label.c
- Back port changes to 1.38.5
[bacula/bacula] / bacula / src / dird / ua_label.c
index 7b9778ef8d9e96236fa2d0e0840a9f9b4526a135..f94121061a4779673f327985ffe4ea9174bcee9c 100644 (file)
@@ -147,7 +147,7 @@ bail_out:
 /*
  * Update Slots corresponding to Volumes in autochanger
  */
-int update_slots(UAContext *ua)
+void update_slots(UAContext *ua)
 {
    STORE *store;
    vol_list_t *vl, *vol_list = NULL;
@@ -159,11 +159,11 @@ int update_slots(UAContext *ua)
 
 
    if (!open_db(ua)) {
-      return 1;
+      return;
    }
    store = get_storage_resource(ua, true/*arg is storage*/);
    if (!store) {
-      return 1;
+      return;
    }
    set_storage(ua->jcr, store);
    drive = get_storage_drive(ua, store);
@@ -174,12 +174,12 @@ int update_slots(UAContext *ua)
    Dmsg1(100, "max_slots=%d\n", max_slots);
    if (max_slots <= 0) {
       bsendmsg(ua, _("No slots in changer to scan.\n"));
-      return 1;
+      return;
    }
    slot_list = (char *)malloc(max_slots+1);
    if (!get_user_slot_list(ua, slot_list, max_slots)) {
       free(slot_list);
-      return 1;
+      return;
    }
 
    vol_list = get_vol_list_from_SD(ua, scan);
@@ -273,7 +273,7 @@ bail_out:
    free(slot_list);
    close_sd_bsock(ua);
 
-   return 1;
+   return;
 }
 
 
@@ -544,6 +544,10 @@ static void label_from_barcodes(UAContext *ua, int drive)
                 bsendmsg(ua, "%s", db_strerror(ua->db));
             }
          } else {                        /* create the media record */
+            if (pr.MaxVols > 0 && pr.NumVols >= pr.MaxVols) {
+               bsendmsg(ua, _("Maximum pool Volumes=%d reached.\n"), pr.MaxVols);
+               goto bail_out;
+            }
             set_pool_dbr_defaults_in_media_dbr(&mr, &pr);
             bstrncpy(mr.VolStatus, "Cleaning", sizeof(mr.VolStatus));
             mr.MediaType[0] = 0;