api: disks: initgpt: explicitly abort for partitions
In preparation to extend disk_is_used to support partitions. Without this new check, initgpt would also allow partitions once disk_is_used supports partitions, which is not desirable. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
ff91cfae35
commit
cc884f73d8
@ -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});
|
||||
|
||||
@ -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';
|
||||
|
||||
Reference in New Issue
Block a user