-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expand volume fix #142
expand volume fix #142
Conversation
@sunpa93 Can you please list what tests you have done for this fix? Thanks. |
┌[satiwa☮MININT-UMBS8MU]-(/mnt/c/Users/satiwa)
└> csc controller new --endpoint tcp://127.0.0.1:10000 --cap 1,block CSIVolumeName --req-bytes 2147483648 --params skuname=Standard_LRS
"k8s#fusec2151e57321d480c8f7#csivolumename" 2147483648 "containername"="csivolumename" "skuname"="Standard_LRS"
┌[satiwa☮MININT-UMBS8MU]-(/mnt/c/Users/satiwa)
└> csc controller expand-volume --endpoint tcp://127.0.0.1:10000 --cap 1,block --req-bytes 2147483650 "k8s#fusec2151e57321d480c8f7#csivolumename"
2147483650 Without the ┌[satiwa☮MININT-UMBS8MU]-(/mnt/c/Users/satiwa)
└> csc controller expand-volume --endpoint tcp://127.0.0.1:10000 --req-bytes 2147483650 "k8s#fusec2151e57321d480c8f7#csivolumename"
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/rexray/gocsi/csc/cmd.glob..func6(0xba7d20, 0xc000134690, 0x1, 0x5, 0x0, 0x0)
/home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi/csc/cmd/controller_expand_volume.go:33 +0x458
github.com/spf13/cobra.(*Command).execute(0xba7d20, 0xc000134640, 0x5, 0x5, 0xba7d20, 0xc000134640)
/home/satiwa/.gvm/pkgsets/go1.15/global/pkg/mod/github.com/spf13/[email protected]/command.go:698 +0x44c
github.com/spf13/cobra.(*Command).ExecuteC(0xbaa9c0, 0x1, 0x8bb848, 0x13b)
/home/satiwa/.gvm/pkgsets/go1.15/global/pkg/mod/github.com/spf13/[email protected]/command.go:783 +0x2d1
github.com/spf13/cobra.(*Command).Execute(...)
/home/satiwa/.gvm/pkgsets/go1.15/global/pkg/mod/github.com/spf13/[email protected]/command.go:736
github.com/rexray/gocsi/csc/cmd.Execute()
/home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi/csc/cmd/root.go:165 +0x3f
main.main()
/home/satiwa/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi/csc/main.go:6 +0x25 |
@sunpa93 You might have to revert to a pointer and do null checks. |
@xing-yang I have run @dr0pdb Thank you for pointing that out. I did not think about the cases when the command is run without the --cap flag. I have added an additional check statement in |
This works now both with and without ┌[satiwa☮MININT-UMBS8MU]-(~/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi)-[git://expand-volume-fix ✔]-
└> csc controller new --endpoint tcp://127.0.0.1:10000 --cap 1,block CSIVolumeName --req-bytes 2147483648 --params skuname=Standard_LRS
"k8s#fusec2151e57321d480c8f7#csivolumename" 2147483648 "containername"="csivolumename" "skuname"="Standard_LRS"
┌[satiwa☮MININT-UMBS8MU]-(~/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi)-[git://expand-volume-fix ✔]-
└> csc controller expand-volume --endpoint tcp://127.0.0.1:10000 --cap 1,block --req-bytes 2147483650
"k8s#fusec2151e57321d480c8f7#csivolumename"
2147483650
┌[satiwa☮MININT-UMBS8MU]-(~/.gvm/pkgsets/go1.15/global/src/github.com/rexray/gocsi)-[git://expand-volume-fix ✔]-
└> csc controller expand-volume --endpoint tcp://127.0.0.1:10000 --req-bytes 2147483651 "k8s#fusec2151e57321d480c8f7#csivolumename"
2147483651 |
@sunpa93 Feel free to mark it as ready for review so that it can be accepted. Thanks. |
LGTM |
I don't have write access. Can this PR be merged now please? |
/assign @codenrhoden |
@codenrhoden just wanted to follow up on this 👍 |
hi @codenrhoden could you help approve this PR? |
@akutz could you approve? thanks. |
Hi @andyzhangx , This looks good to me; thank you! |
**The
expand-volume
panic (#141) comes from trying to access uninitialized pointer value in flag setting. And this can be resolved by adjusting theexpandVolume
variable structure fields.volCap
is currently an uninitialized pointer variable so whencobra
tries to parse arguments and set the variable, it ends up dereferencing nill pointer value. That said, the problem can be resolved by changingvolCap
type tovolumeCapabilitySliceArg
instead of its pointer type.And adjusting other functions dependent of this variable.
The same fix can be applied to
node_expand_volume.go
for the same reason.**