diff --git a/CHANGELOG.md b/CHANGELOG.md index 21d06fc1..a6910988 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +#### 7.2.2 +* Fix: `lsblk` now shows sizes as float not int. + #### 7.2.1 * Fix: New exporter name changes cause 1.15.0 to not install. This uses the new names. diff --git a/src/cmdClusterPartitionConf.go b/src/cmdClusterPartitionConf.go index 655ee1bc..265f3019 100644 --- a/src/cmdClusterPartitionConf.go +++ b/src/cmdClusterPartitionConf.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "log" + "math" "sort" "strconv" "strings" @@ -285,7 +286,16 @@ func (c *clusterPartitionConfCmd) do(nodeNo int, disks map[int]map[int]blockDevi pp := p.MountPoint vals = append(vals, &pp) cc.Stanza("namespace "+c.Namespace).Stanza("index-type flash").SetValues("mount", vals) - fsSizeI, err := strconv.Atoi(strings.TrimRight(p.FsSize, "GMBTgmbti")) + var fsSizeI int + if strings.Contains(p.FsSize, ".") { + var fsSizeF float64 + fsSizeF, err = strconv.ParseFloat(strings.TrimRight(p.FsSize, "GMBTgmbti"), 64) + if err == nil { + fsSizeI = int(math.Floor(fsSizeF)) + } + } else { + fsSizeI, err = strconv.Atoi(strings.TrimRight(p.FsSize, "GMBTgmbti")) + } fsSize := p.FsSize if err == nil { suffix := "" @@ -312,7 +322,16 @@ func (c *clusterPartitionConfCmd) do(nodeNo int, disks map[int]map[int]blockDevi pp := p.MountPoint vals = append(vals, &pp) cc.Stanza("namespace "+c.Namespace).Stanza("sindex-type flash").SetValues("mount", vals) - fsSizeI, err := strconv.Atoi(strings.TrimRight(p.FsSize, "GMBTgmbti")) + var fsSizeI int + if strings.Contains(p.FsSize, ".") { + var fsSizeF float64 + fsSizeF, err = strconv.ParseFloat(strings.TrimRight(p.FsSize, "GMBTgmbti"), 64) + if err == nil { + fsSizeI = int(math.Floor(fsSizeF)) + } + } else { + fsSizeI, err = strconv.Atoi(strings.TrimRight(p.FsSize, "GMBTgmbti")) + } fsSize := p.FsSize if err == nil { suffix := ""