]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.2.0-restore.patch
Correct technotes
[bacula/bacula] / bacula / patches / 2.2.0-restore.patch
1 Index: fd_cmds.c
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)
5 @@ -1,18 +1,4 @@
6  /*
7 - * This file handles commands from the File daemon.
8 - *
9 - *  Kern Sibbald, MM
10 - *
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.
16 - *
17 - *   Version $Id$
18 - *
19 - */
20 -/*
21     Bacula® - The Network Backup Solution
22  
23     Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
24 @@ -39,6 +25,20 @@
25     (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26     Switzerland, email:ftf@fsfeurope.org.
27  */
28 +/*
29 + * This file handles commands from the File daemon.
30 + *
31 + *  Kern Sibbald, MM
32 + *
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.
38 + *
39 + *   Version $Id$
40 + *
41 + */
42  
43  #include "bacula.h"
44  #include "stored.h"
45 @@ -120,7 +120,7 @@
46  
47     dir->set_jcr(jcr);
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);
54 @@ -130,9 +130,9 @@
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 */
63     return;
64  }
65  
66 @@ -150,7 +150,7 @@
67        int stat;
68  
69        /* Read command coming from the File daemon */
70 -      stat = bnet_recv(fd);
71 +      stat = fd->recv();
72        if (is_bnet_stop(fd)) {         /* hardeof or error */
73           break;                       /* connection terminated */
74        }
75 @@ -171,11 +171,11 @@
76        }
77        if (!found) {                   /* command not found */
78           Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
79 -         bnet_fsend(fd, ferrmsg);
80 +         fd->fsend(ferrmsg);
81           break;
82        }
83     }
84 -   bnet_sig(fd, BNET_TERMINATE);      /* signal to FD job is done */
85 +   fd->signal(BNET_TERMINATE);        /* signal to FD job is done */
86  }
87  
88  /*
89 @@ -195,10 +195,10 @@
90           return true;
91        } else {
92           bnet_suppress_error_messages(fd, 1); /* ignore errors at this point */
93 -         bnet_fsend(fd, ERROR_append);
94 +         fd->fsend(ERROR_append);
95        }
96     } else {
97 -      bnet_fsend(fd, NOT_opened);
98 +      fd->fsend(NOT_opened);
99     }
100     return false;
101  }
102 @@ -209,11 +209,11 @@
103  
104     Dmsg1(120, "store<file: %s", fd->msg);
105     if (!jcr->session_opened) {
106 -      bnet_fsend(fd, NOT_opened);
107 +      fd->fsend(NOT_opened);
108        return false;
109     }
110     set_jcr_job_status(jcr, JS_Terminated);
111 -   return bnet_fsend(fd, OK_end);
112 +   return fd->fsend(OK_end);
113  }
114  
115  
116 @@ -227,14 +227,14 @@
117  
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);
122        return false;
123     }
124  
125     jcr->session_opened = true;
126  
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);
131  
132     return true;
133 @@ -251,14 +251,14 @@
134  
135     Dmsg1(120, "<filed: %s", fd->msg);
136     if (!jcr->session_opened) {
137 -      bnet_fsend(fd, NOT_opened);
138 +      fd->fsend(NOT_opened);
139        return false;
140     }
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);
145  
146 -   bnet_sig(fd, BNET_EOD);            /* send EOD to File daemon */
147 +   fd->signal(BNET_EOD);              /* send EOD to File daemon */
148  
149     jcr->session_opened = false;
150     return true;
151 @@ -279,7 +279,7 @@
152        Dmsg1(120, "<bfiled: %s", fd->msg);
153        return do_read_data(jcr);
154     } else {
155 -      bnet_fsend(fd, NOT_opened);
156 +      fd->fsend(NOT_opened);
157        return false;
158     }
159  }
160 @@ -296,7 +296,7 @@
161  
162     Dmsg1(120, "%s\n", fd->msg);
163     if (jcr->session_opened) {
164 -      bnet_fsend(fd, NO_open);
165 +      fd->fsend(NO_open);
166        return false;
167     }
168  
169 @@ -304,7 +304,7 @@
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);
175           return false;
176        }
177        Dmsg4(100, "read_open_session got: JobId=%d Vol=%s VolSessId=%ld VolSessT=%ld\n",
178 @@ -319,7 +319,7 @@
179     jcr->JobType = JT_RESTORE;
180  
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);
185  
186     return true;
187 @@ -357,7 +357,7 @@
188        goto bail_out;
189     }
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);
195     }
196 @@ -378,10 +378,10 @@
197     free_pool_memory(jcr->RestoreBootstrap);
198     jcr->RestoreBootstrap = NULL;
199     if (!ok) {
200 -      bnet_fsend(sock, ERROR_bootstrap);
201 +      sock->fsend(ERROR_bootstrap);
202        return false;
203     }
204 -   return bnet_fsend(sock, OK_bootstrap);
205 +   return sock->fsend(OK_bootstrap);
206  }
207  
208  
209 @@ -395,14 +395,14 @@
210  
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);
215        return false;
216     }
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);
222  
223 -   bnet_sig(fd, BNET_EOD);          /* send EOD to File daemon */
224 +   fd->signal(BNET_EOD);            /* send EOD to File daemon */
225  
226     jcr->session_opened = false;
227     return true;
228 Index: stored_conf.c
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)
232 @@ -75,7 +75,7 @@
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},
241 Index: bscan.c
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)
245 @@ -120,7 +120,7 @@
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"
253  "       -r                list records\n"
254 @@ -326,6 +326,7 @@
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"),
262 @@ -476,6 +477,7 @@
263              dcr->VolFirstIndex = dcr->FileIndex = 0;
264              dcr->StartBlock = dcr->EndBlock = 0;
265              dcr->StartFile = dcr->EndFile = 0;
266 +            dcr->VolMediaId = 0;
267           }
268  
269           Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
270 @@ -1177,6 +1179,7 @@
271  
272     dcr->EndBlock = dev->EndBlock;
273     dcr->EndFile  = dev->EndFile;
274 +   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
275  
276     memset(&jmr, 0, sizeof(jmr));
277     jmr.JobId = mjcr->JobId;
278 Index: askdir.c
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)
282 @@ -398,7 +398,7 @@
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");
291 Index: dev.h
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)
295 @@ -447,6 +447,7 @@
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 */
303 Index: block.c
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)
307 @@ -611,6 +611,7 @@
308        dev->block_num = dcr->EndBlock;
309        dev->file = dcr->EndFile;
310     }
311 +   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
312     if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
313        dcr->VolFirstIndex = block->FirstIndex;
314     }
315 @@ -1098,6 +1099,7 @@
316        dev->block_num = dcr->EndBlock;
317        dev->file = dcr->EndFile;
318     }
319 +   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
320     dev->file_addr += block->read_len;
321     dev->file_size += block->read_len;
322