X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FDiskmanage.pm;h=18459f95291a5f70af8c051d49208cb7705fee71;hb=bfba962647d943b9392d79bdb8aabea1186117f8;hp=5041fb393f20670a2c9c94223eb492a41cb52cc8;hpb=bd46e59b5d6dba1739f4286d589944fbd32b67a3;p=pve-storage.git diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm index 5041fb3..18459f9 100644 --- a/PVE/Diskmanage.pm +++ b/PVE/Diskmanage.pm @@ -63,8 +63,8 @@ sub init_disk { 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'; @@ -78,7 +78,7 @@ sub disk_is_used { 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}; @@ -661,7 +661,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 { @@ -730,7 +730,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 {