bool do_backup_init(JCR *jcr)
{
+ if (jcr->JobLevel == L_VIRTUAL_FULL) {
+ return do_vbackup_init(jcr);
+ }
free_rstorage(jcr); /* we don't read so release */
if (!get_or_create_fileset_record(jcr)) {
{
POOL_MEM buf;
- if (jcr->accurate==false || job_canceled(jcr) || jcr->JobLevel==L_FULL) {
+ if (!jcr->accurate || job_canceled(jcr) || jcr->JobLevel==L_FULL) {
return true;
}
POOLMEM *jobids = get_pool_memory(PM_FNAME);
STORE *store;
char ed1[100];
+ if (jcr->JobLevel == L_VIRTUAL_FULL) {
+ return do_vbackup(jcr);
+ }
/* Print Job Start message */
Jmsg(jcr, M_INFO, 0, _("Start Backup JobId %s, Job=%s\n"),
double kbps, compression;
utime_t RunTime;
+ if (jcr->JobLevel == L_VIRTUAL_FULL) {
+ vbackup_cleanup(jcr, TermCode);
+ }
+
Dmsg2(100, "Enter backup_cleanup %d %c\n", TermCode, TermCode);
memset(&mr, 0, sizeof(mr));
memset(&cr, 0, sizeof(cr));
{"Incremental", L_INCREMENTAL, JT_BACKUP},
{"Differential", L_DIFFERENTIAL, JT_BACKUP},
{"Since", L_SINCE, JT_BACKUP},
+ {"VirtualFull", L_VIRTUAL_FULL, JT_BACKUP},
{"Catalog", L_VERIFY_CATALOG, JT_VERIFY},
{"InitCatalog", L_VERIFY_INIT, JT_VERIFY},
{"VolumeToCatalog", L_VERIFY_VOLUME_TO_CATALOG, JT_VERIFY},
if ((errstat = pthread_cond_init(&jcr->term_wait, NULL)) != 0) {
berrno be;
Jmsg1(jcr, M_FATAL, 0, _("Unable to init job cond variable: ERR=%s\n"), be.bstrerror(errstat));
+ jcr->unlock();
goto bail_out;
}
jcr->term_wait_inited = true;
pm_strcpy(jcr->pool_source, _("unknown source"));
}
Dmsg2(500, "pool=%s (From %s)\n", jcr->pool->name(), jcr->pool_source);
+ /* ****FIXME**** */
if (jcr->JobType == JT_MIGRATE || jcr->JobType == JT_COPY) {
if (!jcr->rpool_source) {
jcr->rpool_source = get_pool_memory(PM_MESSAGE);
jcr->JobStatus = JS_Created;
switch (jcr->JobType) {
case JT_ADMIN:
- case JT_RESTORE:
jcr->JobLevel = L_NONE;
break;
+ case JT_VERIFY:
+ case JT_RESTORE:
case JT_COPY:
case JT_MIGRATE:
- if (!jcr->rpool_source) {
- jcr->rpool_source = get_pool_memory(PM_MESSAGE);
- pm_strcpy(jcr->rpool_source, _("unknown source"));
+ jcr->JobReads = true;
+ jcr->JobLevel = job->JobLevel;
+ break;
+ case JT_BACKUP:
+ jcr->JobLevel = job->JobLevel;
+ if (jcr->JobLevel == L_VIRTUAL_FULL) {
+ jcr->JobReads = true;
}
- /* Fall-through wanted */
+ break;
default:
jcr->JobLevel = job->JobLevel;
break;
}
+ if (jcr->JobReads) {
+ if (!jcr->rpool_source) {
+ jcr->rpool_source = get_pool_memory(PM_MESSAGE);
+ pm_strcpy(jcr->rpool_source, _("unknown source"));
+ }
+ }
if (!jcr->fname) {
jcr->fname = get_pool_memory(PM_FNAME);
}
*/
void copy_rwstorage(JCR *jcr, alist *storage, const char *where)
{
- switch(jcr->JobType) {
- case JT_RESTORE:
- case JT_VERIFY:
- case JT_COPY:
- case JT_MIGRATE:
+ if (jcr->JobReads) {
copy_rstorage(jcr, storage, where);
- break;
- default:
+ } else {
copy_wstorage(jcr, storage, where);
- break;
}
}
Jmsg(jcr, M_FATAL, 0, _("No storage specified.\n"));
return;
}
- switch(jcr->JobType) {
- case JT_RESTORE:
- case JT_VERIFY:
- case JT_COPY:
- case JT_MIGRATE:
+ if (jcr->JobReads) {
set_rstorage(jcr, store);
- break;
- default:
+ } else {
set_wstorage(jcr, store);
- break;
}
}
}
if (strcasecmp(ua->argk[i], NT_("level")) == 0) {
if (!get_level_from_name(ua->jcr, ua->argv[i])) {
- ua->error_msg(_("Level %s not valid.\n"), ua->argv[i]);
+ ua->error_msg(_("Level \"%s\" not valid.\n"), ua->argv[i]);
}
continue;
}
}
if (rc.level_name) {
if (!get_level_from_name(jcr, rc.level_name)) {
- ua->send_msg(_("Level %s not valid.\n"), rc.level_name);
+ ua->send_msg(_("Level \"%s\" not valid.\n"), rc.level_name);
return false;
}
rc.level_name = NULL;
add_prompt(ua, _("Incremental"));
add_prompt(ua, _("Differential"));
add_prompt(ua, _("Since"));
+ add_prompt(ua, _("VirtualFull"));
switch (do_prompt(ua, "", _("Select level"), NULL, 0)) {
case 0:
jcr->JobLevel = L_BASE;
case 4:
jcr->JobLevel = L_SINCE;
break;
+ case 5:
+ jcr->JobLevel = L_VIRTUAL_FULL;
+ break;
default:
break;
}
{
char ed1[100];
BSOCK *sd;
- JCR *mig_jcr = jcr->mig_jcr; /* newly backed up job */
-
- /*
- * If mig_jcr is NULL, there is nothing to do for this job,
- * so set a normal status, cleanup and return OK.
- */
- if (!mig_jcr) {
- set_jcr_job_status(jcr, JS_Terminated);
- vbackup_cleanup(jcr, jcr->JobStatus);
- return true;
- }
/* Print Job Start message */
Jmsg(jcr, M_INFO, 0, _("Start Vbackup JobId %s, Job=%s\n"),
edit_uint64(jcr->JobId, ed1), jcr->Job);
-
-
/*
* Open a message channel connection with the Storage
* daemon. This is to let him know that our client
*/
Dmsg0(110, "Open connection with storage daemon\n");
set_jcr_job_status(jcr, JS_WaitSD);
- set_jcr_job_status(mig_jcr, JS_WaitSD);
/*
* Start conversation with Storage daemon
*/
/*
* Now start a job with the Storage daemon
*/
- Dmsg2(dbglevel, "Read store=%s, write store=%s\n",
+ Dmsg2(000, "Read store=%s, write store=%s\n",
((STORE *)jcr->rstorage->first())->name(),
((STORE *)jcr->wstorage->first())->name());
if (((STORE *)jcr->rstorage->first())->name() == ((STORE *)jcr->wstorage->first())->name()) {
return false;
}
-
- mig_jcr->start_time = time(NULL);
- mig_jcr->jr.StartTime = mig_jcr->start_time;
- mig_jcr->jr.JobTDate = mig_jcr->start_time;
- set_jcr_job_status(mig_jcr, JS_Running);
-
- /* Update job start record for the real migration backup job */
- if (!db_update_job_start_record(mig_jcr, mig_jcr->db, &mig_jcr->jr)) {
- Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(mig_jcr->db));
- return false;
- }
-
- Dmsg4(dbglevel, "mig_jcr: Name=%s JobId=%d Type=%c Level=%c\n",
- mig_jcr->jr.Name, (int)mig_jcr->jr.JobId,
- mig_jcr->jr.JobType, mig_jcr->jr.JobLevel);
-
-
/*
* Start the job prior to starting the message thread below
* to avoid two threads from using the BSOCK structure at
set_jcr_job_status(jcr, JS_Running);
- set_jcr_job_status(mig_jcr, JS_Running);
/* Pickup Job termination data */
/* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/Errors */
}
vbackup_cleanup(jcr, jcr->JobStatus);
- if (mig_jcr) {
- char jobid[50];
- UAContext *ua = new_ua_context(jcr);
- edit_uint64(jcr->previous_jr.JobId, jobid);
- /* Purge all old file records, but leave Job record */
- purge_files_from_jobs(ua, jobid);
- free_ua_context(ua);
- }
return true;
}
#define L_VERIFY_DATA 'A' /* verify data on volume */
#define L_BASE 'B' /* Base level job */
#define L_NONE ' ' /* None, for Restore and Admin */
+#define L_VIRTUAL_FULL 'f' /* Virtual full backup */
/* Job Types. These are stored in the DB */
int32_t JobType; /* backup, restore, verify ... */
int32_t JobLevel; /* Job level */
int32_t JobPriority; /* Job priority */
+ bool JobReads; /* Set if job reads Volumes */
time_t sched_time; /* job schedule time, i.e. when it should start */
time_t start_time; /* when job actually started */
time_t run_time; /* used for computing speed */
#undef VERSION
#define VERSION "2.5.2"
-#define BDATE "14 July 2008"
-#define LSMDATE "14Jul08"
+#define BDATE "15 July 2008"
+#define LSMDATE "15Jul08"
#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
#define BYEAR "2008" /* year for copyright messages in progs */
General:
+15Jul08
+kes Changes to get read storage correct for Virtual Backup.
14Jul08
kes Remove old code from label.c
kes Split display_display_info() out of write_bsr_file()