Commit 1ef87af3 authored by Hrvoje Ribicic's avatar Hrvoje Ribicic
Browse files

Finalize local export only if successful

Before commit 44247302

, a failure in the transfer of a single disk
during an export was changed to make the entire transfer unsuccessful.
What did not change was an invocation of export finalization, which
removes the old backup if present and replaces it with whatever the
result of the transfer was. As a result, a failed backup of an instance
could destroy a previous backup.

This patch prevents the finalization from taking place - this leaves
some data lying around in a ".new" directory, but at least the old
backup is not deleted.
Signed-off-by: default avatarHrvoje Ribicic <>
Reviewed-by: default avatarHelga Velroyen <>
parent 1ab5e9f5
...@@ -1267,14 +1267,22 @@ class ExportInstanceHelper(object): ...@@ -1267,14 +1267,22 @@ class ExportInstanceHelper(object):
assert len(dresults) == len(instance.disks) assert len(dresults) == len(instance.disks)
self._feedback_fn("Finalizing export on %s" % # Finalize only if all the disks have been exported successfully
result = self._lu.rpc.call_finalize_export(dest_node.uuid, instance, if all(dresults):
self._snap_disks) self._feedback_fn("Finalizing export on %s" %
msg = result.fail_msg result = self._lu.rpc.call_finalize_export(dest_node.uuid, instance,
fin_resu = not msg self._snap_disks)
if msg: msg = result.fail_msg
self._lu.LogWarning("Could not finalize export for instance %s" fin_resu = not msg
" on node %s: %s",,, msg) if msg:
self._lu.LogWarning("Could not finalize export for instance %s"
" on node %s: %s",,,
fin_resu = False
self._lu.LogWarning("Some disk exports have failed; there may be "
"leftover data for instance %s on node %s",,
return (fin_resu, dresults) return (fin_resu, dresults)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment