[Fai-commit] r6050 - branches/stable/3.4/lib/setup-storage

Michael Prokop mika at alioth.debian.org
Fri Aug 27 12:06:56 UTC 2010


Author: mika
Date: 2010-08-27 12:06:48 +0000 (Fri, 27 Aug 2010)
New Revision: 6050

Modified:
   branches/stable/3.4/lib/setup-storage/Commands.pm
   branches/stable/3.4/lib/setup-storage/Init.pm
Log:
Enforce execution of mdadm --create only after all partition table manipulations

setup-storage/{Init.pm,Commands.pm}: Enforce execution of mdadm --create
commands to happen after all partition table manipulations.

Modified: branches/stable/3.4/lib/setup-storage/Commands.pm
===================================================================
--- branches/stable/3.4/lib/setup-storage/Commands.pm	2010-08-19 05:42:07 UTC (rev 6049)
+++ branches/stable/3.4/lib/setup-storage/Commands.pm	2010-08-27 12:06:48 UTC (rev 6050)
@@ -183,6 +183,11 @@
   my $cmd = "parted -s $disk set $part_no $t on";
   $cmd = "true" if ($part_no == -1);
   &FAI::push_command( $cmd, "cleared2_$disk,exist_$d", "type_${t}_$d" );
+  if (defined($FAI::partition_table_deps{$disk})) {
+    $FAI::partition_table_deps{$disk} .= ",type_${t}_$d";
+  } else {
+    $FAI::partition_table_deps{$disk} = "type_${t}_$d";
+  }
   return 1;
 }
 
@@ -320,9 +325,8 @@
           }
         }
         $d = &FAI::enc_name($d);
-        &FAI::set_partition_type_on_phys_dev($d, "raid");
-        if ((&FAI::phys_dev($d))[0]) {
-          $pre_req .= ",type_raid_$d";
+        if (&FAI::set_partition_type_on_phys_dev($d, "raid")) {
+          $pre_req .= ",pt_complete_" . (&FAI::phys_dev($d))[1];
         } else {
           $pre_req .= ",exist_$d";
         }
@@ -1033,12 +1037,16 @@
     $prev_id = $part_id;
   }
 
+  $FAI::partition_table_deps{$disk} = "cleared2_$disk,exist_"
+    . &FAI::make_device_name($disk, $prev_id);
+
   # set the bootable flag, if requested at all
   if ($FAI::configs{$config}{bootable} > -1) {
     &FAI::push_command( "parted -s $disk set " .
       $FAI::configs{$config}{bootable} . " boot on", "exist_" .
       &FAI::make_device_name($disk, $FAI::configs{$config}{bootable}),
       "boot_set_$disk" );
+    $FAI::partition_table_deps{$disk} .= ",boot_set_$disk";
   }
 
   # set the bios_grub flag on BIOS compatible GPT tables
@@ -1047,6 +1055,7 @@
       $FAI::configs{$config}{gpt_bios_part} . " bios_grub on", "exist_" .
       &FAI::make_device_name($disk, $FAI::configs{$config}{gpt_bios_part}),
       "bios_grub_set_$disk" );
+    $FAI::partition_table_deps{$disk} .= ",bios_grub_set_$disk";
   }
 }
 
@@ -1073,6 +1082,8 @@
         # virtual disks always exist
         &FAI::push_command( "true", "",
           "exist_" . &FAI::make_device_name($disk, $part_id) );
+        # no partition table operations
+        $FAI::partition_table_deps{$disk} = "";
       }
     } else {
       # create partitions on non-virtual configs
@@ -1148,6 +1159,10 @@
 #
 ################################################################################
 sub order_commands {
+  # first add partition-table-is-complete
+  &FAI::push_command("true", $FAI::partition_table_deps{$_}, "pt_complete_$_")
+    foreach (keys %FAI::partition_table_deps);
+
   my @pre_deps = ();
   my $i = 1;
   my $pushed = -1;

Modified: branches/stable/3.4/lib/setup-storage/Init.pm
===================================================================
--- branches/stable/3.4/lib/setup-storage/Init.pm	2010-08-19 05:42:07 UTC (rev 6049)
+++ branches/stable/3.4/lib/setup-storage/Init.pm	2010-08-27 12:06:48 UTC (rev 6050)
@@ -137,6 +137,13 @@
 
 ################################################################################
 #
+# @brief Dependencies to be fulfilled before a disk is ready for use
+#
+################################################################################
+%FAI::partition_table_deps = ();
+
+################################################################################
+#
 # @brief Add command to hash
 #
 # @param cmd Command




More information about the Fai-commit mailing list