This reverts commit 967a42f116d23051c862a3b4983925de2016f83c.
Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com>
Roll back the change to fix the parameter of HumanSize from int64 to float64
Upstream-commit: 36560a76d71f1222122c9e6c82f76a609da564e9
Component: engine
Addresses #8057
Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
Upstream-commit: 4119c9d7d955757092adc3410da8d75f972bd3c1
Component: engine
Also, now that I was at it, gave them a small refactor.
Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
Upstream-commit: 81c7d28b842844778a652b7353f52332f4276afb
Component: engine
Both functions perform the same logic and they just vary on the base
multiplication units. We can refactor the common code into a single
place.
Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
Upstream-commit: 386d300a6e07c99380a0814497cf0bc672df1e63
Component: engine
No need to initialize every time the function executes since it works as
a catalog.
Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
Upstream-commit: e4ab996b9d0d97089b076cfef32405f5f3fedc7c
Component: engine
No need to have two lines. The type is even explicit when type casting
to `float64(size)`
Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
Upstream-commit: d512294382c9013dee2820745db02ab63dc2ecdd
Component: engine
No need to recompile a fixed regular expression each time the function
executes. Abstracting it to the `init()` method.
Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
Upstream-commit: a4d57d8a851bf288804215b39c9d56a51550a228
Component: engine
May make sense that both `FromHumanSize()` and `RAMInBytes()` support
the same units. Added 'PB' to the RAMInBytes regex.
Also updated tests.
Note: int64 is overflowed on quantities >= EB
Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
Upstream-commit: 0fd37bd7ac0f92eda0a55cf2bedf77f1996b8472
Component: engine
Seems the perfect case for 'case' ;).
Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
Upstream-commit: 03697f0a93b04122a5039db915afddf60ccec448
Component: engine
Better to not use `error` as var name (might eclipse the error type) for
clarity and to prevent subtle bugs.
Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
Upstream-commit: ea7b8ea03f5c2222060afe435e907c1ab855a44b
Component: engine
Remove named returns since not used in function body. Might prevent
potential subtle bugs.
Docker-DCO-1.1-Signed-off-by: Francisco Carriedo <fcarriedo@gmail.com> (github: fcarriedo)
Upstream-commit: 588090c49bf2ec077626d89196515e6bef1f7a69
Component: engine
Device Mapper needs device sizes in binary (1024) multiples. Otherwise
kernel checks can find that the specified thin-pool device sizes aren't
a multiple of the specified thin-pool blocksize.
The name for "RAMInBytes" is likely too narrow given the new consumers
but... Also add "tebibyte" support to RAMInBytes.
Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: 2470a5ed999d9dc8d4b9bd250727ac13964db5b3
Component: engine
This does the "reverse" of HumanSize, i.e. maps a string to an int64
using SI prefixes for the extension.
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 13f07b636f014331a5d5dc0eac40d6ac9e5c9263
Component: engine