-/*
- *
- * label.c Bacula routines to handle labels
- *
- * Kern Sibbald, MM
- *
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ *
+ * label.c Bacula routines to handle labels
+ *
+ * Kern Sibbald, MM
+ *
+ *
+ * Version $Id$
+ */
#include "bacula.h" /* pull in global headers */
#include "stored.h" /* pull in Storage Deamon headers */
}
dev->set_labeled(); /* set has Bacula label */
- new_volume(dcr, dev->VolHdr.VolumeName);
+ if (reserve_volume(dcr, dev->VolHdr.VolumeName) == NULL) {
+ Mmsg2(jcr->errmsg, _("Could not reserve volume %s on %s\n"),
+ dev->VolHdr.VolumeName, dev->print_name());
+ stat = VOL_NAME_ERROR;
+ goto bail_out;
+ }
/* Compare Volume Names */
Dmsg2(30, "Compare Vol names: VolName=%s hdr=%s\n", VolName?VolName:"*", dev->VolHdr.VolumeName);
goto bail_out;
}
- if (relabel) {
- dev->close_part(dcr); /* make sure closed for rename */
+ if (relabel && !dev->is_tape()) {
+ dev->close_part(dcr); /* make sure DVD/file closed for rename */
}
/* Set the new filename for open, ... */
if (debug_level >= 20) {
dump_volume_label(dev);
}
- new_volume(dcr, VolName);
+ if (reserve_volume(dcr, VolName) == NULL) {
+ Mmsg2(dcr->jcr->errmsg, _("Could not reserve volume %s on %s\n"),
+ dev->VolHdr.VolumeName, dev->print_name());
+ goto bail_out;
+ }
+
dev->clear_append(); /* remove append since this is PRE_LABEL */
return true;