]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/mount.c
When read-only volume found mark it in catalog -- fixes bug #2337
[bacula/bacula] / bacula / src / stored / mount.c
index e763464f2b4d493afee9174cf11ec6ddefc7711d..a82a0ac6519d27832c74732a1bd76136a169ff36 100644 (file)
@@ -217,6 +217,7 @@ mount_next_vol:
 
       } else {
          Dmsg0(100, "set_unload\n");
+         mark_volume_read_only();
          dev->set_unload();              /* force ask sysop */
          ask = true;
       }
@@ -723,6 +724,23 @@ void DCR::mark_volume_in_error()
    dev->set_unload();                 /* must get a new volume */
 }
 
+/*
+ * Mark volume read_only in catalog
+ */
+void DCR::mark_volume_read_only()
+{
+   Jmsg(jcr, M_INFO, 0, _("Marking Volume \"%s\" Read-Only in Catalog.\n"),
+        VolumeName);
+   dev->VolCatInfo = VolCatInfo;       /* structure assignment */
+   dev->setVolCatStatus("Read-Only");
+   Dmsg0(150, "dir_update_vol_info. Set Read-Only.\n");
+   dir_update_volume_info(this, false, false);
+   volume_unused(this);
+   Dmsg0(50, "set_unload\n");
+   dev->set_unload();                 /* must get a new volume */
+}
+
+
 /*
  * The Volume is not in the correct slot, so mark this
  *   Volume as not being in the Changer.