/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2015 Kern Sibbald
+ Copyright (C) 2000-2017 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
Public License, v3.0 ("AGPLv3") and some additional permissions and
terms pursuant to its AGPLv3 Section 7.
- This notice must be preserved when any source code is
+ This notice must be preserved when any source code is
conveyed and/or propagated.
Bacula(R) is a registered trademark of Kern Sibbald.
*/
/*
- *
* Bacula Director -- Tape labeling commands
*
* Kern Sibbald, April MMIII
- *
*/
#include "bacula.h"
if (!store.store) {
return;
}
- pm_strcpy(store.store_source, _("command line"));
+ pm_strcpy(store.store_source, _("Command input"));
set_wstorage(ua->jcr, &store);
drive = get_storage_drive(ua, store.store);
if (!store.store) {
return 1;
}
- pm_strcpy(store.store_source, _("command line"));
+ pm_strcpy(store.store_source, _("Command input"));
set_wstorage(ua->jcr, &store);
drive = get_storage_drive(ua, store.store);
bash_spaces(dev_name);
sd->fsend("mount %s drive=%d slot=%d", dev_name, drive, mr.Slot);
unbash_spaces(dev_name);
- while (sd->recv() >= 0) {
+ while (bget_dirmsg(sd) >= 0) {
ua->send_msg("%s", sd->msg);
/* Here we can get
* 3001 OK mount. Device=xxx or
dev_name, mr->VolumeName, pr->Name, mr->MediaType, mr->Slot, drive);
}
- while (sd->recv() >= 0) {
+ while (bget_dirmsg(sd) >= 0) {
ua->send_msg("%s", sd->msg);
if (sscanf(sd->msg, "3000 OK label. VolBytes=%llu VolABytes=%lld VolType=%d ",
&VolBytes, &VolABytes, &VolType) == 3) {
ok = true;
- }
- }
- unbash_spaces(mr->VolumeName);
- unbash_spaces(mr->MediaType);
- unbash_spaces(pr->Name);
- mr->LabelDate = time(NULL);
- mr->set_label_date = true;
- if (ok) {
- if (media_record_exists) { /* we update it */
- mr->VolBytes = VolBytes;
- mr->VolABytes = VolABytes;
- mr->VolType = VolType;
- mr->InChanger = mr->Slot > 0; /* if slot give assume in changer */
- set_storageid_in_mr(ua->jcr->wstore, mr);
- if (!db_update_media_record(ua->jcr, ua->db, mr)) {
- ua->error_msg("%s", db_strerror(ua->db));
- ok = false;
- }
- } else { /* create the media record */
- set_pool_dbr_defaults_in_media_dbr(mr, pr);
- mr->VolBytes = VolBytes;
- mr->VolABytes = VolABytes;
- mr->VolType = VolType;
- mr->InChanger = mr->Slot > 0; /* if slot give assume in changer */
- mr->Enabled = 1;
- set_storageid_in_mr(ua->jcr->wstore, mr);
- if (db_create_media_record(ua->jcr, ua->db, mr)) {
- ua->info_msg(_("Catalog record for Volume \"%s\", Slot %d successfully created.\n"),
- mr->VolumeName, mr->Slot);
- /* Update number of volumes in pool */
- pr->NumVols++;
- if (!db_update_pool_record(ua->jcr, ua->db, pr)) {
+ if (media_record_exists) { /* we update it */
+ mr->VolBytes = VolBytes;
+ mr->VolABytes = VolABytes;
+ mr->VolType = VolType;
+ mr->InChanger = mr->Slot > 0; /* if slot give assume in changer */
+ set_storageid_in_mr(ua->jcr->wstore, mr);
+ if (!db_update_media_record(ua->jcr, ua->db, mr)) {
ua->error_msg("%s", db_strerror(ua->db));
+ ok = false;
+ }
+ } else { /* create the media record */
+ set_pool_dbr_defaults_in_media_dbr(mr, pr);
+ mr->VolBytes = VolBytes;
+ mr->VolABytes = VolABytes;
+ mr->VolType = VolType;
+ mr->InChanger = mr->Slot > 0; /* if slot give assume in changer */
+ mr->Enabled = 1;
+ set_storageid_in_mr(ua->jcr->wstore, mr);
+ if (db_create_media_record(ua->jcr, ua->db, mr)) {
+ ua->info_msg(_("Catalog record for Volume \"%s\", Slot %d successfully created.\n"),
+ mr->VolumeName, mr->Slot);
+ /* Update number of volumes in pool */
+ pr->NumVols++;
+ if (!db_update_pool_record(ua->jcr, ua->db, pr)) {
+ ua->error_msg("%s", db_strerror(ua->db));
+ }
+ } else {
+ ua->error_msg("%s", db_strerror(ua->db));
+ ok = false;
}
- } else {
- ua->error_msg("%s", db_strerror(ua->db));
- ok = false;
}
}
- } else {
+ }
+ if (!ok) {
ua->error_msg(_("Label command failed for Volume %s.\n"), mr->VolumeName);
}
return ok;
}
store.store = store_r;
- pm_strcpy(store.store_source, _("command line"));
+ pm_strcpy(store.store_source, _("Command input"));
set_wstorage(ua->jcr, &store);
get_storage_drive(ua, store.store);