fix(cgi-bin): include storage group UUID in response

main
Tsu-ba-me 4 years ago
parent 4f88b1f536
commit 4fa1cb7f31
  1. 20
      cgi-bin/get_shared_storage

@ -49,7 +49,8 @@ sub get_storage_groups
# ORDER BY [free] ASC to only select the storage with lowest free space. # ORDER BY [free] ASC to only select the storage with lowest free space.
my $query = " my $query = "
SELECT SELECT
DISTINCT ON (sgr.storage_group_name) storage_group_name, DISTINCT ON (sgr.storage_group_uuid) storage_group_uuid,
sgr.storage_group_name,
slv.scan_lvm_vg_size, slv.scan_lvm_vg_size,
slv.scan_lvm_vg_free slv.scan_lvm_vg_free
FROM FROM
@ -66,7 +67,7 @@ WHERE
AND AND
anv.anvil_uuid = ".$anvil->Database->quote($anvil_uuid)." anv.anvil_uuid = ".$anvil->Database->quote($anvil_uuid)."
ORDER BY ORDER BY
sgr.storage_group_name ASC, sgr.storage_group_uuid ASC,
slv.scan_lvm_vg_free ASC slv.scan_lvm_vg_free ASC
;"; ;";
@ -79,19 +80,22 @@ ORDER BY
}}); }});
foreach my $row (@{$results}) foreach my $row (@{$results})
{ {
my $storage_group_name = $row->[0]; my $storage_group_uuid = $row->[0];
my $scan_lvm_vg_size = $row->[1]; my $storage_group_name = $row->[1];
my $scan_lvm_vg_free = $row->[2]; my $scan_lvm_vg_size = $row->[2];
my $scan_lvm_vg_free = $row->[3];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
storage_group_uuid => $storage_group_uuid,
storage_group_name => $storage_group_name, storage_group_name => $storage_group_name,
scan_lvm_vg_size => $scan_lvm_vg_size, scan_lvm_vg_size => $scan_lvm_vg_size,
scan_lvm_vg_free => $scan_lvm_vg_free scan_lvm_vg_free => $scan_lvm_vg_free
}}); }});
push(@{$storage_groups}, { push(@{$storage_groups}, {
name => $storage_group_name, storage_group_uuid => $storage_group_uuid,
total => int($scan_lvm_vg_size), storage_group_name => $storage_group_name,
free => int($scan_lvm_vg_free) storage_group_total => int($scan_lvm_vg_size),
storage_group_free => int($scan_lvm_vg_free)
}); });
} }

Loading…
Cancel
Save