lvm backup: calculate path_to_backup after volume is mounted
For the time being, the path_to_backup for backup with lvm snapshot is not taken directly from --path-to-backup parameter, but adjusted according the mount info of the corresponding volume hinted by that parameter. However this info is inferred before the volume is actually mounted so it tends to be inaccuate and leads to errors. So do the calculation after volume mounting instead. Change-Id: I0d7f3125520aa27ba1d2d94ff52e3cc0eea4916c Closes-Bug: #1799183 Story: 2004152 Task: 27623
This commit is contained in:
parent
9881cbbcc2
commit
1bfbfc3a7a
@ -115,9 +115,6 @@ def lvm_snap(backup_opt_dict):
|
|||||||
"{0}/mount_{1}".format(freezer_config.DEFAULT_LVM_MOUNT_BASEDIR,
|
"{0}/mount_{1}".format(freezer_config.DEFAULT_LVM_MOUNT_BASEDIR,
|
||||||
lvm_uuid)
|
lvm_uuid)
|
||||||
|
|
||||||
backup_opt_dict.path_to_backup = os.path.join(backup_opt_dict.lvm_dirmount,
|
|
||||||
lvm_info['snap_path'])
|
|
||||||
|
|
||||||
if not validate_lvm_params(backup_opt_dict):
|
if not validate_lvm_params(backup_opt_dict):
|
||||||
LOG.info('No LVM requested/configured')
|
LOG.info('No LVM requested/configured')
|
||||||
return False
|
return False
|
||||||
@ -186,6 +183,12 @@ def lvm_snap(backup_opt_dict):
|
|||||||
'Volume {0} successfully mounted on {1}'.format(
|
'Volume {0} successfully mounted on {1}'.format(
|
||||||
abs_snap_name, backup_opt_dict.lvm_dirmount))
|
abs_snap_name, backup_opt_dict.lvm_dirmount))
|
||||||
|
|
||||||
|
# After snapshot is mounted, adjust path_to_backup according the mount
|
||||||
|
# point and relative path of the snapshot volume.
|
||||||
|
lvm_info = get_lvm_info(backup_opt_dict.path_to_backup)
|
||||||
|
backup_opt_dict.path_to_backup = os.path.join(backup_opt_dict.lvm_dirmount,
|
||||||
|
lvm_info['snap_path'])
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user