Skip to content

Commit

Permalink
fix lsblk float-int issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Glonek committed Dec 20, 2023
1 parent 288a693 commit 8c288ab
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@
* Fix: Auto-create temporary directory as needed, if it is specified.
* Fix: GCP: Handle firewall rules which use an IP instead of CIDR.
* Fix: New exporter name changes cause 1.15.0 to not install. This uses the new names.
* Fix: `lsblk` now shows sizes as float not int.
* Aerospike Client Versions: `data insert`, `data delete` support for `v7` aerospike client.

#### 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.

Expand Down
23 changes: 21 additions & 2 deletions src/cmdClusterPartitionConf.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"log"
"math"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -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 := ""
Expand All @@ -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 := ""
Expand Down

0 comments on commit 8c288ab

Please sign in to comment.