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

(feat) Add lvm volumegroup describe feature #75

Merged
merged 2 commits into from
Aug 13, 2021
Merged

Conversation

vharsh
Copy link
Member

@vharsh vharsh commented Aug 12, 2021

➜  openebsctl git:(lvm_desc) ✗ kubectl openebs describe storage node1-virtual-machine --cas-type=localpv-lvm

node1-virtual-machine Details :

HOSTNAME        : node1-virtual-machine
NAMESPACE       : openebs
NUMBER OF POOLS : 1
TOTAL           : 1024GiB
TOTAL FREE      : 1020GiB
TOTAL LVs       : 1
TOTAL PVs       : 1

Volume group details
---------------------
NAME    UUID                                     LV COUNT   PV COUNT   USED PERCENTAGE
lvmvg   IgnC8K-OJaA-WBx6-JLYz-HQU3-W8kb-0LHbXy   1          1          0.39%

# without flags
➜  openebsctl git:(lvm_desc) ✗ kubectl openebs describe storage node1-virtual-machine                       

node1-virtual-machine Details :

HOSTNAME        : node1-virtual-machine
NAMESPACE       : openebs
NUMBER OF POOLS : 1
TOTAL           : 1024GiB
TOTAL FREE      : 1020GiB
TOTAL LVs       : 1
TOTAL PVs       : 1

Volume group details
---------------------
NAME    UUID                                     LV COUNT   PV COUNT   USED PERCENTAGE
lvmvg   IgnC8K-OJaA-WBx6-JLYz-HQU3-W8kb-0LHbXy   1          1          0.39%

# cstor storage describe still works
➜  openebsctl git:(lvm_desc) ✗ kubectl openebs describe storage default-cstor-disk-dcrm

default-cstor-disk-dcrm Details :
----------------
NAME             : default-cstor-disk-dcrm
HOSTNAME         : ip-10-0-8-190.ec2.internal
SIZE             : 94.14GiB
FREE CAPACITY    : 76.07GiB
READ ONLY STATUS : false

Signed-off-by: Harsh Vardhan harsh.vardhan@mayadata.io

Harsh Vardhan added 2 commits August 12, 2021 22:45
Signed-off-by: Harsh Vardhan <harsh.vardhan@mayadata.io>
Signed-off-by: Harsh Vardhan <harsh.vardhan@mayadata.io>
@vharsh vharsh linked an issue Aug 12, 2021 that may be closed by this pull request
6 tasks
{Cells: []interface{}{"pool-1", "node1", "174 GiB", "188 GiB", false, int32(2), int32(2), "ONLINE"}},
{Cells: []interface{}{"pool-2", "node2", "174 GiB", "188 GiB", false, int32(2), int32(2), "ONLINE"}}},
{Cells: []interface{}{"pool-1", "node1", "174.0GiB", "188.1GiB", false, int32(2), int32(2), "ONLINE"}},
{Cells: []interface{}{"pool-2", "node2", "174.0GiB", "188.1GiB", false, int32(2), int32(2), "ONLINE"}}},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made these changes to make sure that the unit-tests are all green, I'll revert nonsense updates like changing of 174.0GiB back to 174GiB after making sure no unit-tests fail in the entire project.

if err != nil {
return value
}
return units.BytesSize(float64(iBytes))
return units.CustomSize("%.1f%s", float64(bytes), 1024.0, []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to find a better format specifier such that 1024 bytes show up as 1KiB and not 1.0KiB.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe upto 2 decimal place is a better precision.

Copy link
Member

@Abhinandan-Purkait Abhinandan-Purkait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if err != nil {
return value
}
return units.BytesSize(float64(iBytes))
return units.CustomSize("%.1f%s", float64(bytes), 1024.0, []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe upto 2 decimal place is a better precision.

@vharsh
Copy link
Member Author

vharsh commented Aug 13, 2021

Maybe upto 2 decimal place is a better precision.

I'll do it in upcoming PRs, this would need some digging around format specifiers.

@vharsh vharsh merged commit 19556a1 into openebs:develop Aug 13, 2021
@vharsh vharsh deleted the lvm_desc branch August 13, 2021 08:07
Copy link
Member

@shubham14bajpai shubham14bajpai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

Add support for LVM LocalPV
3 participants