assert_blockdev($disk);
- # we should already have checked if it is in use in the api call
- # but we check again for safety
+ # we should already have checked these in the api call, but we check again for safety
+ die "$disk is a partition\n" if is_partition($disk);
die "disk $disk is already in use\n" if disk_is_used($disk);
my $id = $uuid || 'R';
my $dev = $disk;
$dev =~ s|^/dev/||;
- my $disklist = get_disks($dev, 1);
+ my $disklist = get_disks($dev, 1, 1);
die "'$disk' is not a valid local disk\n" if !defined($disklist->{$dev});
return 1 if $disklist->{$dev}->{used};
# 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 {
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 {