Bug 1970119
| Summary: | Cockpit Storage: Show base-10 units by default | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Jonathan Earl Brassow <jbrassow> | ||||
| Component: | cockpit-appstream | Assignee: | Martin Pitt <mpitt> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Jan Ščotka <jscotka> | ||||
| Severity: | low | Docs Contact: | |||||
| Priority: | low | ||||||
| Version: | 8.0 | CC: | mmarusak, mpitt, nyewale | ||||
| Target Milestone: | beta | Keywords: | Reopened, Triaged | ||||
| Target Release: | 8.7 | Flags: | pm-rhel:
mirror+
|
||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | cockpit-appstream-269-1.el8 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2022-11-08 09:38:48 UTC | Type: | Feature Request | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
Jonathan Earl Brassow
2021-06-09 20:15:55 UTC
Created attachment 1789653 [details]
image of problem
Agreed -- The storage world mostly uses base-10 units now, let's make it consistently so. I think the only place where base-2 makes sense is (total) RAM size. > Logical volumes are given in powers of 2 (with incorrect 'iB' label).
For the record: this is *not* incorrect, it's the official unit name of base-2 units (KiB, MiB, etc.). It would be just plain wrong to label a base-2 unit with "MB". The page currently does show consistent numbers and units, and often it shows both base-2 and base-10 units at the same place. So this is not wrong, it's just a matter of opinion which units to display (and I'm afraid that's a topic which is very hard to get agreement on 😀)
I would be fine with always just showing base-10 units. Physical storage devices have been labelled with base-10 units for many many years by now. However, Marius rightfully points out that this may confuse a different set of people who are still being used to seeing base-2 units.
Agree. common lvm commands like pvs, vgs, lvs display size in base2 unit.
For Volume groups, sizes are being displayed in both formats.
>> Logical volumes are given in powers of 2 (with incorrect 'iB' label).
GiB = 2 to the 30th power (1,073,741,824) bytes (base 2)
GB = 10 to the 9th power (1,000,000,000) bytes (base 10)
No changes are needed other than the attached proposed patches for the raid devices and nfs mounts.
Please see attached screenshot - raid_and_nfs.png
At some places size is being shown is both units. In case that needs to be changed, we need to replace `fmt_size_long` with `fmt_size`. Example changes could be seen for the size of the VG.
In all following changes have been made so far and based on what features we need (do not need), need modifications in below patch
# git diff main
diff --git a/pkg/storaged/block-details.jsx b/pkg/storaged/block-details.jsx
index 0c37dc1db..e59166e1c 100644
--- a/pkg/storaged/block-details.jsx
+++ b/pkg/storaged/block-details.jsx
@@ -46,7 +46,7 @@ export class BlockDetails extends React.Component {
<DescriptionList className="pf-m-horizontal-on-sm">
<DescriptionListGroup>
<DescriptionListTerm>{_("storage", "Capacity")}</DescriptionListTerm>
- <DescriptionListDescription>{ utils.fmt_size_long(block.Size) }</DescriptionListDescription>
+ <DescriptionListDescription>{ utils.fmt_size(block.Size) }</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>{_("storage", "Device file")}</DescriptionListTerm>
diff --git a/pkg/storaged/drive-details.jsx b/pkg/storaged/drive-details.jsx
index ab7c9b295..e53c06561 100644
--- a/pkg/storaged/drive-details.jsx
+++ b/pkg/storaged/drive-details.jsx
@@ -81,7 +81,7 @@ export class DriveDetails extends React.Component {
<DriveDetailsRow title={_("storage", "Firmware version")} value={drive.Revision} />
<DriveDetailsRow title={_("storage", "Serial number")} value={drive.Serial} />
<DriveDetailsRow title={_("storage", "World wide name")} value={drive.WWN} />
- <DriveDetailsRow title={_("storage", "Capacity")} value={drive.Size ? utils.fmt_size_long(drive.Size) : _("No media inserted")} />
+ <DriveDetailsRow title={_("storage", "Capacity")} value={drive.Size ? utils.fmt_size(drive.Size) : _("No media inserted")} />
{ assessment }
<DriveDetailsRow title={_("storage", "Device file")} value={drive_block ? utils.block_name(drive_block) : "-"} />
{multipath_blocks.length > 0 && (
diff --git a/pkg/storaged/utils.js b/pkg/storaged/utils.js
index 4a091f5b9..edda5bd8f 100644
--- a/pkg/storaged/utils.js
+++ b/pkg/storaged/utils.js
@@ -85,7 +85,7 @@ export function encode_filename(decoded) {
}
export function fmt_size(bytes) {
- return cockpit.format_bytes(bytes, 1024);
+ return cockpit.format_bytes(bytes, 1000);
}
export function fmt_size_long(bytes) {
@@ -107,7 +107,7 @@ export function format_temperature(kelvin) {
export function format_fsys_usage(used, total) {
var text = "";
- var units = 1024;
+ var units = 1000;
var parts = cockpit.format_bytes(total, units, true);
text = " / " + parts.join(" ");
units = parts[1];
diff --git a/pkg/storaged/vgroup-details.jsx b/pkg/storaged/vgroup-details.jsx
index 75ede2dbc..90eaad274 100644
--- a/pkg/storaged/vgroup-details.jsx
+++ b/pkg/storaged/vgroup-details.jsx
@@ -234,7 +234,7 @@ export class VGroupDetails extends React.Component {
<DescriptionListGroup>
<DescriptionListTerm>{_("storage", "Capacity")}</DescriptionListTerm>
- <DescriptionListDescription>{ utils.fmt_size_long(vgroup.Size) }</DescriptionListDescription>
+ <DescriptionListDescription>{ utils.fmt_size(vgroup.Size) }</DescriptionListDescription>
</DescriptionListGroup>
</DescriptionList>
</CardBody>
(END)
Thank you,
Nitin Yewale
Final changes have been mentioned in comment #16. All changes may or may not be needed. Please suggest on next action. Thank you, Nitin Yewale (In reply to Nitin Yewale from comment #18) > Final changes have been mentioned in comment #16. All changes may or may not > be needed. Please suggest on next action. > > Thank you, > Nitin Yewale thanks for looking at this. If sizes are consistently reported, then I am happy. I don't particularly care if it is pow2 or pow10. Also, sorry about getting 'B' and 'iB' backwards in the initial description. :) (In reply to Martin Pitt from comment #2) > The storage world mostly uses base-10 units now, let's make it > consistently so. But is this really true? lsblk, vgs, "ls -lh", "du -h" all use powers of 1024 by default (without being explicit about it). "1M" means 1024*1024 to dd. I am not convinced that switching to powers of 1000 instead of 1024 in Cockpit is motivated enough. The storage world is a mess, and trying to align with it might just mean that we change Cockpit from "MB" to "MiB" and back again every couple of years. But GNOME Disks uses 1000s. This is a strong argument to also use 1000s in Cockpit: alignment with GNOME, to reuse their UX experience. Cockpits Metrics page is a bit inconsistent, showing available RAM in 1024s and used RAM in 1000s. and disk IO rates in 1024s and free space in 1000s. The servies page shows used RAM in 1024s. Cockpit-podman uses 1000s, except for memory usage and limits of containers, where it used 1024s. Cockpit-machines uses 1024s. In any case, I don't see this as a bug. Cockpit uses the units correctly. We re-discussed that in our team meeting, and we eventually decided to switch all units in cockpit to base-10, with the exception of the total memory size on the overview. The other exception is the individual RAM DIMM bars on the hardware information page, as (1) we just parrot the information from dmidecode, and (2) these have a natural base-2 unit and are sold that way. I recently worked on a lot of unit cleanup in cockpit, and https://github.com/cockpit-project/cockpit/pull/17163 is the final piece of this. (This is more generic than the initially proposed patch here) Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (cockpit-appstream bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:7554 |