From: Kern Sibbald Date: Mon, 23 Oct 2017 17:22:52 +0000 (+0200) Subject: When read-only volume found mark it in catalog -- fixes bug #2337 X-Git-Tag: Release-9.0.5~34 X-Git-Url: https://git.sur5r.net/?p=bacula%2Fbacula;a=commitdiff_plain;h=f0d5fe9ae8fea5f9cf0719b68f17ceb4833fb109 When read-only volume found mark it in catalog -- fixes bug #2337 --- diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index 918d88023e..924fa67994 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -790,6 +790,7 @@ public: bool mount_next_write_volume(); bool mount_next_read_volume(); void mark_volume_in_error(); + void mark_volume_read_only(); void mark_volume_not_inchanger(); int try_autolabel(bool opened); bool find_a_volume(); diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index e763464f2b..a82a0ac651 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -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.