2 ===================================================================
3 --- fd_cmds.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
4 +++ fd_cmds.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
7 - * This file handles commands from the File daemon.
11 - * We get here because the Director has initiated a Job with
12 - * the Storage daemon, then done the same with the File daemon,
13 - * then when the Storage daemon receives a proper connection from
14 - * the File daemon, control is passed here to handle the
15 - * subsequent File daemon commands.
21 Bacula® - The Network Backup Solution
23 Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 + * This file handles commands from the File daemon.
33 + * We get here because the Director has initiated a Job with
34 + * the Storage daemon, then done the same with the File daemon,
35 + * then when the Storage daemon receives a proper connection from
36 + * the File daemon, control is passed here to handle the
37 + * subsequent File daemon commands.
48 Dmsg1(120, "Start run Job=%s\n", jcr->Job);
49 - bnet_fsend(dir, Job_start, jcr->Job);
50 + dir->fsend(Job_start, jcr->Job);
51 jcr->start_time = time(NULL);
52 jcr->run_time = jcr->start_time;
53 set_jcr_job_status(jcr, JS_Running);
55 dequeue_messages(jcr); /* send any queued messages */
56 set_jcr_job_status(jcr, JS_Terminated);
57 generate_daemon_event(jcr, "JobEnd");
58 - bnet_fsend(dir, Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
59 + dir->fsend(Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
60 edit_uint64(jcr->JobBytes, ec1));
61 - bnet_sig(dir, BNET_EOD); /* send EOD to Director daemon */
62 + dir->signal(BNET_EOD); /* send EOD to Director daemon */
69 /* Read command coming from the File daemon */
70 - stat = bnet_recv(fd);
72 if (is_bnet_stop(fd)) { /* hardeof or error */
73 break; /* connection terminated */
77 if (!found) { /* command not found */
78 Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
79 - bnet_fsend(fd, ferrmsg);
84 - bnet_sig(fd, BNET_TERMINATE); /* signal to FD job is done */
85 + fd->signal(BNET_TERMINATE); /* signal to FD job is done */
92 bnet_suppress_error_messages(fd, 1); /* ignore errors at this point */
93 - bnet_fsend(fd, ERROR_append);
94 + fd->fsend(ERROR_append);
97 - bnet_fsend(fd, NOT_opened);
98 + fd->fsend(NOT_opened);
102 @@ -209,11 +209,11 @@
104 Dmsg1(120, "store<file: %s", fd->msg);
105 if (!jcr->session_opened) {
106 - bnet_fsend(fd, NOT_opened);
107 + fd->fsend(NOT_opened);
110 set_jcr_job_status(jcr, JS_Terminated);
111 - return bnet_fsend(fd, OK_end);
112 + return fd->fsend(OK_end);
116 @@ -227,14 +227,14 @@
118 Dmsg1(120, "Append open session: %s", fd->msg);
119 if (jcr->session_opened) {
120 - bnet_fsend(fd, NO_open);
121 + fd->fsend(NO_open);
125 jcr->session_opened = true;
127 /* Send "Ticket" to File Daemon */
128 - bnet_fsend(fd, OK_open, jcr->VolSessionId);
129 + fd->fsend(OK_open, jcr->VolSessionId);
130 Dmsg1(110, ">filed: %s", fd->msg);
133 @@ -251,14 +251,14 @@
135 Dmsg1(120, "<filed: %s", fd->msg);
136 if (!jcr->session_opened) {
137 - bnet_fsend(fd, NOT_opened);
138 + fd->fsend(NOT_opened);
141 /* Send final statistics to File daemon */
142 - bnet_fsend(fd, OK_close, jcr->JobStatus);
143 + fd->fsend(OK_close, jcr->JobStatus);
144 Dmsg1(120, ">filed: %s", fd->msg);
146 - bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */
147 + fd->signal(BNET_EOD); /* send EOD to File daemon */
149 jcr->session_opened = false;
152 Dmsg1(120, "<bfiled: %s", fd->msg);
153 return do_read_data(jcr);
155 - bnet_fsend(fd, NOT_opened);
156 + fd->fsend(NOT_opened);
162 Dmsg1(120, "%s\n", fd->msg);
163 if (jcr->session_opened) {
164 - bnet_fsend(fd, NO_open);
165 + fd->fsend(NO_open);
170 &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile,
171 &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) {
172 if (jcr->session_opened) {
173 - bnet_fsend(fd, NOT_opened);
174 + fd->fsend(NOT_opened);
177 Dmsg4(100, "read_open_session got: JobId=%d Vol=%s VolSessId=%ld VolSessT=%ld\n",
179 jcr->JobType = JT_RESTORE;
181 /* Send "Ticket" to File Daemon */
182 - bnet_fsend(fd, OK_open, jcr->VolSessionId);
183 + fd->fsend(OK_open, jcr->VolSessionId);
184 Dmsg1(110, ">filed: %s", fd->msg);
190 Dmsg0(10, "=== Bootstrap file ===\n");
191 - while (bnet_recv(sock) >= 0) {
192 + while (sock->recv() >= 0) {
193 Dmsg1(10, "%s", sock->msg);
194 fputs(sock->msg, bs);
196 @@ -378,10 +378,10 @@
197 free_pool_memory(jcr->RestoreBootstrap);
198 jcr->RestoreBootstrap = NULL;
200 - bnet_fsend(sock, ERROR_bootstrap);
201 + sock->fsend(ERROR_bootstrap);
204 - return bnet_fsend(sock, OK_bootstrap);
205 + return sock->fsend(OK_bootstrap);
209 @@ -395,14 +395,14 @@
211 Dmsg1(120, "Read close session: %s\n", fd->msg);
212 if (!jcr->session_opened) {
213 - bnet_fsend(fd, NOT_opened);
214 + fd->fsend(NOT_opened);
217 - /* Send final statistics to File daemon */
218 - bnet_fsend(fd, OK_close);
219 + /* Send final close msg to File daemon */
220 + fd->fsend(OK_close, jcr->JobStatus);
221 Dmsg1(160, ">filed: %s\n", fd->msg);
223 - bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */
224 + fd->signal(BNET_EOD); /* send EOD to File daemon */
226 jcr->session_opened = false;
229 ===================================================================
230 --- stored_conf.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
231 +++ stored_conf.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
233 {"piddirectory", store_dir, ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0},
234 {"subsysdirectory", store_dir, ITEM(res_store.subsys_directory), 0, 0, 0},
235 {"scriptsdirectory", store_dir, ITEM(res_store.scripts_directory), 0, 0, 0},
236 - {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 10},
237 + {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 20},
238 {"heartbeatinterval", store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0},
239 {"tlsenable", store_bit, ITEM(res_store.tls_enable), 1, 0, 0},
240 {"tlsrequire", store_bit, ITEM(res_store.tls_require), 1, 0, 0},
242 ===================================================================
243 --- bscan.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
244 +++ bscan.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
246 " -m update media info in database\n"
247 " -n <name> specify the database name (default bacula)\n"
248 " -u <user> specify database user name (default bacula)\n"
249 -" -P <password specify database password (default none)\n"
250 +" -P <password> specify database password (default none)\n"
251 " -h <host> specify database host (default NULL)\n"
252 " -p proceed inspite of I/O errors\n"
255 mdcr->StartFile = dcr->StartFile;
256 mdcr->EndBlock = dcr->EndBlock;
257 mdcr->EndFile = dcr->EndFile;
258 + mdcr->VolMediaId = dcr->VolMediaId;
259 mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
260 if (!create_jobmedia_record(db, mjcr)) {
261 Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
263 dcr->VolFirstIndex = dcr->FileIndex = 0;
264 dcr->StartBlock = dcr->EndBlock = 0;
265 dcr->StartFile = dcr->EndFile = 0;
266 + dcr->VolMediaId = 0;
269 Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
270 @@ -1177,6 +1179,7 @@
272 dcr->EndBlock = dev->EndBlock;
273 dcr->EndFile = dev->EndFile;
274 + dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
276 memset(&jmr, 0, sizeof(jmr));
277 jmr.JobId = mjcr->JobId;
279 ===================================================================
280 --- askdir.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
281 +++ askdir.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
283 dcr->StartFile, dcr->EndFile,
284 dcr->StartBlock, dcr->EndBlock,
285 dcr->Copy, dcr->Stripe,
286 - edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1));
287 + edit_uint64(dcr->VolMediaId, ed1));
288 Dmsg1(100, ">dird: %s", dir->msg);
289 if (bnet_recv(dir) <= 0) {
290 Dmsg0(190, "create_jobmedia error bnet_recv\n");
292 ===================================================================
293 --- dev.h (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
294 +++ dev.h (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
296 uint32_t StartFile; /* Start write file */
297 uint32_t StartBlock; /* Start write block */
298 uint32_t EndBlock; /* Ending block written */
299 + int64_t VolMediaId; /* MediaId */
300 int64_t job_spool_size; /* Current job spool size */
301 int64_t max_job_spool_size; /* Max job spool size */
302 char VolumeName[MAX_NAME_LENGTH]; /* Volume name */
304 ===================================================================
305 --- block.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508)
306 +++ block.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508)
308 dev->block_num = dcr->EndBlock;
309 dev->file = dcr->EndFile;
311 + dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
312 if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
313 dcr->VolFirstIndex = block->FirstIndex;
315 @@ -1098,6 +1099,7 @@
316 dev->block_num = dcr->EndBlock;
317 dev->file = dcr->EndFile;
319 + dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
320 dev->file_addr += block->read_len;
321 dev->file_size += block->read_len;