]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/testing/bug_897.patch
ebl Add a patch to add a Product column to Version table
[bacula/bacula] / bacula / patches / testing / bug_897.patch
1 Index: src/filed/job.c
2 ===================================================================
3 --- src/filed/job.c     (revision 5235)
4 +++ src/filed/job.c     (working copy)
5 @@ -266,9 +266,6 @@
6        bnet_sig(jcr->store_bsock, BNET_TERMINATE);
7     }
8  
9 -   /* Run the after job */
10 -   run_scripts(jcr, jcr->RunScripts, "ClientAfterJob");
11 -
12     generate_daemon_event(jcr, "JobEnd");
13  
14     dequeue_messages(jcr);             /* send any queued messages */
15 @@ -1321,7 +1318,25 @@
16     return bnet_fsend(dir, OKstore);
17  }
18  
19 +static void job_end(JCR *jcr)
20 +{   
21 +   char ed1[50], ed2[50];
22  
23 +   /* Inform Storage daemon that we are done */
24 +   if (jcr->store_bsock) {
25 +      bnet_sig(jcr->store_bsock, BNET_TERMINATE);
26 +   }
27 +
28 +   /* Run the after job */
29 +   run_scripts(jcr, jcr->RunScripts, "ClientAfterJob");
30 +
31 +   bnet_fsend(jcr->dir_bsock, EndJob, jcr->JobStatus, jcr->JobFiles,
32 +             edit_uint64(jcr->ReadBytes, ed1),
33 +             edit_uint64(jcr->JobBytes, ed2), jcr->Errors, (int)jcr->VSS, 
34 +             jcr->pki_encrypt);
35 +   Dmsg1(110, "End FD msg: %s\n", jcr->dir_bsock->msg);
36 +}
37 +
38  /*
39   * Do a backup.
40   */
41 @@ -1331,15 +1346,13 @@
42     BSOCK *sd = jcr->store_bsock;
43     int ok = 0;
44     int SDJobStatus;
45 -   char ed1[50], ed2[50];
46 -   bool bDoVSS = false;
47  
48  #if defined(WIN32_VSS)
49     // capture state here, if client is backed up by multiple directors
50     // and one enables vss and the other does not then enable_vss can change
51     // between here and where its evaluated after the job completes.
52 -   bDoVSS = g_pVSSClient && enable_vss;
53 -   if (bDoVSS) {
54 +   jcr->VSS = g_pVSSClient && enable_vss;
55 +   if (jcr->VSS) {
56        /* Run only one at a time */
57        P(vss_mutex);
58     }
59 @@ -1395,7 +1408,7 @@
60  
61  #if defined(WIN32_VSS)
62     /* START VSS ON WIN 32 */
63 -   if (bDoVSS) {      
64 +   if (jcr->VSS) {      
65        if (g_pVSSClient->InitializeForBackup()) {   
66          /* tell vss which drives to snapshot */   
67          char szWinDriveLetters[27];   
68 @@ -1488,7 +1501,7 @@
69  #if defined(WIN32_VSS)
70     /* STOP VSS ON WIN 32 */
71     /* tell vss to close the backup session */
72 -   if (bDoVSS) {
73 +   if (jcr->VSS) {
74        if (g_pVSSClient->CloseBackup()) {             
75           /* inform user about writer states */
76           for (int i=0; i<(int)g_pVSSClient->GetWriterCount(); i++) {
77 @@ -1504,12 +1517,8 @@
78     }
79  #endif
80  
81 -   bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
82 -      edit_uint64(jcr->ReadBytes, ed1),
83 -      edit_uint64(jcr->JobBytes, ed2), jcr->Errors, (int)bDoVSS, 
84 -      jcr->pki_encrypt);
85 -   Dmsg1(110, "End FD msg: %s\n", dir->msg);
86 -   
87 +   job_end(jcr);
88 +
89     return 0;                          /* return and stop command loop */
90  }
91  
92 @@ -1585,12 +1594,7 @@
93  
94     bnet_sig(dir, BNET_EOD);
95  
96 -   /* Send termination status back to Dir */
97 -   bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
98 -      edit_uint64(jcr->ReadBytes, ed1),
99 -      edit_uint64(jcr->JobBytes, ed2), jcr->Errors, 0,
100 -      jcr->pki_encrypt);
101 -   Dmsg1(110, "End FD msg: %s\n", dir->msg);
102 +   job_end(jcr);
103  
104     /* Inform Director that we are done */
105     bnet_sig(dir, BNET_TERMINATE);
106 @@ -1696,13 +1700,9 @@
107     if (jcr->Errors) {
108        set_jcr_job_status(jcr, JS_ErrorTerminated);
109     }
110 -   /* Send termination status back to Dir */
111 -   bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
112 -      edit_uint64(jcr->ReadBytes, ed1),
113 -      edit_uint64(jcr->JobBytes, ed2), jcr->Errors, 0,
114 -      jcr->pki_encrypt);
115 -   Dmsg1(110, "End FD msg: %s\n", dir->msg);
116  
117 +   job_end(jcr);
118 +
119     /* Inform Director that we are done */
120     bnet_sig(dir, BNET_TERMINATE);
121  
122 Index: src/jcr.h
123 ===================================================================
124 --- src/jcr.h   (revision 5235)
125 +++ src/jcr.h   (working copy)
126 @@ -297,6 +297,7 @@
127     int32_t pki_session_encoded_size;  /* Size of DER-encoded pki_session */
128     POOLMEM *crypto_buf;               /* Encryption/Decryption buffer */
129     DIRRES* director;                  /* Director resource */
130 +   bool VSS;                          /* VSS used by FD */
131  #endif /* FILE_DAEMON */
132  
133