feat(resize): adding resize support for raw block volumes

Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
Pawan 2021-02-01 12:03:54 +05:30 committed by Kiran Mova
parent 8335440d4c
commit 88ad25ec9c
3 changed files with 25 additions and 3 deletions

View file

@ -17,6 +17,7 @@ limitations under the License.
package driver
import (
"os"
"strings"
"sync"
@ -330,7 +331,23 @@ func (ns *node) NodeExpandVolume(
err.Error(),
)
}
if err = zfs.ResizeZFSVolume(vol, req.GetVolumePath()); err != nil {
// find if it is block device so that we don't attempt filesystem resize
st, err := os.Stat(req.GetVolumePath())
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to stat mountpath %s", err.Error())
}
resizefs := false
// doing this dirty check as volume capabilities are not passed for NodeExpandVolume
// CSI 1.2 spec will probably solve this
if st.IsDir() {
// it is not a block device, resize the filesystem
resizefs = true
}
if err = zfs.ResizeZFSVolume(vol, req.GetVolumePath(), resizefs); err != nil {
return nil, status.Errorf(
codes.Internal,
"failed to handle NodeExpandVolume Request for %s, {%s}",