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
This commit is contained in:
Tom Barron 2016-05-21 05:46:58 -04:00
parent 90e2c0627e
commit 876d797a1f
2 changed files with 9 additions and 1 deletions

View File

@ -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)

View File

@ -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: