if (!store) {
return;
}
- set_storage(ua->jcr, store);
+ set_wstorage(ua->jcr, store);
drive = get_storage_drive(ua, store);
scan = find_arg(ua, NT_("scan")) >= 0;
if (!store) {
return 1;
}
- set_storage(ua->jcr, store);
+ set_wstorage(ua->jcr, store);
drive = get_storage_drive(ua, store);
if (label_barcodes) {
*/
static void label_from_barcodes(UAContext *ua, int drive)
{
- STORE *store = ua->jcr->store;
+ STORE *store = ua->jcr->wstore;
POOL_DBR pr;
MEDIA_DBR mr, omr;
vol_list_t *vl, *vol_list = NULL;
BSOCK *sd;
char dev_name[MAX_NAME_LENGTH];
bool ok = false;
+ bool is_dvd = false;
if (!(sd=open_sd_bsock(ua))) {
return false;
}
- bstrncpy(dev_name, ua->jcr->store->dev_name(), sizeof(dev_name));
+ bstrncpy(dev_name, ua->jcr->wstore->dev_name(), sizeof(dev_name));
bash_spaces(dev_name);
bash_spaces(mr->VolumeName);
bash_spaces(mr->MediaType);
if (strncmp(sd->msg, "3000 OK label.", 14) == 0) {
ok = true;
}
+ if (strncmp(sd->msg, "3000 OK label. DVD=1 ", 21) == 0) {
+ is_dvd = true;
+ }
}
unbash_spaces(mr->VolumeName);
unbash_spaces(mr->MediaType);
unbash_spaces(pr->Name);
mr->LabelDate = time(NULL);
mr->set_label_date = true;
+ if (is_dvd) {
+ /* We know that a freshly labelled DVD has 1 VolParts */
+ /* This does not apply to auto-labelled DVDs. */
+ mr->VolParts = 1;
+ }
if (ok) {
if (media_record_exists) { /* we update it */
mr->VolBytes = 1;
mr->InChanger = 1;
- mr->StorageId = ua->jcr->store->StorageId;
+ mr->StorageId = ua->jcr->wstore->StorageId;
if (!db_update_media_record(ua->jcr, ua->db, mr)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
ok = false;
set_pool_dbr_defaults_in_media_dbr(mr, pr);
mr->VolBytes = 1; /* flag indicating Volume labeled */
mr->InChanger = 1;
- mr->StorageId = ua->jcr->store->StorageId;
+ mr->StorageId = ua->jcr->wstore->StorageId;
mr->Enabled = 1;
if (db_create_media_record(ua->jcr, ua->db, mr)) {
bsendmsg(ua, _("Catalog record for Volume \"%s\", Slot %d successfully created.\n"),
static BSOCK *open_sd_bsock(UAContext *ua)
{
- STORE *store = ua->jcr->store;
+ STORE *store = ua->jcr->wstore;
if (!ua->jcr->store_bsock) {
bsendmsg(ua, _("Connecting to Storage daemon %s at %s:%d ...\n"),
- store->hdr.name, store->address, store->SDport);
+ store->name(), store->address, store->SDport);
if (!connect_to_storage_daemon(ua->jcr, 10, SDConnectTimeout, 1)) {
bsendmsg(ua, _("Failed to connect to Storage daemon.\n"));
return NULL;
static char *get_volume_name_from_SD(UAContext *ua, int Slot, int drive)
{
- STORE *store = ua->jcr->store;
+ STORE *store = ua->jcr->wstore;
BSOCK *sd;
char dev_name[MAX_NAME_LENGTH];
char *VolName = NULL;
*/
static vol_list_t *get_vol_list_from_SD(UAContext *ua, bool scan)
{
- STORE *store = ua->jcr->store;
+ STORE *store = ua->jcr->wstore;
char dev_name[MAX_NAME_LENGTH];
BSOCK *sd;
vol_list_t *vl;
*/
static int get_num_slots_from_SD(UAContext *ua)
{
- STORE *store = ua->jcr->store;
+ STORE *store = ua->jcr->wstore;
char dev_name[MAX_NAME_LENGTH];
BSOCK *sd;
int slots = 0;
*/
int get_num_drives_from_SD(UAContext *ua)
{
- STORE *store = ua->jcr->store;
+ STORE *store = ua->jcr->wstore;
char dev_name[MAX_NAME_LENGTH];
BSOCK *sd;
int drives = 0;