fix: restore volume mount when VolumeConfigure fails (#7669)
* fix: restore volume mount when VolumeConfigure fails When volume.configure.replication command fails (e.g., due to corrupted .vif file), the volume was left unmounted and the master was already notified that the volume was deleted, causing the volume to disappear. This fix attempts to re-mount the volume when ConfigureVolume fails, restoring the volume state and preventing data loss. Fixes #7666 * include mount restore error in response message
This commit is contained in:
@@ -134,6 +134,11 @@ func (vs *VolumeServer) VolumeConfigure(ctx context.Context, req *volume_server_
|
||||
if err := vs.store.ConfigureVolume(needle.VolumeId(req.VolumeId), req.Replication); err != nil {
|
||||
glog.Errorf("volume configure %v: %v", req, err)
|
||||
resp.Error = fmt.Sprintf("volume configure %v: %v", req, err)
|
||||
// Try to re-mount to restore the volume state
|
||||
if mountErr := vs.store.MountVolume(needle.VolumeId(req.VolumeId)); mountErr != nil {
|
||||
glog.Errorf("volume configure failed to restore mount %v: %v", req, mountErr)
|
||||
resp.Error += fmt.Sprintf(". Also failed to restore mount: %v", mountErr)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user