]> git.proxmox.com Git - pve-storage.git/commitdiff
api: disks: create: set correct partition type
authorFabian Ebner <f.ebner@proxmox.com>
Wed, 6 Oct 2021 09:18:46 +0000 (11:18 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 7 Oct 2021 12:39:26 +0000 (14:39 +0200)
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/API2/Disks/Directory.pm
PVE/API2/Disks/LVM.pm
PVE/API2/Disks/LVMThin.pm
PVE/API2/Disks/ZFS.pm

index 52f0c863a89ef06158d7f1eb47a53910369cc8e9..3a90a2ed0d5de75ca2ab4b011f52fa9e4f618010 100644 (file)
@@ -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";
index eb8f5c0d07856e72b5a1c514674294e04eca9251..885e02b585c5059118345fd7423e033509e54aeb 100644 (file)
@@ -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.
index 2fd84845654ffd50c7b74b2df5f9f25b52892b8d..83ebc46d8bc2812292e306fa30e4f1021a6385d3 100644 (file)
@@ -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
index 6486404b917bbac5cd79bdba8b019c0ca4e8346c..7f96bb7cc338140a3bd625a9c3e72428ae241e1c 100644 (file)
@@ -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/!;