mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
cleanup: do not panic when validateCloneDepthFlag() detects an error
When the cephcsi executable receives an error when calling validateCloneDepthFlag(), it panics due to klog.Fatalln(). The errors that validateCloneDepthFlag() logs should be understandable enough, so that users know what to investigate. A Go panic on a user error is not very userfriendly, and does not provide any additional usefil information. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
86a8d29bd1
commit
3e305970df
@ -191,11 +191,11 @@ func main() {
|
|||||||
func validateCloneDepthFlag(conf *util.Config) {
|
func validateCloneDepthFlag(conf *util.Config) {
|
||||||
// keeping hardlimit to 14 as max to avoid max image depth
|
// keeping hardlimit to 14 as max to avoid max image depth
|
||||||
if conf.RbdHardMaxCloneDepth == 0 || conf.RbdHardMaxCloneDepth > 14 {
|
if conf.RbdHardMaxCloneDepth == 0 || conf.RbdHardMaxCloneDepth > 14 {
|
||||||
klog.Fatalln("rbdhardmaxclonedepth flag value should be between 1 and 14")
|
logAndExit("rbdhardmaxclonedepth flag value should be between 1 and 14")
|
||||||
}
|
}
|
||||||
|
|
||||||
if conf.RbdSoftMaxCloneDepth > conf.RbdHardMaxCloneDepth {
|
if conf.RbdSoftMaxCloneDepth > conf.RbdHardMaxCloneDepth {
|
||||||
klog.Fatalln("rbdsoftmaxclonedepth flag value should not be greater than rbdhardmaxclonedepth")
|
logAndExit("rbdsoftmaxclonedepth flag value should not be greater than rbdhardmaxclonedepth")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user