Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: option to show vd size in bytes #4

Open
elonen opened this issue Oct 24, 2018 · 8 comments
Open

Feature request: option to show vd size in bytes #4

elonen opened this issue Oct 24, 2018 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@elonen
Copy link

elonen commented Oct 24, 2018

The linstor vd list command shows volume sizes in human friendly format. Sometimes it's necessary to know the exact size. An option to set change unit for size listing would be nice.

@ghernadi
Copy link
Contributor

Do you really want (as a human user) see the size in bytes of every volume definition? I'm asking because usually such information is only needed when automatically processing the output from the linstor-cli, in which case you can use the -m option and in combination with jq you should be able to get your information.

@elonen
Copy link
Author

elonen commented Oct 24, 2018

Yes, you sometimes need the information when, for example, adding manually created DRBD devices to VM definitions (at least on Proxmox, and actually in kilobytes). I'm currently using blockdev --getsize64 /dev/drbd/by-res/<something> which works, but is a bit clunky.

@rck
Copy link
Member

rck commented Oct 24, 2018

But then you already have blockdev, and more importantly -m of linstor.

IMO it is a good feature request, and we have a nice library for the conversions. But don't expect it very soon, there are more important things to fix.

@rck rck self-assigned this Oct 24, 2018
@elonen
Copy link
Author

elonen commented Oct 24, 2018

Sure, not a very high priority.

@raltnoeder
Copy link
Member

Should be fairly easy to add, since LINSTOR stores the volume size in kiB internally. We could optionally add a few switches to control the SI unit that would be used for reporting, so that output could be in bytes or kiB, maybe also in MiB/GiB/etc., but since those greater magnitude units may require rounding, this may only be useful in combination with certain switches to control how the software reports exact numbers vs. rounded numbers and how the numbers are rounded.

@rp- rp- added the enhancement New feature or request label Oct 30, 2018
@candlerb
Copy link

Note that linstor -m vd l returns the requested size in KiB, which may be less than the actual device size:

root@node1:~# linstor -m vd l | grep size
            "vlm_size": 1048576,
root@node1:~# echo $(( 1048576*1024 ))
1073741824
root@node1:~# blockdev --getsize64 /dev/drbd1000
1077665792

I presume this is because an extra LVM extent (4MiB) is allocated for DRBD metadata, but only part of it is used for that purpose, and the rest is returned to the user.

@ghernadi
Copy link
Contributor

That size states the usable size. If you are interested in more details, please see linstor -m --output-version v1 v l.

@candlerb
Copy link

This means we've moved from looking at volume-definition to volume, which is fair enough.

However, it looks like there's another problem here. The size I get from blockdev --getsize64 is 1052408 KiB; this does not match any of the values returned by linstor -m --output-version v1 v l, and in particular none of the "usable" values.

root@node1:~# echo $(( 1052408 * 1024 ))
1077665792
root@node1:~# blockdev --getsize64 /dev/drbd1000
1077665792

root@node1:~# linstor -m --output-version v1 v l | egrep '\b1[0-9]{6}\b' | sort -u
                  "allocated_size_kib": 1052672,
                  "usable_size_kib": 1048576
                  "usable_size_kib": 1052672,
                "allocated_size_kib": 1048840,
                "allocated_size_kib": 1052672,
                "usable_size_kib": 1048576
                "usable_size_kib": 1052672,
              "allocated_size_kib": 1048840,
              "usable_size_kib": 1048576
          "allocated_size_kib": 1052672,
  • 1052672 is 1028MiB, the size of the underlying LVM volume
  • 1048576 is 1024MiB, the size requested in the volume-definition
  • 1048840 is the size requested (1024MiB) plus the DRBD metadata size (264KiB), i.e. the minimum size which the underlying volume could have

However, the usable volume size (to match blockdev) would be the allocated size (1028MiB) less the DRBD metadata size (264KiB) - and this doesn't appear anywhere in the output.

root@node1:~# echo $(( 1028*1024 - 264 ))
1052408

Here is one volume in detail:

    {
      "name": "my_ssd_res",
      "node_name": "node3",
      "props": {
        "StorPoolName": "pool_ssd"
      },
      "layer_object": {
        "children": [
          {
            "type": "STORAGE",
            "storage": {
              "storage_volumes": [
                {
                  "volume_number": 0,
                  "device_path": "/dev/vg_ssd/my_ssd_res_00000",
                  "allocated_size_kib": 1052672,
                  "usable_size_kib": 1052672,
                  "disk_state": "[]"
                }
              ]
            }
          }
        ],
        "type": "DRBD",
        "drbd": {
          ...
          "drbd_volumes": [
            {
              "drbd_volume_definition": {
                "volume_number": 0,
                "minor_number": 1000
              },
              "device_path": "/dev/drbd1000",
              "backing_device": "/dev/vg_ssd/my_ssd_res_00000",
              "allocated_size_kib": 1048840,
              "usable_size_kib": 1048576
            }
          ],
      "volumes": [
        {
          "volume_number": 0,
          "storage_pool_name": "pool_ssd",
          "provider_kind": "LVM",
          "device_path": "/dev/drbd1000",
          "allocated_size_kib": 1052672,
          "state": {
            "disk_state": "UpToDate"
          },
          "layer_data_list": [
            {
              "type": "DRBD",
              "data": {
                "drbd_volume_definition": {
                  "volume_number": 0,
                  "minor_number": 1000
                },
                "device_path": "/dev/drbd1000",
                "backing_device": "/dev/vg_ssd/my_ssd_res_00000",
                "allocated_size_kib": 1048840,
                "usable_size_kib": 1048576
              }
            },
            {
              "type": "STORAGE",
              "data": {
                "volume_number": 0,
                "device_path": "/dev/vg_ssd/my_ssd_res_00000",
                "allocated_size_kib": 1052672,
                "usable_size_kib": 1052672,
                "disk_state": "[]"
              }
            }
          ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants