Skip to content

Commit

Permalink
stored reserve: removed error and unneeded include
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Jul 3, 2018
1 parent f007648 commit f497df8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
4 changes: 2 additions & 2 deletions core/src/dird/msgchan.cc
Expand Up @@ -303,7 +303,7 @@ bool StartStorageDaemonJob(JobControlRecord *jcr, alist *rstore, alist *wstore,
sd->signal(BNET_EOD); /* end of Devices */
}
sd->signal(BNET_EOD); /* end of Storages */
if (BgetDirmsg(sd) > 0) { //--> ueb
if (BgetDirmsg(sd) > 0) {
Dmsg1(100, "<stored: %s", sd->msg);
/* ****FIXME**** save actual device name */
ok = sscanf(sd->msg, OK_device, device_name.c_str()) == 1;
Expand Down Expand Up @@ -341,7 +341,7 @@ bool StartStorageDaemonJob(JobControlRecord *jcr, alist *rstore, alist *wstore,
sd->signal(BNET_EOD); /* end of Devices */
}
sd->signal(BNET_EOD); /* end of Storages */
if (BgetDirmsg(sd) > 0) { //--> ueb
if (BgetDirmsg(sd) > 0) {
Dmsg1(100, "<stored: %s", sd->msg);
/* ****FIXME**** save actual device name */
ok = sscanf(sd->msg, OK_device, device_name.c_str()) == 1;
Expand Down
21 changes: 6 additions & 15 deletions core/src/stored/reserve.cc
Expand Up @@ -180,13 +180,13 @@ void DeviceControlRecord::UnreserveDevice()
dev->Unlock();
}

static bool wiffle(JobControlRecord *jcr, int32_t append, std::string dev_name)
bool UseDeviceReserve(JobControlRecord *jcr)
{
ReserveContext reserve_context;
memset(&reserve_context, 0, sizeof(ReserveContext));

reserve_context.jcr = jcr;
reserve_context.append = append;
reserve_context.append = jcr->append;

int wait_for_device_retries = 0;
int repeat = 0;
Expand Down Expand Up @@ -296,7 +296,7 @@ static bool wiffle(JobControlRecord *jcr, int32_t append, std::string dev_name)
PmStrcpy(jcr->errmsg, jcr->dir_bsock->msg);
Jmsg(jcr, M_FATAL, 0, _("Device reservation failed for JobId=%d: %s\n"),
jcr->JobId, jcr->errmsg);
jcr->dir_bsock->fsend(NO_device, dev_name.c_str());
jcr->dir_bsock->fsend(NO_device, jcr->dev_name);

Dmsg1(debuglevel, ">dird: %s", jcr->dir_bsock->msg);
return false;
Expand Down Expand Up @@ -376,7 +376,6 @@ bool UseDeviceMessage::ParseMessage(const char *msg_in)
* use storage=xxx media_type=yyy pool_name=xxx pool_type=yyy append=0 copy=0 strip=0
* use device=bbb
*/
#include <sstream>
static bool UseDeviceCmd(JobControlRecord *jcr)
{
bool ok;
Expand Down Expand Up @@ -439,18 +438,10 @@ static bool UseDeviceCmd(JobControlRecord *jcr)
ok = false;
}

/*
* At this point, we have a list of all the Director's Storage resources indicated
* for this Job, which include Pool, PoolType, storage name, and Media type.
*
* Then for each of the Storage resources, we have a list of device names that were given.
*
* Wiffle through them and find one that can do the backup.
*/
if (ok) {

ok = wiffle(jcr, storage_definition_message.append, use_device_message.dev_name);

jcr->append = storage_definition_message.append;
strcpy(jcr->dev_name, use_device_message.dev_name.c_str());
return true;
} else {
UnbashSpaces(jcr->dir_bsock->msg);
PmStrcpy(jcr->errmsg, jcr->dir_bsock->msg);
Expand Down

0 comments on commit f497df8

Please sign in to comment.