diff options
author | Chris Wilson <chris+github@qwirx.com> | 2011-04-09 20:12:55 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2011-04-09 20:12:55 +0000 |
commit | a0ad4217b1ad6023a615ee84093e78ee413389cf (patch) | |
tree | 378bceba9d742d010edd72f9864098f5914bfd51 /bin | |
parent | f466bde341f1b4f9201a7fb12331c7b88e15ef82 (diff) |
Actually try to back up from the VSS snapshot volume.
Clean up VSS resources at end of backup.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/bbackupd/BackupDaemon.cpp | 39 | ||||
-rw-r--r-- | bin/bbackupd/BackupDaemon.h | 1 |
2 files changed, 31 insertions, 9 deletions
diff --git a/bin/bbackupd/BackupDaemon.cpp b/bin/bbackupd/BackupDaemon.cpp index 598dfe3e..ca7ab1df 100644 --- a/bin/bbackupd/BackupDaemon.cpp +++ b/bin/bbackupd/BackupDaemon.cpp @@ -981,10 +981,18 @@ void BackupDaemon::RunSyncNow() (*i)->mpExcludeDirs); // Sync the directory + std::string locationPath = (*i)->mPath; +#ifdef ENABLE_VSS + if((*i)->mIsSnapshotCreated) + { + locationPath = (*i)->mSnapshotPath; + } +#endif + (*i)->mpDirectoryRecord->SyncDirectory( params, BackupProtocolClientListDirectory::RootDirectory, - (*i)->mPath, std::string("/") + (*i)->mName); + locationPath, std::string("/") + (*i)->mName); // Unset exclude lists (just in case) clientContext.SetExcludeLists(0, 0); @@ -997,7 +1005,11 @@ void BackupDaemon::RunSyncNow() // Close any open connection clientContext.CloseAnyOpenConnection(); - + +#ifdef ENABLE_VSS + CleanupVssBackupComponents(); +#endif + // Get the new store marker mClientStoreMarker = clientContext.GetClientStoreMarker(); mStorageLimitExceeded = clientContext.StorageLimitExceeded(); @@ -1133,7 +1145,7 @@ void BackupDaemon::CreateVssBackupComponents() } BOX_ERROR("VSS: Failed to initialize for backup: " << message); - goto CreateVssBackupComponents_cleanup_mpVssBackupComponents; + return; } result = mpVssBackupComponents->SetContext(VSS_CTX_BACKUP); @@ -1146,7 +1158,7 @@ void BackupDaemon::CreateVssBackupComponents() { BOX_ERROR("VSS: Failed to set context to VSS_CTX_BACKUP: " << GetMsgForHresult(result)); - goto CreateVssBackupComponents_cleanup_mpVssBackupComponents; + return; } result = mpVssBackupComponents->SetBackupState( @@ -1158,7 +1170,7 @@ void BackupDaemon::CreateVssBackupComponents() { BOX_ERROR("VSS: Failed to set backup state: " << GetMsgForHresult(result)); - goto CreateVssBackupComponents_cleanup_mpVssBackupComponents; + return; } if(!CallAndWaitForAsync(&IVssBackupComponents::GatherWriterMetadata, @@ -1187,7 +1199,7 @@ void BackupDaemon::CreateVssBackupComponents() { BOX_ERROR("Failed to get VSS metadata from writer " << iWriter << ": " << GetMsgForHresult(result)); - goto CreateVssBackupComponents_cleanup_WriterMetadata; + continue; } UINT includeFiles, excludeFiles, numComponents; @@ -1199,7 +1211,7 @@ void BackupDaemon::CreateVssBackupComponents() "writer " << iWriter << ": " << GetMsgForHresult(result)); pMetadata->Release(); - goto CreateVssBackupComponents_cleanup_mpVssBackupComponents; + continue; } for(UINT iComponent = 0; iComponent < numComponents; iComponent++) @@ -1582,11 +1594,20 @@ CreateVssBackupComponents_cleanup_WriterMetadata: BOX_ERROR("VSS: Failed to free writer metadata: " << GetMsgForHresult(result)); } +} + +void BackupDaemon::CleanupVssBackupComponents() +{ + if(mpVssBackupComponents == NULL) + { + return; + } + + CallAndWaitForAsync(&IVssBackupComponents::BackupComplete, + "BackupComplete()"); -CreateVssBackupComponents_cleanup_mpVssBackupComponents: mpVssBackupComponents->Release(); mpVssBackupComponents = NULL; - return; } #endif diff --git a/bin/bbackupd/BackupDaemon.h b/bin/bbackupd/BackupDaemon.h index 1a5654a6..ecd2370b 100644 --- a/bin/bbackupd/BackupDaemon.h +++ b/bin/bbackupd/BackupDaemon.h @@ -543,6 +543,7 @@ public: typedef HRESULT (__stdcall IVssBackupComponents::*AsyncMethod)(IVssAsync**); bool CallAndWaitForAsync(AsyncMethod method, const std::string& description); + void CleanupVssBackupComponents(); #endif }; |