API : Get all LV (disk and snap) to calculate the sum of all thin volume sizes

arnolem

Renowned Member
Jan 22, 2013
29
2
68
Hello,

I want to prevent this warning :
WARNING: Sum of all thin volume sizes exceeds the size of thin pool and the size of whole volume group

I can list all LV with :
Code:
lvs --units=g --nosuffix

But, i want to get the list and calculate the sum from the API.

I have try :
Code:
pvesh get /nodes/<node>/scan/lvmthin --vg=<VGID>
but the result is :
lv : <LVID>

However, the command behind this API endpoint is :

Code:
/sbin/lvs --separator : --noheadings --units b --unbuffered --nosuffix --config 'report/time_format="%s"' --options vg_name,lv_name,lv_size,lv_attr,pool_lv,data_percent,metadata_percent,snap_percent,uuid,tags,metadata_size,time

I have try with :
Code:
pvesh get /nodes/<node>/storage/<storage>/content
but this command doesn't list snapshots

Do you have an idea ?

Thanks
 
Hi,
with the default output format, pvesh won't show everything. You can use --output-format json-pretty to see what's available and --output-format json in combination with the jq tool to handle the data. But the /nodes/<node>/scan/lvmthin API endpoint will only show the thin pool itself, not the LVs in the pool. AFAIK, there is no API endpoint that lists what you want right now.

But this is a rather fundamental "problem" with LVM-thin, because it's designed for thin provisioning. Many people just monitor the actual usage of the thin pool so they can react before it gets really full. Maybe you'd rather like to use a thick provisioned storage?
 
Thank you, I actually think there is no API solutio
I need to monitor the realspace or used the lvs command
Thanks, I discovered --output-format json-pretty
 
I need to monitor the realspace or used the lvs command
Yes, if you don't require it to be queried via the API, you can use lvs itself :)
 
Yes, I need it to be queried via the API but that's not possible, I'll have to create a specific API that will call LVS itself
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!