mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 09:39:08 +00:00
cmd: Fix disk "size" handling
commit bdf9b1f31a
introduced a bug with disk size handling
where GB was not handled correctly. Fix it.
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
parent
b3bb4d02e6
commit
ce8de92978
@ -109,16 +109,17 @@ func getDiskSizeMB(s string) (int, error) {
|
||||
}
|
||||
sz := len(s)
|
||||
if strings.HasSuffix(s, "M") {
|
||||
i, err := strconv.Atoi(s[:sz-1])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return i, nil
|
||||
return strconv.Atoi(s[:sz-1])
|
||||
}
|
||||
if strings.HasSuffix(s, "G") {
|
||||
s = s[:sz-1]
|
||||
}
|
||||
return strconv.Atoi(s)
|
||||
|
||||
i, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return 1024 * i, nil
|
||||
}
|
||||
|
||||
// DiskConfig is the config for a disk
|
||||
|
Loading…
Reference in New Issue
Block a user