diff options
| author | Rajesh Joseph <rjoseph@redhat.com> | 2014-05-05 14:34:55 +0530 | 
|---|---|---|
| committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2014-05-08 23:00:32 -0700 | 
| commit | d74c10603196a57c5fa033aaeb55f93f7ef7b4be (patch) | |
| tree | 23e95921b081e1ae36f8bdc663dc4d5788a72f80 /xlators | |
| parent | 26043d1f8ed6892aca47abcb75cedfdc51e86a0a (diff) | |
glusterd/snapshot: volume gets deleted if restore fails
If the restore command fails in pre-validate phase
then main volume gets deleted.
Fix: Perform cleanup only when pre-validate passes.
Change-Id: I7128c8582c3dd166a5683babb7e136ad0b56f0ac
BUG: 1061685
Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-on: http://review.gluster.org/7665
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot.c | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index c42aac57936..44a987ef8b2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -6378,6 +6378,7 @@ glusterd_snapshot_restore_postop (dict_t *dict, int32_t op_ret,          int                     ret             = -1;          char                   *name            = NULL;          char                   *volname         = NULL; +        int                     cleanup         = 0;          glusterd_snap_t        *snap            = NULL;          glusterd_volinfo_t     *volinfo         = NULL;          xlator_t               *this            = NULL; @@ -6428,6 +6429,13 @@ glusterd_snapshot_restore_postop (dict_t *dict, int32_t op_ret,                          goto out;                  }          } else { /* On failure revert snapshot restore */ +                ret = dict_get_int32 (dict, "cleanup", &cleanup); +                /* Perform cleanup only when required */ +                if (ret || (0 == cleanup)) { +                        ret = 0; +                        goto out; +                } +                  ret = glusterd_snapshot_revert_partial_restored_vol (volinfo,                                                                       _gf_false);                  if (ret) {  | 
