From 876d797a1f5207ba905fdc23413b6cd1cb4074c9 Mon Sep 17 00:00:00 2001 From: Tom Barron Date: Sat, 21 May 2016 05:46:58 -0400 Subject: [PATCH] Add debug messages and comments for ceph backup Help operators and engineers analyzing issues with ceph backup driver by adding some useful debug messages and comments. Related to this fix [1]. TrivialFix [1] I3d6833f8c1665272d914c95654775662df007aa9 Change-Id: Ib23388d0f698ecf6931d4f4d5dfbe354f4f746bd Related-bug: # 1578036 --- cinder/backup/drivers/ceph.py | 8 +++++++- cinder/backup/manager.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cinder/backup/drivers/ceph.py b/cinder/backup/drivers/ceph.py index 6ff94950c..6f0b0c664 100644 --- a/cinder/backup/drivers/ceph.py +++ b/cinder/backup/drivers/ceph.py @@ -858,6 +858,7 @@ class CephBackupDriver(driver.BackupDriver): do_full_backup = False if self._file_is_rbd(volume_file): # If volume an RBD, attempt incremental backup. + LOG.debug("Volume file is RBD: attempting incremental backup.") try: self._backup_rbd(backup_id, volume_id, volume_file, volume_name, length) @@ -865,6 +866,7 @@ class CephBackupDriver(driver.BackupDriver): LOG.debug("Forcing full backup of volume %s.", volume_id) do_full_backup = True else: + LOG.debug("Volume file is NOT RBD: will do full backup.") do_full_backup = True if do_full_backup: @@ -1048,7 +1050,7 @@ class CephBackupDriver(driver.BackupDriver): if restore_point: if self._file_is_rbd(volume_file): - + LOG.debug("Volume file is RBD.") # If the volume we are restoring to is the volume the backup # was made from, force a full restore since a diff will not # work in this case. @@ -1066,6 +1068,8 @@ class CephBackupDriver(driver.BackupDriver): return False, restore_point return True, restore_point + else: + LOG.debug("Volume file is NOT RBD.") else: LOG.info(_LI("No restore point found for backup=" "'%(backup)s' of volume %(volume)s " @@ -1097,6 +1101,7 @@ class CephBackupDriver(driver.BackupDriver): if diff_allowed: # Attempt diff try: + LOG.debug("Attempting differential restore.") self._diff_restore_rbd(base_name, volume_file, volume_name, restore_point, length) do_full_restore = False @@ -1106,6 +1111,7 @@ class CephBackupDriver(driver.BackupDriver): if do_full_restore: # Otherwise full copy + LOG.debug("Running full restore.") self._full_restore(backup_id, backup_volume_id, volume_file, volume_name, length, src_snap=restore_point) diff --git a/cinder/backup/manager.py b/cinder/backup/manager.py index a72c1a9cd..ff60b407e 100644 --- a/cinder/backup/manager.py +++ b/cinder/backup/manager.py @@ -350,6 +350,7 @@ class BackupManager(manager.SchedulerDependentManager): with utils.temporary_chown(device_path): with open(device_path) as device_file: backup_service.backup(backup, device_file) + # device_path is already file-like so no need to open it else: backup_service.backup(backup, device_path) @@ -456,6 +457,7 @@ class BackupManager(manager.SchedulerDependentManager): with open(device_path, 'wb') as device_file: backup_service.restore(backup, volume.id, device_file) + # device_path is already file-like so no need to open it else: backup_service.restore(backup, volume.id, device_path) finally: