[pve-devel] [PATCH storage 05/10] diskmanage: don't set usage for unused partitions
Fabian Ebner
f.ebner at proxmox.com
Tue Sep 28 13:39:45 CEST 2021
The disk type is already 'partition' so there's no additional
information here. And it would need to serve as a code-word for
unused partitions. The cleaner approach is to not set the usage.
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
Was not a smart decision back then...If this is considered a breaking
change for the disk list API call, I'll go for a different approach of
course, but AFAICS it would be one of:
1. Keep usage 'partition', but also return the unused partitions when
'include-partitions=1,type=unused', and have disk_is_used not complain
about usage 'partition'.
2. Add a new type filter/extend it so it can handle multiple types,
i.e. type=unused,partition.
3. Request all disks in the frontend and filter there.
PVE/Diskmanage.pm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index 5614e40..7aad707 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -647,7 +647,7 @@ sub get_disks {
# for devices, this check is done explicitly later
return 'Device Mapper' if !dir_is_empty("$sysdir/holders");
- return 'partition';
+ return; # unused partition
};
my $collect_ceph_info = sub {
@@ -716,7 +716,6 @@ sub get_disks {
my $used = $determine_usage->($devpath, $sysdir, 0);
if (!$include_partitions) {
foreach my $part (sort keys %{$partitions}) {
- next if $partitions->{$part}->{used} eq 'partition';
$used //= $partitions->{$part}->{used};
}
} else {
--
2.30.2
More information about the pve-devel
mailing list