Skip to content

Commit

Permalink
Fix wrong sanity check.
Browse files Browse the repository at this point in the history
When comparing if we use the same read and write storage in migrations
and copies we should ignore any autochanger devices as its fine to use
those as both read and write device.
  • Loading branch information
Marco van Wieringen committed Sep 3, 2014
1 parent f0bd838 commit ac08c56
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/dird/migrate.c
Expand Up @@ -399,6 +399,24 @@ static bool set_migration_next_pool(JCR *jcr, POOLRES **retpool)
return true;
}

/*
* Sanity check that we are not using the same storage for reading and writing.
*/
static inline bool same_storage(JCR *jcr)
{
STORERES *read_store, *write_store;

read_store = (STORERES *)jcr->rstorage->first();
write_store = (STORERES *)jcr->wstorage->first();

if (!read_store->autochanger && !write_store->autochanger &&
bstrcmp(read_store->name(), write_store->name())) {
return true;
}

return false;
}

/*
* Do a Migration of a previous job
*
Expand Down Expand Up @@ -445,11 +463,7 @@ bool do_migration(JCR *jcr)
return true;
}

/*
* Sanity check that we are not using the same storage for reading and writing.
*/
if (bstrcmp(((STORERES *)jcr->rstorage->first())->name(),
((STORERES *)jcr->wstorage->first())->name())) {
if (same_storage(jcr)) {
Jmsg(jcr, M_FATAL, 0, _("JobId %s cannot %s using the same read and write storage.\n"),
edit_int64(jcr->previous_jr.JobId, ed1),
jcr->get_OperationName());
Expand Down

0 comments on commit ac08c56

Please sign in to comment.