Skip to content

Instantly share code, notes, and snippets.

@Reldan
Created January 14, 2016 14:37
backup.py
def snapshot_create(backup_opt_dict):
"""
Calls the code to take fs snapshots, depending on the platform
:param backup_opt_dict:
:return: boolean value, True if snapshot has been taken, false otherwise
"""
if winutils.is_windows():
if backup_opt_dict.snapshot:
# Create a shadow copy.
backup_opt_dict.shadow_path, backup_opt_dict.shadow = \
vss.vss_create_shadow_copy(backup_opt_dict.windows_volume)
backup_opt_dict.path_to_backup = winutils.use_shadow(
backup_opt_dict.path_to_backup,
backup_opt_dict.windows_volume)
# execute this after the snapshot creation
if backup_opt_dict.mode == 'sqlserver':
winutils.start_sql_server(backup_opt_dict.sql_server_instance)
return True
return False
else:
return lvm.lvm_snap(backup_opt_dict)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment