*
*/
+/*
+ * Some details of how volume and device reservations work
+ *
+ * class VOLRES:
+ * set_in_use() volume being used on current drive
+ * clear_in_use() no longer being used. Can be re-used or moved.
+ * set_swapping() set volume being moved to another drive
+ * is_swapping() volume is being moved to another drive
+ * clear_swapping() volume normal
+ *
+ * class DEVICE:
+ * set_load() set to load volume
+ * needs_load() volume must be loaded (i.e. set_load done)
+ * clear_load() load done.
+ * set_unload() set to unload volume
+ * needs_unload() volume must be unloaded
+ * clear_unload() volume unloaded
+ *
+ * reservations are temporary until the drive is acquired
+ * inc_reserved() increments num of reservations
+ * dec_reserved() decrements num of reservations
+ * num_reserved() number of reservations
+ *
+ * class DCR:
+ * set_reserved() sets local reserve flag and calls dev->inc_reserved()
+ * clear_reserved() clears local reserve flag and calls dev->dec_reserved()
+ * is_reserved() returns local reserved flag
+ * unreserve_device() much more complete unreservation
+ *
+ */
+
#ifndef __DEV_H
#define __DEV_H 1
int m_blocked; /* set if we must wait (i.e. change tape) */
int m_count; /* Mutex use count -- DEBUG only */
pthread_t m_pid; /* Thread that locked -- DEBUG only */
+ bool m_unload; /* set when Volume must be unloaded */
+ bool m_load; /* set when Volume must be loaded */
+ int m_num_reserved; /* counter of device reservations */
public:
+ DEVICE * volatile swap_dev; /* Swap vol from this device */
dlist *attached_dcrs; /* attached DCR list */
pthread_mutex_t m_mutex; /* access control */
pthread_mutex_t spool_mutex; /* mutex for updating spool_size */
int dev_prev_blocked; /* previous blocked state */
int num_waiting; /* number of threads waiting */
int num_writers; /* number of writing threads */
- int reserved_device; /* number of device reservations */
int capabilities; /* capabilities mask */
int state; /* state mask */
int dev_errno; /* Our own errno */
int is_labeled() const { return state & ST_LABEL; }
int is_mounted() const { return state & ST_MOUNTED; }
int is_unmountable() const { return (is_dvd() || (is_file() && is_removable())); }
+ int num_reserved() const { return m_num_reserved; };
int is_part_spooled() const { return state & ST_PART_SPOOLED; }
int have_media() const { return state & ST_MEDIA; }
int is_short_block() const { return state & ST_SHORT; }
- int is_busy() const { return (state & ST_READ) || num_writers || reserved_device; }
+ int is_busy() const { return (state & ST_READ) || num_writers || num_reserved(); }
int at_eof() const { return state & ST_EOF; }
int at_eot() const { return state & ST_EOT; }
int at_weot() const { return state & ST_WEOT; }
(m_blocked == BST_UNMOUNTED ||
m_blocked == BST_WAITING_FOR_SYSOP ||
m_blocked == BST_UNMOUNTED_WAITING_FOR_SYSOP); };
+ bool must_unload() const { return m_unload; };
+ bool must_load() const { return m_load; };
const char *strerror() const;
const char *archive_name() const;
const char *name() const;
void set_part_spooled(int val) { if (val) state |= ST_PART_SPOOLED; \
else state &= ~ST_PART_SPOOLED;
};
+ void set_unload() { m_unload = true; };
+ void set_load() { m_load = true; };
+ void inc_reserved() { m_num_reserved++; }
void set_mounted(int val) { if (val) state |= ST_MOUNTED; \
else state &= ~ST_MOUNTED; };
+ void dec_reserved() { m_num_reserved--; ASSERT(m_num_reserved>=0); };
void clear_append() { state &= ~ST_APPEND; };
void clear_read() { state &= ~ST_READ; };
void clear_labeled() { state &= ~ST_LABEL; };
void clear_media() { state &= ~ST_MEDIA; };
void clear_short_block() { state &= ~ST_SHORT; };
void clear_freespace_ok() { state &= ~ST_FREESPACE_OK; };
+ void clear_unload() { m_unload = false; };
+ void clear_load() { m_load = false; };
char *bstrerror(void) { return errmsg; };
char *print_errmsg() { return errmsg; };
class DCR {
private:
bool m_dev_locked; /* set if dev already locked */
+ bool m_reserved; /* set if reserved device */
+ bool m_found_in_use; /* set if a volume found in use */
public:
dlink dev_link; /* link to attach to dev */
JCR *jcr; /* pointer to JCR */
DEVICE * volatile dev; /* pointer to device */
- DEVICE * volatile swap_dev; /* Swap vol from this device */
DEVRES *device; /* pointer to device resource */
DEV_BLOCK *block; /* pointer to block */
DEV_RECORD *rec; /* pointer to record */
bool NewVol; /* set if new Volume mounted */
bool WroteVol; /* set if Volume written */
bool NewFile; /* set when EOF written */
- bool reserved_device; /* set if reserve done */
bool reserved_volume; /* set if we reserved a volume */
bool any_volume; /* Any OK for dir_find_next... */
bool attached_to_dev; /* set when attached to dev */
- bool volume_in_use; /* set in dir_find_next_appendable_volume() */
bool keep_dcr; /* do not free dcr in release_dcr */
- bool unload_device; /* set if device must be unloaded */
uint32_t VolFirstIndex; /* First file index this Volume */
uint32_t VolLastIndex; /* Last file index this Volume */
uint32_t FileIndex; /* Current File Index */
VOLUME_CAT_INFO VolCatInfo; /* Catalog info for desired volume */
/* Methods */
+ bool found_in_use() const { return m_found_in_use; };
+ void set_found_in_use() { m_found_in_use = true; };
+ void clear_found_in_use() { m_found_in_use = false; };
+ bool is_reserved() const { return m_reserved; };
bool is_dev_locked() { return m_dev_locked; }
void dlock() { dev->dlock(); m_dev_locked = true; }
void dunlock() { m_dev_locked = false; dev->dunlock(); }
void dblock(int why) { dev->dblock(why); }
+
+ /* Methods in reserve.c */
+ void clear_reserved();
+ void set_reserved();
+ void unreserve_device();
+ bool can_i_use_volume();
+
/* Methods in mount.c */
bool mount_next_write_volume();
bool mount_next_read_volume();
*/
class VOLRES {
bool m_swapping; /* set when swapping to another drive */
- bool m_reserved; /* set when volume reserved */
+ bool m_in_use; /* set when volume reserved or in use */
public:
dlink link;
char *vol_name; /* Volume name */
bool is_swapping() const { return m_swapping; };
void set_swapping() { m_swapping = true; };
void clear_swapping() { m_swapping = false; };
- bool is_reserved() const { return m_reserved; };
- void set_reserved() { m_reserved = true; };
- void clear_reserved() { m_reserved = false; };
+ bool is_in_use() const { return m_in_use; };
+ void set_in_use() { m_in_use = true; };
+ void clear_in_use() { m_in_use = false; };
};
static bool use_storage_cmd(JCR *jcr);
static void queue_reserve_message(JCR *jcr);
static void pop_reserve_messages(JCR *jcr);
-void switch_device(DCR *dcr, DEVICE *dev);
+//void switch_device(DCR *dcr, DEVICE *dev);
/* Requests from the Director daemon */
static char use_storage[] = "use storage=%127s media_type=%127s "
lock_volumes();
foreach_dlist(vol, vol_list) {
if (vol->dev) {
- Mmsg(msg, "List %s: %s reserved=%d on device %s\n", imsg,
- vol->vol_name, vol->is_reserved(), vol->dev->print_name());
+ Mmsg(msg, "List %s: %s in_use=%d on device %s\n", imsg,
+ vol->vol_name, vol->is_in_use(), vol->dev->print_name());
} else {
- Mmsg(msg, "List %s: %s reserved=%d no dev\n", imsg, vol->vol_name,
- vol->is_reserved());
+ Mmsg(msg, "List %s: %s in_use=%d no dev\n", imsg, vol->vol_name,
+ vol->is_in_use());
}
Dmsg1(dbglvl, "%s", msg.c_str());
}
if (dev) {
len = Mmsg(msg, "%s on device %s\n", vol->vol_name, dev->print_name());
sendit(msg.c_str(), len, arg);
- len = Mmsg(msg, " Reader=%d writers=%d devres=%d volres=%d\n",
- dev->can_read()?1:0, dev->num_writers, dev->reserved_device,
- vol->is_reserved());
+ len = Mmsg(msg, " Reader=%d writers=%d devres=%d volinuse=%d\n",
+ dev->can_read()?1:0, dev->num_writers, dev->num_reserved(),
+ vol->is_in_use());
sendit(msg.c_str(), len, arg);
} else {
- len = Mmsg(msg, "%s no device. volres= %d\n", vol->vol_name,
- vol->is_reserved());
+ len = Mmsg(msg, "%s no device. volinuse= %d\n", vol->vol_name,
+ vol->is_in_use());
sendit(msg.c_str(), len, arg);
}
}
}
}
-
/*
* Put a new Volume entry in the Volume list. This
* effectively reserves the volume so that it will
*
* 1. The Volume list entry must be attached to the drive (rather than
* attached to a job as it currently is. I.e. the drive that "owns"
- * the volume (reserved, in use, mounted)
+ * the volume (in use, mounted)
* must point to the volume (still to be maintained in a list).
*
* 2. The Volume is entered in the list when a drive is reserved.
*/
if (dev->vol) {
vol = dev->vol;
- Dmsg4(dbglvl, "Vol attached=%s, newvol=%s volres=%d on %s\n",
- vol->vol_name, VolumeName, vol->is_reserved(), dev->print_name());
+ Dmsg4(dbglvl, "Vol attached=%s, newvol=%s volinuse=%d on %s\n",
+ vol->vol_name, VolumeName, vol->is_in_use(), dev->print_name());
/*
* Make sure we don't remove the current volume we are inserting
* because it was probably inserted by another job, or it
if (strcmp(vol->vol_name, VolumeName) == 0) {
Dmsg2(dbglvl, "=== set reserved vol=%s dev=%s\n", VolumeName,
vol->dev->print_name());
- vol->set_reserved(); /* retake vol if released previously */
+ vol->set_in_use(); /* retake vol if released previously */
dcr->reserved_volume = true; /* reserved volume */
goto get_out; /* Volume already on this device */
} else {
/* Don't release a volume if it was reserved by someone other than us */
- if (vol->is_reserved() && !dcr->reserved_volume) {
+ if (vol->is_in_use() && !dcr->reserved_volume) {
Dmsg1(dbglvl, "Cannot free vol=%s. It is reserved.\n", vol->vol_name);
vol = NULL; /* vol in use */
goto get_out;
}
Dmsg2(dbglvl, "reserve_vol free vol=%s at %p\n", vol->vol_name, vol->vol_name);
free_volume(dev);
- dcr->unload_device = true; /* have to unload current volume */
+ dev->set_unload(); /* have to unload current volume */
debug_list_volumes("reserve_vol free");
}
}
if (dev != vol->dev) {
/* Caller wants to switch Volume to another device */
if (!vol->dev->is_busy() && !vol->is_swapping()) {
+ Dmsg3(dbglvl, "==== Swap vol=%s from dev=%s to %s\n",
+ VolumeName, vol->dev->print_name(), dev->print_name());
+ free_volume(dev); /* free any volume attached to our drive */
vol->set_swapping();
- dcr->swap_dev = vol->dev; /* remember to get this vol */
+ vol->dev->set_unload();
+ dev->swap_dev = vol->dev; /* remember to get this vol */
+ vol->dev->vol = NULL; /* take volume */
+ vol->dev = dev;
+ dev->vol = vol;
Dmsg3(dbglvl, "==== Swap vol=%s from dev=%s to %s\n",
VolumeName, vol->dev->print_name(), dev->print_name());
} else {
Dmsg3(dbglvl, "==== Swap not possible Vol busy vol=%s from dev=%s to %s\n",
VolumeName, vol->dev->print_name(), dev->print_name());
- vol = NULL; /* device busy */
+ vol = NULL; /* device busy */
goto get_out;
}
} else {
get_out:
if (vol) {
- Dmsg2(dbglvl, "=== set reserved. vol=%s dev=%s\n", vol->vol_name,
+ Dmsg2(dbglvl, "=== set in_use. vol=%s dev=%s\n", vol->vol_name,
vol->dev->print_name());
- vol->set_reserved();
+ vol->set_in_use();
dcr->reserved_volume = true;
}
debug_list_volumes("end new volume");
* Switch from current device to given device
* (not yet used)
*/
+#ifdef xxx
void switch_device(DCR *dcr, DEVICE *dev)
{
DCR save_dcr;
bstrncpy(dcr->pool_type, save_dcr.pool_type, sizeof(dcr->pool_type));
bstrncpy(dcr->dev_name, dev->dev_name, sizeof(dcr->dev_name));
- dev->reserved_device++;
- dcr->reserved_device = true;
+// dcr->set_reserved();
dev->dunlock();
}
+#endif
/*
* Search for a Volume name in the Volume list.
* Returns: VOLRES entry on success
* NULL if the Volume is not in the list
*/
-VOLRES *find_volume(DCR *dcr)
+VOLRES *find_volume(const char *VolumeName)
{
VOLRES vol, *fvol;
/* Do not lock reservations here */
lock_volumes();
- vol.vol_name = bstrdup(dcr->VolumeName);
+ vol.vol_name = bstrdup(VolumeName);
fvol = (VOLRES *)vol_list->binary_search(&vol, my_compare);
free(vol.vol_name);
- Dmsg2(dbglvl, "find_vol=%s found=%d\n", dcr->VolumeName, fvol!=NULL);
+ Dmsg2(dbglvl, "find_vol=%s found=%d\n", VolumeName, fvol!=NULL);
debug_list_volumes("find_volume");
unlock_volumes();
return fvol;
}
+void DCR::set_reserved()
+{
+ m_reserved = true;
+ Dmsg2(dbglvl, "Inc reserve=%d dev=%s\n", dev->num_reserved(), dev->print_name());
+ dev->inc_reserved();
+}
+
+void DCR::clear_reserved()
+{
+ if (m_reserved) {
+ m_reserved = false;
+ dev->dec_reserved();
+ Dmsg2(dbglvl, "Dec reserve=%d dev=%s\n", dev->num_reserved(), dev->print_name());
+ }
+}
+
/*
* Remove any reservation from a drive and tell the system
* that the volume is unused at least by us.
*/
-void unreserve_device(DCR *dcr)
+void DCR::unreserve_device()
{
- DEVICE *dev = dcr->dev;
lock_volumes();
- if (dcr->reserved_device) {
- dcr->reserved_device = false;
- dcr->reserved_volume = false;
- dev->reserved_device--;
- Dmsg2(dbglvl, "Dec reserve=%d dev=%s\n", dev->reserved_device, dev->print_name());
+ if (is_reserved()) {
+ clear_reserved();
+ reserved_volume = false;
/* If we set read mode in reserving, remove it */
if (dev->can_read()) {
dev->clear_read();
}
if (dev->num_writers < 0) {
- Jmsg1(dcr->jcr, M_ERROR, 0, _("Hey! num_writers=%d!!!!\n"), dev->num_writers);
+ Jmsg1(jcr, M_ERROR, 0, _("Hey! num_writers=%d!!!!\n"), dev->num_writers);
dev->num_writers = 0;
}
- if (dev->reserved_device == 0 && dev->num_writers == 0) {
- volume_unused(dcr);
+ if (dev->num_reserved() == 0 && dev->num_writers == 0) {
+ volume_unused(this);
}
}
unlock_volumes();
}
#endif
#ifdef xxx
- if (dev->num_writers > 0 || dev->reserved_device > 0) {
+ if (dev->num_writers > 0 || dev->num_reserved() > 0) {
ASSERT(0);
}
#endif
* where the tapes are or last were.
*/
Dmsg3(dbglvl, "=== mark not reserved vol=%s num_writers=%d dev_reserved=%d\n",
- dev->vol->vol_name, dev->num_writers, dev->reserved_device);
- dev->vol->clear_reserved();
+ dev->vol->vol_name, dev->num_writers, dev->num_reserved());
+ dev->vol->clear_in_use();
Dmsg2(dbglvl, "=== set not reserved. Vol=%s dev=%s\n", dev->vol->vol_name,
dev->print_name());
if (dev->is_tape() || dev->is_autochanger()) {
unlock_volumes();
}
-bool is_volume_in_use(DCR *dcr)
+bool DCR::can_i_use_volume()
{
- bool rtn = false;
+ bool rtn = true;
VOLRES *vol;
lock_volumes();
- vol = find_volume(dcr);
+ vol = find_volume(VolumeName);
if (!vol) {
- Dmsg1(dbglvl, "Vol=%s not in use.\n", dcr->VolumeName);
+ Dmsg1(dbglvl, "Vol=%s not in use.\n", VolumeName);
goto get_out; /* vol not in list */
}
ASSERT(vol->dev != NULL);
- if (dcr->dev == vol->dev) { /* same device OK */
- Dmsg1(dbglvl, "Vol=%s on same dev.\n", dcr->VolumeName);
+ if (dev == vol->dev) { /* same device OK */
+ Dmsg1(dbglvl, "Vol=%s on same dev.\n", VolumeName);
goto get_out;
} else {
- Dmsg3(dbglvl, "Vol=%s on %s we have %s\n", dcr->VolumeName,
- vol->dev->print_name(), dcr->dev->print_name());
+ Dmsg3(dbglvl, "Vol=%s on %s we have %s\n", VolumeName,
+ vol->dev->print_name(), dev->print_name());
}
+ /* ***FIXME*** check this ... */
if (!vol->dev->is_busy()) {
- Dmsg2(dbglvl, "Vol=%s dev=%s not busy.\n", dcr->VolumeName, vol->dev->print_name());
+ Dmsg2(dbglvl, "Vol=%s dev=%s not busy.\n", VolumeName, vol->dev->print_name());
goto get_out;
} else {
- Dmsg2(dbglvl, "Vol=%s dev=%s busy.\n", dcr->VolumeName, vol->dev->print_name());
+ Dmsg2(dbglvl, "Vol=%s dev=%s busy.\n", VolumeName, vol->dev->print_name());
}
- Dmsg2(dbglvl, "Vol=%s in use by %s.\n", dcr->VolumeName, vol->dev->print_name());
- rtn = true;
+ Dmsg2(dbglvl, "Vol=%s in use by %s.\n", VolumeName, vol->dev->print_name());
+ rtn = false;
get_out:
unlock_volumes();
/* Debug code */
if (rctx.store->append == SD_APPEND) {
Dmsg2(dbglvl, "Device %s reserved=%d for append.\n",
- rctx.device->hdr.name, rctx.jcr->dcr->dev->reserved_device);
+ rctx.device->hdr.name, rctx.jcr->dcr->dev->num_reserved());
} else {
Dmsg2(dbglvl, "Device %s reserved=%d for read.\n",
- rctx.device->hdr.name, rctx.jcr->read_dcr->dev->reserved_device);
+ rctx.device->hdr.name, rctx.jcr->read_dcr->dev->num_reserved());
}
return stat;
}
/* Debug code */
if (rctx.store->append == SD_APPEND) {
Dmsg2(dbglvl, "Device %s reserved=%d for append.\n",
- rctx.device->hdr.name, rctx.jcr->dcr->dev->reserved_device);
+ rctx.device->hdr.name, rctx.jcr->dcr->dev->num_reserved());
} else {
Dmsg2(dbglvl, "Device %s reserved=%d for read.\n",
- rctx.device->hdr.name, rctx.jcr->read_dcr->dev->reserved_device);
+ rctx.device->hdr.name, rctx.jcr->read_dcr->dev->num_reserved());
}
return stat;
}
rctx.jcr->dcr = dcr;
Dmsg5(dbglvl, "Reserved=%d dev_name=%s mediatype=%s pool=%s ok=%d\n",
- dcr->dev->reserved_device,
+ dcr->dev->num_reserved(),
dcr->dev_name, dcr->media_type, dcr->pool_name, ok);
Dmsg3(dbglvl, "Vol=%s num_writers=%d, have_vol=%d\n",
rctx.VolumeName, dcr->dev->num_writers, rctx.have_volume);
* non-used drive and our one and only volume is mounted
* elsewhere, so we bail out and retry using that drive.
*/
- if (dcr->volume_in_use && !rctx.PreferMountedVols) {
+ if (dcr->found_in_use() && !rctx.PreferMountedVols) {
rctx.PreferMountedVols = true;
if (dcr->VolumeName[0]) {
- unreserve_device(dcr);
+ dcr->unreserve_device();
}
goto bail_out;
}
*/
if (dcr->dev->num_writers != 0) {
if (dcr->VolumeName[0]) {
- unreserve_device(dcr);
+ dcr->unreserve_device();
}
goto bail_out;
}
if (ok) {
rctx.jcr->read_dcr = dcr;
Dmsg5(dbglvl, "Read reserved=%d dev_name=%s mediatype=%s pool=%s ok=%d\n",
- dcr->dev->reserved_device,
+ dcr->dev->num_reserved(),
dcr->dev_name, dcr->media_type, dcr->pool_name, ok);
}
}
if (dev->is_busy()) {
Dmsg4(dbglvl, "Device %s is busy ST_READ=%d num_writers=%d reserved=%d.\n",
dev->print_name(),
- dev->state & ST_READ?1:0, dev->num_writers, dev->reserved_device);
+ dev->state & ST_READ?1:0, dev->num_writers, dev->num_reserved());
Mmsg(jcr->errmsg, _("3602 JobId=%u device %s is busy (already reading/writing).\n"),
jcr->JobId, dev->print_name());
queue_reserve_message(jcr);
dev->clear_append();
dev->set_read();
ok = true;
- dev->reserved_device++;
- Dmsg3(dbglvl, "Inc reserve=%d dev=%s %p\n", dev->reserved_device, dev->print_name(), dev);
- dcr->reserved_device = true;
+ dcr->set_reserved();
bail_out:
dev->dunlock();
goto bail_out;
}
- dev->reserved_device++;
- Dmsg3(dbglvl, "Inc reserve=%d dev=%s %p\n", dev->reserved_device,
- dev->print_name(), dev);
- dcr->reserved_device = true;
+ dcr->set_reserved();
ok = true;
bail_out:
Mmsg(jcr->errmsg, _(
"3608 JobId=%u wants Pool=\"%s\" but have Pool=\"%s\" nreserve=%d on drive %s.\n"),
(uint32_t)jcr->JobId, dcr->pool_name, dev->pool_name,
- dev->reserved_device, dev->print_name());
+ dev->num_reserved(), dev->print_name());
queue_reserve_message(jcr);
Dmsg2(dbglvl, "failed: busy num_writers=0, reserved, pool=%s wanted=%s\n",
dev->pool_name, dcr->pool_name);
Dmsg4(dbglvl, "MaxJobs=%d Jobs=%d reserves=%d Vol=%s\n",
dcr->VolCatInfo.VolCatMaxJobs,
- dcr->VolCatInfo.VolCatJobs, dev->reserved_device,
+ dcr->VolCatInfo.VolCatJobs, dev->num_reserved(),
dcr->VolumeName);
if (dcr->VolCatInfo.VolCatMaxJobs > 0 && dcr->VolCatInfo.VolCatMaxJobs <=
- (dcr->VolCatInfo.VolCatJobs + dev->reserved_device)) {
+ (dcr->VolCatInfo.VolCatJobs + dev->num_reserved())) {
/* Max Job Vols depassed or already reserved */
Mmsg(jcr->errmsg, _("3610 JobId=%u Volume max jobs exceeded on drive %s.\n"),
(uint32_t)jcr->JobId, dev->print_name());
/* If he wants a free drive, but this one is busy, no go */
if (!rctx.PreferMountedVols && dev->is_busy()) {
/* Save least used drive */
- if ((dev->num_writers + dev->reserved_device) < rctx.num_writers) {
- rctx.num_writers = dev->num_writers + dev->reserved_device;
+ if ((dev->num_writers + dev->num_reserved()) < rctx.num_writers) {
+ rctx.num_writers = dev->num_writers + dev->num_reserved();
rctx.low_use_drive = dev;
Dmsg2(dbglvl, "set low use drive=%s num_writers=%d\n",
dev->print_name(), rctx.num_writers);
} else {
- Dmsg1(dbglvl, "not low use num_writers=%d\n", dev->num_writers+dev->reserved_device);
+ Dmsg1(dbglvl, "not low use num_writers=%d\n", dev->num_writers+dev->num_reserved());
}
Dmsg0(dbglvl, "failed: !prefMnt && busy.\n");
Mmsg(jcr->errmsg, _("3605 JobId=%u wants free drive but device %s is busy.\n"),
dev->VolHdr.VolumeName, dev->vol?dev->vol->vol_name:"*none*", rctx.VolumeName);
return 0;
}
- if (is_volume_in_use(dcr)) {
+ if (!dcr->can_i_use_volume()) {
return 0; /* fail if volume on another drive */
}
}
*/
if (dev->num_writers == 0) {
/* Now check if there are any reservations on the drive */
- if (dev->reserved_device) {
+ if (dev->num_reserved()) {
return is_pool_ok(dcr);
} else if (dev->can_append()) {
if (is_pool_ok(dcr)) {
} else {
/* Changing pool, unload old tape if any in drive */
Dmsg0(dbglvl, "OK dev: num_writers=0, not reserved, pool change, unload changer\n");
+ /* ***FIXME*** use set_unload() */
unload_autochanger(dcr, 0);
}
}