From 0fa12977628002cc239bb6dbadb473189f71229c Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 23 Nov 2010 22:27:42 +0100 Subject: [PATCH] Allow plugins to add drives to vss snapshot --- bacula/src/filed/fd_plugins.h | 3 ++- bacula/src/filed/job.c | 4 +++- bacula/src/findlib/find.c | 10 +++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bacula/src/filed/fd_plugins.h b/bacula/src/filed/fd_plugins.h index f851ca4e1b..acf3511302 100644 --- a/bacula/src/filed/fd_plugins.h +++ b/bacula/src/filed/fd_plugins.h @@ -204,7 +204,8 @@ typedef enum { bEventRestoreObject = 17, bEventEndFileSet = 18, bEventPluginCommand = 19, /* Sent during FileSet creation */ - bEventVssBeforeCloseRestore = 20 + bEventVssBeforeCloseRestore = 20, + bEventVssAddSnapshotLetters = 21 /* Can add drives to vss snap */ } bEventType; typedef struct s_bEvent { diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index e81f608342..d5f4866db2 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -1818,7 +1818,9 @@ static int backup_cmd(JCR *jcr) if (g_pVSSClient->InitializeForBackup(jcr)) { generate_plugin_event(jcr, bEventVssBackupAddComponents); /* tell vss which drives to snapshot */ - char szWinDriveLetters[27]; + char szWinDriveLetters[27]; + *szWinDriveLetters=0; + generate_plugin_event(jcr, bEventVssSnapshotLetters, szWinDriveLetters); if (get_win32_driveletters(jcr->ff, szWinDriveLetters)) { Jmsg(jcr, M_INFO, 0, _("Generate VSS snapshots. Driver=\"%s\", Drive(s)=\"%s\"\n"), g_pVSSClient->GetDriverName(), szWinDriveLetters); if (!g_pVSSClient->CreateSnapshots(szWinDriveLetters)) { diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index 291fd050ec..3c60f95219 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -121,10 +121,14 @@ get_win32_driveletters(FF_PKT *ff, char* szDrives) #if !defined(HAVE_WIN32) return 0; #endif + int nCount; + /* Can be already filled by plugin, so check that everything + * is on upper case. TODO: can check for dupplicate? + */ + for (nCount = 0; nCount < 27 && szDrives[nCount] ; nCount++) { + szDrives[nCount] = toupper(szDrives[nCount]); + } - szDrives[0] = 0; /* make empty */ - int nCount = 0; - findFILESET *fileset = ff->fileset; if (fileset) { int i; -- 2.39.5