diff --git a/PVE/API2/Disks.pm b/PVE/API2/Disks.pm index 96c19fd..25c9ded 100644 --- a/PVE/API2/Disks.pm +++ b/PVE/API2/Disks.pm @@ -260,6 +260,7 @@ __PACKAGE__->register_method ({ my $authuser = $rpcenv->get_user(); + die "$disk is a partition\n" if PVE::Diskmanage::is_partition($disk); die "disk $disk already in use\n" if PVE::Diskmanage::disk_is_used($disk); my $worker = sub { PVE::Diskmanage::init_disk($disk, $param->{uuid}); diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm index c896c5a..f0e14dc 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';