api: disks: create: set correct partition type
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
a2c34371e6
commit
05d9171278
@ -216,7 +216,10 @@ __PACKAGE__->register_method ({
|
||||
|
||||
my $part = $dev;
|
||||
|
||||
if (!PVE::Diskmanage::is_partition($dev)) {
|
||||
if (PVE::Diskmanage::is_partition($dev)) {
|
||||
eval { PVE::Diskmanage::change_parttype($dev, '8300'); };
|
||||
warn $@ if $@;
|
||||
} else {
|
||||
# create partition
|
||||
my $cmd = [$SGDISK, '-n1', '-t1:8300', $dev];
|
||||
print "# ", join(' ', @$cmd), "\n";
|
||||
|
||||
@ -156,6 +156,11 @@ __PACKAGE__->register_method ({
|
||||
PVE::Diskmanage::locked_disk_action(sub {
|
||||
PVE::Diskmanage::assert_disk_unused($dev);
|
||||
|
||||
if (PVE::Diskmanage::is_partition($dev)) {
|
||||
eval { PVE::Diskmanage::change_parttype($dev, '8E00'); };
|
||||
warn $@ if $@;
|
||||
}
|
||||
|
||||
PVE::Storage::LVMPlugin::lvm_create_volume_group($dev, $name);
|
||||
|
||||
# FIXME: Remove once we depend on systemd >= v249.
|
||||
|
||||
@ -110,6 +110,11 @@ __PACKAGE__->register_method ({
|
||||
PVE::Diskmanage::locked_disk_action(sub {
|
||||
PVE::Diskmanage::assert_disk_unused($dev);
|
||||
|
||||
if (PVE::Diskmanage::is_partition($dev)) {
|
||||
eval { PVE::Diskmanage::change_parttype($dev, '8E00'); };
|
||||
warn $@ if $@;
|
||||
}
|
||||
|
||||
PVE::Storage::LVMPlugin::lvm_create_volume_group($dev, $name);
|
||||
my $pv = PVE::Storage::LVMPlugin::lvm_pv_info($dev);
|
||||
# keep some free space just in case
|
||||
|
||||
@ -375,6 +375,17 @@ __PACKAGE__->register_method ({
|
||||
PVE::Diskmanage::assert_disk_unused($dev);
|
||||
|
||||
my $is_partition = PVE::Diskmanage::is_partition($dev);
|
||||
|
||||
if ($is_partition) {
|
||||
eval {
|
||||
PVE::Diskmanage::change_parttype(
|
||||
$dev,
|
||||
'6a898cc3-1dd2-11b2-99a6-080020736631',
|
||||
);
|
||||
};
|
||||
warn $@ if $@;
|
||||
}
|
||||
|
||||
my $sysfsdev = $is_partition ? PVE::Diskmanage::get_blockdev($dev) : $dev;
|
||||
|
||||
$sysfsdev =~ s!^/dev/!/sys/block/!;
|
||||
|
||||
Reference in New Issue
Block a user