api: fix get content call response type for RBD/ZFS/iSCSI volumes

`pvesh get /nodes/{node}/storage/{storage}/content/{volume}` failed for
several storage types, because the respective storage plugins returned
only the volumes `size` on `volume_size_info` calls, while also the format
is required.

This patch fixes the issue by returning also `format` and where possible `used`.

The issue was reported in the forum:
https://forum.proxmox.com/threads/pvesh-get-nodes-node-storage-storage-content-volume-returns-error.123747/

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
 [ T: fixup white space error ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Christian Ebner
2023-03-09 10:41:23 +01:00
committed by Thomas Lamprecht
parent 13e1af437a
commit d70d814ccf
3 changed files with 50 additions and 7 deletions

View File

@ -208,7 +208,7 @@ sub volume_size_info {
my $vollist = iscsi_ls($scfg,$storeid);
my $info = $vollist->{$storeid}->{$volname};
return $info->{size};
return wantarray ? ($info->{size}, 'raw', 0, undef) : $info->{size};
}
sub volume_resize {