any old volume. This must be done to keep the autochanger from
releasing subsequently newly reserved volumes in doing a close().
kes Fail if attempting to get console input in batch mode. This
should help fail RunScript console commands that are incomplete.
kes First cut implementing switch_drive() in SD (not actually called).
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6175
91ce42f0-d328-0410-95d8-
f526ca767f89
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2001-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2001-2008 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.
int stat;
ua->cmd[0] = 0;
- if (!sock) { /* No UA */
+ if (!sock || ua->batch) { /* No UA or batch mode */
return 0;
}
sock->fsend("%s", prompt);
- sock->signal(BNET_PROMPT); /* request more input */
+ sock->signal(BNET_PROMPT); /* request more input */
for ( ;; ) {
stat = sock->recv();
if (stat == BNET_SIGNAL) {
bstrncpy(store->pool_type, dcr->pool_type, sizeof(store->pool_type));
store->append = false;
rctx.store = store;
- dcr->keep_dcr = true; /* do not free the dcr */
- release_device(dcr);
- dcr->keep_dcr = false;
+ clean_device(dcr); /* clean up the dcr */
/*
* Search for a new device
return ok;
}
+/*
+ * Clean up the device for reuse without freeing the memory
+ */
+bool clean_device(DCR *dcr)
+{
+ bool ok;
+ dcr->keep_dcr = true; /* do not free the dcr */
+ ok = release_device(dcr);
+ dcr->keep_dcr = false;
+ return ok;
+}
+
/*
* Create a new Device Control Record and attach
* it to the device (if this is a real job).
DCR *acquire_device_for_append(DCR *dcr);
bool acquire_device_for_read(DCR *dcr);
bool release_device(DCR *dcr);
+bool clean_device(DCR *dcr);
DCR *new_dcr(JCR *jcr, DCR *dcr, DEVICE *dev);
void free_dcr(DCR *dcr);
void detach_dcr_from_dev(DCR *dcr);
goto get_out; /* Volume already on this device */
} else {
Dmsg2(dbglvl, "reserve_vol free vol=%s at %p\n", vol->vol_name, vol->vol_name);
- vol_list->remove(vol);
- free_vol_item(vol);
+ unload_autochanger(dcr, -1); /* unload the volume */
+ free_volume(dev);
debug_list_volumes("reserve_vol free");
}
}
return vol;
}
+/*
+ * Switch from current device to given device
+ */
+void switch_device(DCR *dcr, DEVICE *dev)
+{
+ // lock_reservations();
+ DCR save_dcr;
+
+ dev->dlock();
+ memcpy(&save_dcr, dcr, sizeof(save_dcr));
+ clean_device(dcr); /* clean up the dcr */
+
+ dcr->dev = dev; /* get new device pointer */
+ Jmsg(dcr->jcr, M_INFO, 0, _("Device switch. New device %s chosen.\n"),
+ dcr->dev->print_name());
+
+ bstrncpy(dcr->VolumeName, save_dcr.VolumeName, sizeof(dcr->VolumeName));
+ bstrncpy(dcr->media_type, save_dcr.media_type, sizeof(dcr->media_type));
+ dcr->VolCatInfo.Slot = save_dcr.VolCatInfo.Slot;
+ bstrncpy(dcr->pool_name, save_dcr.pool_name, sizeof(dcr->pool_name));
+ bstrncpy(dcr->pool_type, save_dcr.pool_type, sizeof(dcr->pool_type));
+ bstrncpy(dcr->dev_name, save_dcr.dev_name, sizeof(dcr->dev_name));
+
+ dev->reserved_device++;
+ dcr->reserved_device = true;
+
+ dev->dunlock();
+}
+
/*
* Search for a Volume name in the Volume list.
*
#undef VERSION
#define VERSION "2.3.8"
-#define BDATE "31 December 2007"
-#define LSMDATE "31Dec07"
+#define BDATE "02 January 2008"
+#define LSMDATE "02Jan08"
#define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n"
-#define BYEAR "2007" /* year for copyright messages in progs */
+#define BYEAR "2008" /* year for copyright messages in progs */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 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.
Technical notes on version 2.3
General:
+02Jan08
+kes Fix exist switch drive SD code to call autochanger to release
+ any old volume. This must be done to keep the autochanger from
+ releasing subsequently newly reserved volumes in doing a close().
+kes Fail if attempting to get console input in batch mode. This
+ should help fail RunScript console commands that are incomplete.
+kes First cut implementing switch_drive() in SD (not actually called).
31Dec07
kes Implement first cut running console commands in a RunScript.
29Dec07