[Fai-commit] r4722 - in people/michael/features/setup_harddisks_2/implementation: . lib

michael-guest at alioth.debian.org michael-guest at alioth.debian.org
Sun Nov 11 21:51:40 UTC 2007


Author: michael-guest
Date: 2007-11-11 21:51:39 +0000 (Sun, 11 Nov 2007)
New Revision: 4722

Modified:
   people/michael/features/setup_harddisks_2/implementation/lib/commands.pm
   people/michael/features/setup_harddisks_2/implementation/lib/exec.pm
   people/michael/features/setup_harddisks_2/implementation/lib/fstab.pm
   people/michael/features/setup_harddisks_2/implementation/lib/init.pm
   people/michael/features/setup_harddisks_2/implementation/lib/parser.pm
   people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm
   people/michael/features/setup_harddisks_2/implementation/lib/volumes.pm
   people/michael/features/setup_harddisks_2/implementation/storage-magic
Log:
fixes wrong syntax for references, removed useless quotes for hash keys


Modified: people/michael/features/setup_harddisks_2/implementation/lib/commands.pm
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/lib/commands.pm	2007-11-11 13:34:07 UTC (rev 4721)
+++ people/michael/features/setup_harddisks_2/implementation/lib/commands.pm	2007-11-11 21:51:39 UTC (rev 4722)
@@ -48,15 +48,15 @@
 sub build_mkfs_commands {
   my ( $device, $partition ) = @_;
 
-  defined( $partition->{"filesystem"} )
+  defined( $partition->{filesystem} )
     or die "INTERNAL ERROR: filesystem is undefined\n";
-  my $fs = $partition->{"filesystem"};
+  my $fs = $partition->{filesystem};
 
   return if ( $fs eq "-" );
 
-  my ($create_options) = $partition->{"fs_options"}=~m/.*createopts="([^"]+)".*/;
-  my ($tune_options) = $partition->{"fs_options"}=~m/.*tuneopts="([^"]+)".*/;
-  $create_options = $partition->{"fs_options"} unless $create_options;
+  my ($create_options) = $partition->{fs_options}=~m/.*createopts="([^"]+)".*/;
+  my ($tune_options) = $partition->{fs_options}=~m/.*tuneopts="([^"]+)".*/;
+  $create_options = $partition->{fs_options} unless $create_options;
   print STDERR "create_options: $create_options tune_options: $tune_options\n" if $FAI::debug;
 
   # create the file system with options
@@ -99,23 +99,23 @@
     ( $config eq "RAID" ) or die "INTERNAL ERROR: Invalid config\n";
 
     # create all raid devices
-    foreach my $id ( sort keys %{ $FAI::configs{$config}{"volumes"} } ) {
+    foreach my $id ( sort keys %{ $FAI::configs{$config}{volumes} } ) {
 
       # keep a reference to the current volume
-      my $vol_ref = $FAI::configs->{$config}->{"volumes"}->{$id};
+      my $vol_ref = ( \%FAI::configs )->{$config}->{volumes}->{$id};
       # the desired RAID level
-      my $level = $vol_ref->{"mode"};
+      my $level = $vol_ref->{mode};
 
       # prepend "raid", if the mode is numeric-only
       $level = "raid" . $level if ( $level =~ /^\d+$/ );
 
       # the list of RAID devices
-      my @devs = keys %{ $vol_ref->{"devices"} };
+      my @devs = keys %{ $vol_ref->{devices} };
 
       # set proper partition types for RAID
       foreach my $d (@devs) {
         # skip devices marked missing
-        next if( 1 == $vol_ref->{"devices"}{$d}{"missing"} );
+        next if( 1 == $vol_ref->{devices}{$d}{missing} );
         # only match physical partitions (this string of matchings is hopefully complete)
         next unless( $d =~
           m{^/dev/(cciss/c\dd\dp|ida/c\dd\dp|rd/c\dd\dp|ataraid/d\dp|sd[a-t]|hd[a-t])(\d+)$} );
@@ -142,7 +142,7 @@
 
       # create the filesystem on the volume
       &FAI::build_mkfs_commands( "/dev/md$id",
-        \%{ $FAI::configs{$config}{"volumes"}{$id} } );
+        \%{ $FAI::configs{$config}{volumes}{$id} } );
     }
   }
 }
@@ -197,18 +197,18 @@
 
     # find volumes that should be preserved or resized and ensure that they
     # already exist
-    foreach my $lv ( keys %{ $FAI::configs{$config}{"volumes"} } ) {
+    foreach my $lv ( keys %{ $FAI::configs{$config}{volumes} } ) {
       # reference to the size of the current logical volume
-      my $lv_ref_size = $FAI::configs->{$config}->{"volumes"}->{$lv}->{"size"};
-      next unless ( $lv_ref->{"preserve"} == 1 || $lv_ref->{"resize"} == 1 );
+      my $lv_ref_size = ( \%FAI::configs )->{$config}->{volumes}->{$lv}->{size};
+      next unless ( $lv_ref_size->{preserve} == 1 || $lv_ref_size->{resize} == 1 );
 
       # preserved or resized volumes must exist already
-      defined( $FAI::current_lvm_config{$vg}{"volumes"}{$lv} )
+      defined( $FAI::current_lvm_config{$vg}{volumes}{$lv} )
         or die "/dev/$vg/$lv can't be preserved, it does not exist.\n";
     }
 
     # set proper partition types for LVM
-    foreach my $d (keys %{ $FAI::configs{$config}{"devices"} }) {
+    foreach my $d (keys %{ $FAI::configs{$config}{devices} }) {
       # only match physical partitions (this string of matchings is hopefully complete)
       next unless( $d =~
         m{^/dev/(cciss/c\dd\dp|ida/c\dd\dp|rd/c\dd\dp|ataraid/d\dp|sd[a-t]|hd[a-t])(\d+)$} );
@@ -229,12 +229,12 @@
     # create the volume group, if it doesn't exist already
     if ( !defined( $FAI::current_lvm_config{$vg} ) ) {
       # create all the devices
-      my @devices = keys %{ $FAI::configs{$config}{"devices"} };
+      my @devices = keys %{ $FAI::configs{$config}{devices} };
       &FAI::erase_lvm_signature(\@devices);
       push @FAI::commands, "pvcreate $_" foreach ( @devices );
       # create the volume group
       push @FAI::commands, "vgcreate $vg "
-        . join( " ", keys %{ $FAI::configs{$config}{"devices"} } );
+        . join( " ", keys %{ $FAI::configs{$config}{devices} } );
     }
 
     # otherwise add or remove the devices for the volume group, run pvcreate
@@ -245,7 +245,7 @@
       my %new_devs = ();
 
       # create an undefined entry for each new device
-      @new_devs{ keys %{ $FAI::configs{$config}{"devices"} } } = ();
+      @new_devs{ keys %{ $FAI::configs{$config}{devices} } } = ();
       
       my @new_devices = keys %new_devs;
       
@@ -274,45 +274,45 @@
 
     # remove, resize, create the logical volumes
     # remove all volumes that do not exist anymore or need not be preserved
-    foreach my $lv ( keys %{ $FAI::current_lvm_config{$vg}{"volumes"} } ) {
+    foreach my $lv ( keys %{ $FAI::current_lvm_config{$vg}{volumes} } ) {
       # skip preserved/resized volumes
-      next if ( defined( $FAI::configs{$config}{"volumes"}{$lv} )
-        && ( $FAI::configs{$config}{"volumes"}{$lv}{"size"}{"preserve"} == 1
-          || $FAI::configs{$config}{"volumes"}{$lv}{"size"}{"resize"} ));
+      next if ( defined( $FAI::configs{$config}{volumes}{$lv} )
+        && ( $FAI::configs{$config}{volumes}{$lv}{size}{preserve} == 1
+          || $FAI::configs{$config}{volumes}{$lv}{size}{resize} ));
 
       # remove $lv
       push @FAI::commands, "lvremove -f $vg/$lv";
     }
 
     # now create or resize the configured logical volumes
-    foreach my $lv ( keys %{ $FAI::configs{$config}{"volumes"} } ) {
+    foreach my $lv ( keys %{ $FAI::configs{$config}{volumes} } ) {
       # reference to the size of the current logical volume
-      my $lv_ref_size = $FAI::configs->{$config}->{"volumes"}->{$lv}->{"size"};
+      my $lv_ref_size = ( \%FAI::configs )->{$config}->{volumes}->{$lv}->{size};
       # skip preserved partitions, but ensure that they exist
-      if ( $lv_ref_size->{"preserve"} == 1 ) {
-        defined( $FAI::current_lvm_config{$vg}{"volumes"}{$lv} )
+      if ( $lv_ref_size->{preserve} == 1 ) {
+        defined( $FAI::current_lvm_config{$vg}{volumes}{$lv} )
           or die "Preserved volume $vg/$lv does not exist\n";
         next;
       }
 
       # resize the volume
-      if ( $lv_ref_size->{"resize"} == 1 ) {
-        defined( $FAI::current_lvm_config{$vg}{"volumes"}{$lv} )
+      if ( $lv_ref_size->{resize} == 1 ) {
+        defined( $FAI::current_lvm_config{$vg}{volumes}{$lv} )
           or die "Resized volume $vg/$lv does not exist\n";
 
         # note that resizing a volume destroys the data on it
         push @FAI::commands,
-          "lvresize -L " . $lv_ref_size->{"eff_size"} . " $vg/$lv";
+          "lvresize -L " . $lv_ref_size->{eff_size} . " $vg/$lv";
       }
 
       # create a new volume
       else {
         push @FAI::commands,
-          "lvcreate -n $lv -L " . $lv_ref_size->{"eff_size"} . " $vg";
+          "lvcreate -n $lv -L " . $lv_ref_size->{eff_size} . " $vg";
 
         # create the filesystem on the volume
         &FAI::build_mkfs_commands( "/dev/$vg/$lv",
-          \%{ $FAI::configs{$config}{"volumes"}{$lv} } );
+          \%{ $FAI::configs{$config}{volumes}{$lv} } );
       }
     }
 
@@ -343,24 +343,24 @@
     my $disk = $1;
 
     # create partitions on non-virtual configs
-    if ( $FAI::configs{$config}{"virtual"} == 0 ) {
+    if ( $FAI::configs{$config}{virtual} == 0 ) {
       # the list of partitions that must be preserved
       my @to_preserve = ();
 
       # find partitions that should be preserved or resized
-      foreach my $part_id ( sort keys %{ $FAI::configs{$config}{"partitions"} } ) {
+      foreach my $part_id ( sort keys %{ $FAI::configs{$config}{partitions} } ) {
         # reference to the current partition
-        my $part_ref = $FAI::configs->{$config}->{"partitions"}->{$part_id};
+        my $part_ref = ( \%FAI::configs )->{$config}->{partitions}->{$part_id};
         next unless (
-          $part_ref->{"size"}->{"preserve"} == 1 || $part_ref->{"size"}->{"resize"} == 1 );
+          $part_ref->{size}->{preserve} == 1 || $part_ref->{size}->{resize} == 1 );
 
         # preserved or resized partitions must exist already
-        defined( $FAI::current_config{$disk}{"partitions"}{$part_id} )
+        defined( $FAI::current_config{$disk}{partitions}{$part_id} )
           or die "$part_id can't be preserved, it does not exist.\n";
 
         # add a mapping from the configured partition to the existing one
         # (identical here, may change for extended partitions below)
-        $part_ref->{"maps_to_existing"} = $part_id;
+        $part_ref->{maps_to_existing} = $part_id;
 
         # add $part_id to the list of preserved partitions
         push @to_preserve, $part_id;
@@ -372,7 +372,7 @@
 
       # add the extended partition as well, if logical partitions must be
       # preserved; and mark it as resize
-      if ( $FAI::configs{$config}{"disklabel"} eq "msdos" ) {
+      if ( $FAI::configs{$config}{disklabel} eq "msdos" ) {
         # we assume there are no logical partitions
         my $has_logical = 0;
         my $extended    = -1;
@@ -381,15 +381,15 @@
         foreach my $part_id (@to_preserve) {
           # the extended partition may already be listed; then, the id of the
           # extended partition must not change
-          if ( $FAI::current_config{$disk}{"partitions"}{$part_id}{"is_extended"} == 1 ) {
-            ( defined( $FAI::configs{$config}{"partitions"}{$extended}{"size"}{"extended"})
-                && defined( $FAI::current_config{$disk}{"partitions"}{$extended}{"is_extended"})
-                && $FAI::configs{$config}{"partitions"}{$extended}{"size"}{"extended"} == 1
-                && $FAI::current_config{$disk}{"partitions"}{$extended}{"is_extended"} == 1 ) 
+          if ( $FAI::current_config{$disk}{partitions}{$part_id}{is_extended} == 1 ) {
+            ( defined( $FAI::configs{$config}{partitions}{$extended}{size}{extended})
+                && defined( $FAI::current_config{$disk}{partitions}{$extended}{is_extended})
+                && $FAI::configs{$config}{partitions}{$extended}{size}{extended} == 1
+                && $FAI::current_config{$disk}{partitions}{$extended}{is_extended} == 1 ) 
                 or die "ID of extended partition changes\n";
 
             # make sure resize is set
-            $FAI::configs{$config}{"partitions"}{$part_id}{"size"}{"resize"} = 1;
+            $FAI::configs{$config}{partitions}{$part_id}{size}{resize} = 1;
             $extended = $part_id;
             last;
           }
@@ -404,25 +404,25 @@
         # if the extended partition is not listed yet, find and add it now; note
         # that we need to add the existing one
         if ( 1 == $has_logical && -1 == $extended ) {
-          foreach my $part_id ( sort keys %{ $FAI::current_config{$disk}{"partitions"} } ) {
+          foreach my $part_id ( sort keys %{ $FAI::current_config{$disk}{partitions} } ) {
 
             # no extended partition
-            next unless ( $FAI::current_config{$disk}{"partitions"}{$part_id}{"is_extended"} == 1 );
+            next unless ( $FAI::current_config{$disk}{partitions}{$part_id}{is_extended} == 1 );
 
             # find the configured extended partition to set the mapping
-            foreach my $p ( sort keys %{ $FAI::configs{$config}{"partitions"} } ) {
+            foreach my $p ( sort keys %{ $FAI::configs{$config}{partitions} } ) {
               # reference to the current partition
-              my $part_ref = $FAI::configs->{$config}->{"partitions"}->{$p};
-              next unless ( $part_ref->{"size"}->{"extended"} == 1 );
+              my $part_ref = ( \%FAI::configs )->{$config}->{partitions}->{$p};
+              next unless ( $part_ref->{size}->{extended} == 1 );
 
               # make sure resize is set
-              $part_ref->{"size"}->{"resize"} = 1;
+              $part_ref->{size}->{resize} = 1;
 
               # store the id for further checks
               $extended = $p;
 
               # add a mapping entry to the existing extended partition
-              $part_ref->{"maps_to_existing"} = $part_id;
+              $part_ref->{maps_to_existing} = $part_id;
 
               # add it to the preserved partitions
               push @to_preserve, $p;
@@ -445,14 +445,14 @@
 
       # A new disk label may only be written if no partitions need to be
       # preserved
-      ( ( $FAI::configs{$config}{'disklabel'} eq
-            $FAI::current_config{$disk}{'disklabel'})
+      ( ( $FAI::configs{$config}{disklabel} eq
+            $FAI::current_config{$disk}{disklabel})
           || ( scalar(@to_preserve) == 0 ) ) 
           or die "Can't change disklabel, partitions are to be preserved\n";
 
       # write the disklabel to drop the previous partition table
       push @FAI::commands, "parted -s $disk mklabel "
-        . $FAI::configs{$config}{'disklabel'};
+        . $FAI::configs{$config}{disklabel};
 
       # once we rebuild partitions, their ids are likely to change; this counter
       # helps keeping track of this
@@ -462,20 +462,20 @@
       foreach my $part_id (@to_preserve) {
         # get the existing id
         my $mapped_id =
-          $FAI::configs{$config}{"partitions"}{$part_id}{"maps_to_existing"};
+          $FAI::configs{$config}{partitions}{$part_id}{maps_to_existing};
 
         # get the original starts and ends
         my $start =
-          $FAI::current_config{$disk}{"partitions"}{$mapped_id}{"begin_byte"};
+          $FAI::current_config{$disk}{partitions}{$mapped_id}{begin_byte};
         my $end =
-          $FAI::current_config{$disk}{"partitions"}{$mapped_id}{"end_byte"};
+          $FAI::current_config{$disk}{partitions}{$mapped_id}{end_byte};
 
         # the type of the partition defaults to primary
         my $part_type = "primary";
-        if ( $FAI::configs{$config}{"disklabel"} eq "msdos" ) {
+        if ( $FAI::configs{$config}{disklabel} eq "msdos" ) {
 
           # change the partition type to extended or logical as appropriate
-          if ( $FAI::configs{$config}{"partitions"}{$part_id}{"size"}{"extended"} == 1 ) {
+          if ( $FAI::configs{$config}{partitions}{$part_id}{size}{extended} == 1 ) {
             $part_type = "extended";
           } elsif ( $part_id > 4 ) {
             $part_type = "logical";
@@ -486,8 +486,7 @@
         # increase the partition counter for the partition created next and
         # write it to the configuration
         $part_nr++;
-        $FAI::current_config{$disk}{"partitions"}{$mapped_id}{"new_id"} =
-          $part_nr;
+        $FAI::current_config{$disk}{partitions}{$mapped_id}{new_id} = $part_nr;
 
         # build a parted command to create the partition
         push @FAI::commands,
@@ -503,26 +502,26 @@
       # iterate over the worklists
       foreach my $part_id (@shrink_list) {
         # reference to the current partition
-        my $part_ref = $FAI::configs->{$config}->{"partitions"}->{$part_id};
+        my $part_ref = ( \%FAI::configs )->{$config}->{partitions}->{$part_id};
         # anything to be done?
-        next unless ( $part_ref->{"size"}->{"resize"} == 1 );
+        next unless ( $part_ref->{size}->{resize} == 1 );
 
         # get the existing id
-        my $mapped_id = $part_ref->{"maps_to_existing"};
+        my $mapped_id = $part_ref->{maps_to_existing};
 
         # if partition is to be grown, move it to then grow_list
-        if ( $part_ref->{"size"}->{"eff_size"} >
-          $FAI::current_config{$disk}{"partitions"}{$mapped_id}{"count_byte"} ) {
+        if ( $part_ref->{size}->{eff_size} >
+          $FAI::current_config{$disk}{partitions}{$mapped_id}{count_byte} ) {
           unshift @grow_list, $part_id;
           next;
         }
 
         # get the new partition id
-        my $p = $FAI::current_config{$disk}{"partitions"}{$mapped_id}{"new_id"};
+        my $p = $FAI::current_config{$disk}{partitions}{$mapped_id}{new_id};
 
         # get the new starts and ends
-        my $start = $part_ref->{"start_byte"};
-        my $end = $part_ref->{"end_byte"};
+        my $start = $part_ref->{start_byte};
+        my $end = $part_ref->{end_byte};
 
         # build an appropriate command
         push @FAI::commands, "parted -s $disk resize $p ${start}B ${end}B";
@@ -531,40 +530,40 @@
       # grow the remaining partitions
       foreach my $part_id (@grow_list) {
         # reference to the current partition
-        my $part_ref = $FAI::configs->{$config}->{"partitions"}->{$part_id};
+        my $part_ref = ( \%FAI::configs )->{$config}->{partitions}->{$part_id};
 
         # get the existing id
-        my $mapped_id = $part_ref->{"maps_to_existing"};
+        my $mapped_id = $part_ref->{maps_to_existing};
 
         # get the new partition id
-        my $p = $FAI::current_config{$disk}{"partitions"}{$mapped_id}{"new_id"};
+        my $p = $FAI::current_config{$disk}{partitions}{$mapped_id}{new_id};
 
         # get the new starts and ends
-        my $start = $part_ref->{"start_byte"};
-        my $end = $part_ref->{"end_byte"};
+        my $start = $part_ref->{start_byte};
+        my $end = $part_ref->{end_byte};
 
         # build an appropriate command
         push @FAI::commands, "parted -s $disk resize $p ${start}B ${end}B";
       }
 
       # write the disklabel again to drop the partition table
-      push @FAI::commands, "parted -s $disk mklabel " . $FAI::configs{$config}{'disklabel'};
+      push @FAI::commands, "parted -s $disk mklabel " . $FAI::configs{$config}{disklabel};
 
       # generate the commands for creating all partitions
-      foreach my $part_id ( sort keys %{ $FAI::configs{$config}{"partitions"} } ) {
+      foreach my $part_id ( sort keys %{ $FAI::configs{$config}{partitions} } ) {
         # reference to the current partition
-        my $part_ref = $FAI::configs->{$config}->{"partitions"}->{$part_id};
+        my $part_ref = ( \%FAI::configs )->{$config}->{partitions}->{$part_id};
 
         # get the new starts and ends
-        my $start = $part_ref->{"start_byte"};
-        my $end = $part_ref->{"end_byte"};
+        my $start = $part_ref->{start_byte};
+        my $end = $part_ref->{end_byte};
 
         # the type of the partition defaults to primary
         my $part_type = "primary";
-        if ( $FAI::configs{$config}{"disklabel"} eq "msdos" ) {
+        if ( $FAI::configs{$config}{disklabel} eq "msdos" ) {
 
           # change the partition type to extended or logical as appropriate
-          if ( $part_ref->{"size"}->{"extended"} == 1 ) {
+          if ( $part_ref->{size}->{extended} == 1 ) {
             $part_type = "extended";
           } elsif ( $part_id > 4 ) {
             $part_type = "logical";
@@ -578,25 +577,25 @@
       # set the bootable flag, if requested at all
       push @FAI::commands,
         "parted -s $disk set "
-        . $FAI::configs{$config}{"bootable"}
+        . $FAI::configs{$config}{bootable}
         . " boot on"
-        if ( $FAI::configs{$config}{"bootable"} > -1 );
+        if ( $FAI::configs{$config}{bootable} > -1 );
 
       # wait for udev to set up all devices
       push @FAI::commands, "udevsettle --timeout=10";
     }
 
     # generate the commands for creating all filesystems
-    foreach my $part_id ( sort keys %{ $FAI::configs{$config}{"partitions"} } ) {
+    foreach my $part_id ( sort keys %{ $FAI::configs{$config}{partitions} } ) {
       # reference to the current partition
-      my $part_ref = $FAI::configs->{$config}->{"partitions"}->{$part_id};
+      my $part_ref = ( \%FAI::configs )->{$config}->{partitions}->{$part_id};
 
       # skip preserved/resized/extended partitions
-      next if ( $part_ref->{"size"}->{"preserve"} == 1
-        || $part_ref->{"size"}->{"resize"} == 1 || $part_ref->{"size"}->{"extended"} == 1 );
+      next if ( $part_ref->{size}->{preserve} == 1
+        || $part_ref->{size}->{resize} == 1 || $part_ref->{size}->{extended} == 1 );
 
       # create the filesystem on $disk$part_id
-      &FAI::build_mkfs_commands( $disk . $part_id, \%{ $part_ref } );
+      &FAI::build_mkfs_commands( $disk . $part_id, $part_ref );
     }
   }
 }
@@ -613,23 +612,23 @@
 
     # write the disklabel again to drop the partition table
     &FAI::execute_command( "parted -s $disk mklabel "
-        . $FAI::current_config{$disk}{'disklabel'} );
+        . $FAI::current_config{$disk}{disklabel} );
 
     # generate the commands for creating all partitions
-    foreach my $part_id ( sort keys %{ $FAI::current_config{$disk}{"partitions"} } ) {
+    foreach my $part_id ( sort keys %{ $FAI::current_config{$disk}{partitions} } ) {
       # reference to the current partition
-      my $curr_part_ref = $FAI::current_config->{$disk}->{"partitions"}->{$part_id};
+      my $curr_part_ref = ( \%FAI::current_config )->{$disk}->{partitions}->{$part_id};
 
       # get the starts and ends
-      my $start = $curr_part_ref->{"begin_byte"};
-      my $end = $curr_part_ref->{"end_byte"};
+      my $start = $curr_part_ref->{begin_byte};
+      my $end = $curr_part_ref->{end_byte};
 
       # the type of the partition defaults to primary
       my $part_type = "primary";
-      if ( $FAI::current_config{$disk}{"disklabel"} eq "msdos" ) {
+      if ( $FAI::current_config{$disk}{disklabel} eq "msdos" ) {
 
         # change the partition type to extended or logical as appropriate
-        if ( $curr_part_ref->{"is_extended"} == 1 ) {
+        if ( $curr_part_ref->{is_extended} == 1 ) {
           $part_type = "extended";
         } elsif ( $part_id > 4 ) {
           $part_type = "logical";
@@ -642,7 +641,7 @@
     warn "Partition table of disk $disk has been restored\n";
   }
 
-  die "StorageMagic failed, but the partition tables have been restored\n";
+  die "Storage Magic failed, but the partition tables have been restored\n";
 }
 
 1;

Modified: people/michael/features/setup_harddisks_2/implementation/lib/exec.pm
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/lib/exec.pm	2007-11-11 13:34:07 UTC (rev 4721)
+++ people/michael/features/setup_harddisks_2/implementation/lib/exec.pm	2007-11-11 21:51:39 UTC (rev 4722)
@@ -52,7 +52,7 @@
 $FAI::error_codes = [
   {
     error   => "parted_1",
-    message => "Parted produced error. Couldn't remove partition\n",
+    message => "Parted failed to remove the partition\n",
     stderr_regex =>
       ".*Error: Could not stat device rm - No such file or directory.*",
     stdout_regex => "",
@@ -61,7 +61,7 @@
   },
   {
     error        => "parted_2",
-    message      => "Parted produced error. Could not read disk label.\n",
+    message      => "Parted could not read a disk label\n",
     stderr_regex => ".*Error: Unable to open .* - unrecognised disk label.*",
     stdout_regex => "",
     program      => "parted",
@@ -69,7 +69,7 @@
   },
   {
     error   => "parted_3",
-    message => "Parted produced error. Could not open disk\n",
+    message => "Parted failed to open the device\n",
     stderr_regex =>
       ".*Error: Could not stat device .* - No such file or directory.*",
     stdout_regex => "",
@@ -240,12 +240,12 @@
   #get the error, if there was any
   foreach my $err (@$FAI::error_codes) {
     if ( (
-        $err->{'stdout_regex'} eq "" || $stdout_line =~ /$err->{'stdout_regex'}/
-      ) && ( $err->{'stderr_regex'} eq ""
-        || $stderr_line =~ /$err->{'stderr_regex'}/ )
-      && ( $err->{'program'} eq "" || $command =~ /.*$err->{'program'}.*/ )
+        $err->{stdout_regex} eq "" || $stdout_line =~ /$err->{stdout_regex}/
+      ) && ( $err->{stderr_regex} eq ""
+        || $stderr_line =~ /$err->{stderr_regex}/ )
+      && ( $err->{program} eq "" || $command =~ /.*$err->{program}.*/ )
       ) {
-      return $err->{'error'};
+      return $err->{error};
     }
   }
 

Modified: people/michael/features/setup_harddisks_2/implementation/lib/fstab.pm
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/lib/fstab.pm	2007-11-11 13:34:07 UTC (rev 4721)
+++ people/michael/features/setup_harddisks_2/implementation/lib/fstab.pm	2007-11-11 21:51:39 UTC (rev 4722)
@@ -63,20 +63,20 @@
       my $device = $1;
 
       # make sure the desired fstabkey is defined at all
-      defined( $config->{$c}->{"fstabkey"} )
+      defined( $config->{$c}->{fstabkey} )
         or die "INTERNAL ERROR: fstabkey undefined\n";
 
       # create a line in the output file for each partition
-      foreach my $p ( sort keys %{ $config->{$c}->{"partitions"} } ) {
+      foreach my $p ( sort keys %{ $config->{$c}->{partitions} } ) {
 
         # keep a reference to save some typing
-        my $p_ref = $config->{$c}->{"partitions"}->{$p};
+        my $p_ref = $config->{$c}->{partitions}->{$p};
 
         # skip extended partitions
-        next if ( $p_ref->{"size"}->{"extended"} );
+        next if ( $p_ref->{size}->{extended} );
 
         # skip entries without a mountpoint
-        next if ( $p_ref->{"mountpoint"} eq "-" );
+        next if ( $p_ref->{mountpoint} eq "-" );
 
         # each line is a list of values
         my @fstab_line = ();
@@ -85,71 +85,71 @@
         # or labels, use these if available
         my @uuid = ();
         &execute_command_std(
-          "/lib/udev/vol_id -u $device" . $p_ref->{"number"},
+          "/lib/udev/vol_id -u $device" . $p_ref->{number},
           \@uuid, 0 );
 
         # every device must have a uuid, otherwise this is an error (unless we
         # are testing only)
         ( $FAI::no_dry_run == 0 || scalar(@uuid) == 1 )
           or die "Failed to obtain UUID for $device"
-          . $p_ref->{"number"} . "\n";
+          . $p_ref->{number} . "\n";
 
         # get the label -- this is likely empty
         my @label = ();
         &execute_command_std(
-          "/lib/udev/vol_id -l $device" . $p_ref->{"number"},
+          "/lib/udev/vol_id -l $device" . $p_ref->{number},
           \@label, 0 );
 
         # using the fstabkey value the desired device entry is defined
-        if ( $config->{$c}->{"fstabkey"} eq "uuid" ) {
+        if ( $config->{$c}->{fstabkey} eq "uuid" ) {
           chomp( $uuid[0] );
           push @fstab_line, "UUID=" . $uuid[0];
-        } elsif ( $config->{$c}->{"fstabkey"} eq "label" && scalar(@label) == 1 ) {
+        } elsif ( $config->{$c}->{fstabkey} eq "label" && scalar(@label) == 1 ) {
           chomp( $label[0] );
           push @fstab_line, "LABEL=" . $label[0];
         } else {
           # otherwise, use the usual device path
-          push @fstab_line, $device . $p_ref->{"number"};
+          push @fstab_line, $device . $p_ref->{number};
         }
 
         # next is the mountpoint
-        push @fstab_line, $p_ref->{"mountpoint"};
+        push @fstab_line, $p_ref->{mountpoint};
 
         # the filesystem to be used
-        push @fstab_line, $p_ref->{"filesystem"};
+        push @fstab_line, $p_ref->{filesystem};
 
         # add the mount options
-        push @fstab_line, $p_ref->{"mount_options"};
+        push @fstab_line, $p_ref->{mount_options};
 
         # never dump
         push @fstab_line, 0;
 
         # order of filesystem checks; the root filesystem gets a 1, the others 2
         push @fstab_line, 2;
-        $fstab_line[-1] = 1 if ( $p_ref->{"mountpoint"} eq "/" );
+        $fstab_line[-1] = 1 if ( $p_ref->{mountpoint} eq "/" );
 
         # join the columns of one line with tabs, and push it to our fstab line array
         push @fstab, join( "\t", @fstab_line );
 
         # set the ROOT_PARTITION variable, if this is the mountpoint for /
-        $FAI::disk_var{"ROOT_PARTITION"} = $fstab_line[0]
-          if ( $p_ref->{"mountpoint"} eq "/" );
+        $FAI::disk_var{ROOT_PARTITION} = $fstab_line[0]
+          if ( $p_ref->{mountpoint} eq "/" );
 
         # add to the swaplist, if the filesystem is swap
-        $FAI::disk_var{"SWAPLIST"} .= " " . $device . $p_ref->{"number"}
-          if ( $p_ref->{"filesystem"} eq "swap" );
+        $FAI::disk_var{SWAPLIST} .= " " . $device . $p_ref->{number}
+          if ( $p_ref->{filesystem} eq "swap" );
       }
     } elsif ( $c =~ /^VG_(.+)$/ ) {
       my $device = $1;
 
       # create a line in the output file for each logical volume
-      foreach my $l ( sort keys %{ $config->{$c}->{"volumes"} } ) {
+      foreach my $l ( sort keys %{ $config->{$c}->{volumes} } ) {
 
         # keep a reference to save some typing
-        my $l_ref = $config->{$c}->{"volumes"}->{$l};
+        my $l_ref = $config->{$c}->{volumes}->{$l};
 
         # skip entries without a mountpoint
-        next if ( $l_ref->{"mountpoint"} eq "-" );
+        next if ( $l_ref->{mountpoint} eq "-" );
 
         # each line is a list of values
         my @fstab_line = ();
@@ -167,42 +167,42 @@
           or die "Failed to resolve /dev/$device/$l\n";
 
         # next is the mountpoint
-        push @fstab_line, $l_ref->{"mountpoint"};
+        push @fstab_line, $l_ref->{mountpoint};
 
         # the filesystem to be used
-        push @fstab_line, $l_ref->{"filesystem"};
+        push @fstab_line, $l_ref->{filesystem};
 
         # add the mount options
-        push @fstab_line, $l_ref->{"mount_options"};
+        push @fstab_line, $l_ref->{mount_options};
 
         # never dump
         push @fstab_line, 0;
 
         # order of filesystem checks; the root filesystem gets a 1, the others 2
         push @fstab_line, 2;
-        $fstab_line[-1] = 1 if ( $l_ref->{"mountpoint"} eq "/" );
+        $fstab_line[-1] = 1 if ( $l_ref->{mountpoint} eq "/" );
 
         # join the columns of one line with tabs, and push it to our fstab line array
         push @fstab, join( "\t", @fstab_line );
 
         # set the ROOT_PARTITION variable, if this is the mountpoint for /
-        $FAI::disk_var{"ROOT_PARTITION"} = $fstab_line[0]
-          if ( $l_ref->{"mountpoint"} eq "/" );
+        $FAI::disk_var{ROOT_PARTITION} = $fstab_line[0]
+          if ( $l_ref->{mountpoint} eq "/" );
 
         # add to the swaplist, if the filesystem is swap
-        $FAI::disk_var{"SWAPLIST"} .= " " . $fstab_line[0]
-          if ( $l_ref->{"filesystem"} eq "swap" );
+        $FAI::disk_var{SWAPLIST} .= " " . $fstab_line[0]
+          if ( $l_ref->{filesystem} eq "swap" );
       }
     } elsif ( $c eq "RAID" ) {
 
       # create a line in the output file for each device
-      foreach my $r ( sort keys %{ $config->{$c}->{"volumes"} } ) {
+      foreach my $r ( sort keys %{ $config->{$c}->{volumes} } ) {
 
         # keep a reference to save some typing
-        my $r_ref = $config->{$c}->{"volumes"}->{$r};
+        my $r_ref = $config->{$c}->{volumes}->{$r};
 
         # skip entries without a mountpoint
-        next if ( $r_ref->{"mountpoint"} eq "-" );
+        next if ( $r_ref->{mountpoint} eq "-" );
 
         # each line is a list of values
         my @fstab_line = ();
@@ -211,70 +211,44 @@
         push @fstab_line, "/dev/md" . $r;
 
         # next is the mountpoint
-        push @fstab_line, $r_ref->{"mountpoint"};
+        push @fstab_line, $r_ref->{mountpoint};
 
         # the filesystem to be used
-        push @fstab_line, $r_ref->{"filesystem"};
+        push @fstab_line, $r_ref->{filesystem};
 
         # add the mount options
-        push @fstab_line, $r_ref->{"mount_options"};
+        push @fstab_line, $r_ref->{mount_options};
 
         # never dump
         push @fstab_line, 0;
 
         # order of filesystem checks; the root filesystem gets a 1, the others 2
         push @fstab_line, 2;
-        $fstab_line[-1] = 1 if ( $r_ref->{"mountpoint"} eq "/" );
+        $fstab_line[-1] = 1 if ( $r_ref->{mountpoint} eq "/" );
 
         # join the columns of one line with tabs, and push it to our fstab line array
         push @fstab, join( "\t", @fstab_line );
 
         # set the ROOT_PARTITION variable, if this is the mountpoint for /
-        $FAI::disk_var{"ROOT_PARTITION"} = "/dev/md" . $r
-          if ( $r_ref->{"mountpoint"} eq "/" );
+        $FAI::disk_var{ROOT_PARTITION} = "/dev/md" . $r
+          if ( $r_ref->{mountpoint} eq "/" );
 
         # add to the swaplist, if the filesystem is swap
-        $FAI::disk_var{"SWAPLIST"} .= " /dev/md$r"
-          if ( $r_ref->{"filesystem"} eq "swap" );
+        $FAI::disk_var{SWAPLIST} .= " /dev/md$r"
+          if ( $r_ref->{filesystem} eq "swap" );
       }
     } else {
       die "INTERNAL ERROR: Unexpected key $c\n";
     }
   }
 
-  # cleanup the swaplist (remove leading space)
-  $FAI::disk_var{"SWAPLIST"} =~ s/^\s+//;
+  # cleanup the swaplist (remove leading space and add quotes)
+  $FAI::disk_var{SWAPLIST} =~ s/^\s*/"/;
+  $FAI::disk_var{SWAPLIST} =~ s/\s*$/"/;
 
-  # quote the entries of SWAPLIST
-  $FAI::disk_var{"SWAPLIST"} = '"' . $FAI::disk_var{"SWAPLIST"} . '"';
-
   # sort the lines in @fstab to enable all sub mounts
-  for ( my $i = 0 ; $i < scalar(@fstab) ; $i++ ) {
+  @fstab = sort { [split("\t",$a)]->[1] cmp [split("\t",$b)]->[1] } @fstab;
 
-    # take out the mountpoint
-    ( $_, my $mp_1 ) = split( "\t", $fstab[$i] );
-
-    # partitions without a mountpoint are fine
-    next if ( $mp_1 eq "none" );
-
-    for ( my $j = $i + 1 ; $j < scalar(@fstab) ; $j++ ) {
-
-      # take out the other mountpoint
-      ( $_, my $mp_2 ) = split( "\t", $fstab[$j] );
-
-      # remove the trailing / (even though this might make it the empty string
-      $mp_2 =~ s/\/$//;
-
-      # $mp_1 depends on $mp_2 being mounted, swap them
-      if ( $mp_1 =~ /^\Q$mp_2\E\// ) {
-        my $line_i = $fstab[$i];
-        $fstab[$i] = $fstab[$j];
-        $fstab[$j] = $line_i;
-        $mp_1      = $mp_2;
-      }
-    }
-  }
-
   # add a nice header to fstab
   unshift @fstab,
     "# <file sys>\t<mount point>\t<type>\t<options>\t<dump>\t<pass>";

Modified: people/michael/features/setup_harddisks_2/implementation/lib/init.pm
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/lib/init.pm	2007-11-11 13:34:07 UTC (rev 4721)
+++ people/michael/features/setup_harddisks_2/implementation/lib/init.pm	2007-11-11 21:51:39 UTC (rev 4722)
@@ -60,7 +60,7 @@
 #
 ################################################################################
 %FAI::disk_var = ();
-$FAI::disk_var{"SWAPLIST"} = "";
+$FAI::disk_var{SWAPLIST} = "";
 
 ################################################################################
 #

Modified: people/michael/features/setup_harddisks_2/implementation/lib/parser.pm
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/lib/parser.pm	2007-11-11 13:34:07 UTC (rev 4721)
+++ people/michael/features/setup_harddisks_2/implementation/lib/parser.pm	2007-11-11 21:51:39 UTC (rev 4722)
@@ -62,7 +62,7 @@
 
   # split $PATH into its components, search all of its components
   # and test for $cmd being executable
-  ( -x "$_/$cmd" ) and return 1 foreach ( split( ":", $ENV{"PATH"} ) );
+  ( -x "$_/$cmd" ) and return 1 foreach ( split( ":", $ENV{PATH} ) );
   # return 0 otherwise
   return 0;
 }
@@ -112,11 +112,11 @@
 
   # Initialise the entry in $FAI::configs
   $FAI::configs{$FAI::device} = {
-    "virtual"    => 0,
-    "disklabel"  => "msdos",
-    "bootable"   => -1,
-    "fstabkey"   => "device",
-    "partitions" => {}
+    virtual    => 0,
+    disklabel  => "msdos",
+    bootable   => -1,
+    fstabkey   => "device",
+    partitions => {}
   };
 }
 
@@ -140,7 +140,7 @@
   # only supported on msdos disk labels.
   (
     $FAI::device =~ /^PHY_/ && ( $type ne "logical"
-      || $FAI::configs{$FAI::device}{"disklabel"} eq "msdos" )
+      || $FAI::configs{$FAI::device}{disklabel} eq "msdos" )
   ) or die "Syntax error: invalid partition type";
 
   # the index of the new partition
@@ -150,15 +150,14 @@
   if ( $type eq "primary" ) {
 
     # find all previously defined primary partitions
-    foreach my $part_id ( sort keys %{ $FAI::configs{$FAI::device}{"partitions"} } ) {
+    foreach my $part_id ( sort keys %{ $FAI::configs{$FAI::device}{partitions} } ) {
 
       # break, if the partition has not been created by init_part_config
-      defined( $FAI::configs{$FAI::device}{"partitions"}{$part_id}{"size"}
-          {"extended"} ) or last;
+      defined( $FAI::configs{$FAI::device}{partitions}{$part_id}{size}{extended} ) or last;
 
       # on msdos disklabels we cannot have more than 4 primary partitions
       last if ( $part_id > 4
-        && $FAI::configs{$FAI::device}{"disklabel"} eq "msdos" );
+        && $FAI::configs{$FAI::device}{disklabel} eq "msdos" );
 
       # store the latest index found
       $part_number = $part_id;
@@ -168,7 +167,7 @@
     $part_number++;
 
     # msdos disk labels don't allow for more than 4 primary partitions
-    ( $part_number < 5 || $FAI::configs{$FAI::device}{"disklabel"} ne "msdos" )
+    ( $part_number < 5 || $FAI::configs{$FAI::device}{disklabel} ne "msdos" )
       or die "$part_number are too many primary partitions\n";
   } else {
 
@@ -176,14 +175,13 @@
     # this branch, it has been ensured above
 
     # find the index of the new partition, initialise it to the highest current index
-    foreach my $part_id ( sort keys %{ $FAI::configs{$FAI::device}{"partitions"} } ) {
+    foreach my $part_id ( sort keys %{ $FAI::configs{$FAI::device}{partitions} } ) {
 
       # skip primary partitions
       next if ( $part_id < 5 );
 
       # break, if the partition has not been created by init_part_config
-      defined( $FAI::configs{$FAI::device}{"partitions"}{$part_id}{"size"}
-          {"extended"} )
+      defined( $FAI::configs{$FAI::device}{partitions}{$part_id}{size}{extended} )
         or last;
 
       # store the latest index found
@@ -202,11 +200,10 @@
       my $extended = 0;
 
       # find all previously defined primary partitions
-      foreach my $part_id ( sort keys %{ $FAI::configs{$FAI::device}{"partitions"} } ) {
+      foreach my $part_id ( sort keys %{ $FAI::configs{$FAI::device}{partitions} } ) {
 
         # break, if the partition has not been created by init_part_config
-        defined( $FAI::configs{$FAI::device}{"partitions"}{$part_id}{"size"}
-            {"extended"} ) or last;
+        defined( $FAI::configs{$FAI::device}{partitions}{$part_id}{size}{extended} ) or last;
 
         # we cannot have more than 4 primary partitions
         last if ( $part_id > 4 );
@@ -223,46 +220,44 @@
         or die "Too many primary partitions while creating extended\n";
 
       # mark the entry as an extended partition
-      $FAI::configs{$FAI::device}{"partitions"}{$extended}{"size"}{"extended"} = 1;
+      $FAI::configs{$FAI::device}{partitions}{$extended}{size}{extended} = 1;
 
       # add the preserve = 0 flag, if it doesn't exist already
-      defined( $FAI::configs{$FAI::device}{"partitions"}{$extended}{"size"}{"preserve"} )
-        or $FAI::configs{$FAI::device}{"partitions"}{$extended}{"size"}{"preserve"} = 0;
+      defined( $FAI::configs{$FAI::device}{partitions}{$extended}{size}{preserve} )
+        or $FAI::configs{$FAI::device}{partitions}{$extended}{size}{preserve} = 0;
 
       # add the resize = 0 flag, if it doesn't exist already
       defined(
-        $FAI::configs{$FAI::device}{"partitions"}{$extended}{"size"}{"resize"} )
-        or
-        $FAI::configs{$FAI::device}{"partitions"}{$extended}{"size"}{"resize"} =
-        0;
+        $FAI::configs{$FAI::device}{partitions}{$extended}{size}{resize} ) or
+        $FAI::configs{$FAI::device}{partitions}{$extended}{size}{resize} = 0;
     }
   }
 
   # initialise the hash for the partitions, if it doesn't exist already
   # note that it might exists due to options, such as preserve:x,y
   # the initialisation is required for the reference defined next
-  defined( $FAI::configs{$FAI::device}{"partitions"}{$part_number} )
-    or $FAI::configs{$FAI::device}{"partitions"}{$part_number} = {};
+  defined( $FAI::configs{$FAI::device}{partitions}{$part_number} )
+    or $FAI::configs{$FAI::device}{partitions}{$part_number} = {};
 
   # set the reference to the current partition
   # the reference is used by all further processing of this config line
   $FAI::partition_pointer =
-    ( \%FAI::configs )->{$FAI::device}->{"partitions"}->{$part_number};
+    ( \%FAI::configs )->{$FAI::device}->{partitions}->{$part_number};
 
   # as we can't compute the index from the reference, we need to store the
   # $part_number explicitly
-  $FAI::partition_pointer->{"number"} = $part_number;
+  $FAI::partition_pointer->{number} = $part_number;
 
   # the partition is not an extended one
-  $FAI::partition_pointer->{"size"}->{"extended"} = 0;
+  $FAI::partition_pointer->{size}->{extended} = 0;
 
   # add the preserve = 0 flag, if it doesn't exist already
-  defined( $FAI::partition_pointer->{"size"}->{"preserve"} )
-    or $FAI::partition_pointer->{"size"}->{"preserve"} = 0;
+  defined( $FAI::partition_pointer->{size}->{preserve} )
+    or $FAI::partition_pointer->{size}->{preserve} = 0;
 
   # add the resize = 0 flag, if it doesn't exist already
-  defined( $FAI::partition_pointer->{"size"}->{"resize"} )
-    or $FAI::partition_pointer->{"size"}->{"resize"} = 0;
+  defined( $FAI::partition_pointer->{size}->{resize} )
+    or $FAI::partition_pointer->{size}->{resize} = 0;
 }
 
 ################################################################################
@@ -354,47 +349,47 @@
     option: /^preserve_always:(\d+(,\d+)*)/
         {
           # set the preserve flag for all ids in all cases
-          $FAI::configs{ $FAI::device }{ "partitions" }{ $_ }{ "size" }{ "preserve" } = 1 foreach ( split( ",", $1 ) );
+          $FAI::configs{$FAI::device}{partitions}{$_}{size}{preserve} = 1 foreach ( split( ",", $1 ) );
         }
         /^preserve_reinstall:(\d+(,\d+)*)/
         {
           # set the preserve flag for all ids if $FAI::reinstall is set
           if( $FAI::reinstall == 1 ) {
-            $FAI::configs{ $FAI::device }{ "partitions" }{ $_ }{ "size" }{ "preserve" } = 1 foreach ( split( ",", $1 ) );
+            $FAI::configs{$FAI::device}{partitions}{$_}{size}{preserve} = 1 foreach ( split( ",", $1 ) );
           }
         }
         | /^resize:(\d+(,\d+)*)/
         {
           # set the resize flag for all ids
-          $FAI::configs{ $FAI::device }{ "partitions" }{ $_ }{ "size" }{ "resize" } = 1 foreach ( split( ",", $1 ) );
+          $FAI::configs{$FAI::device}{partitions}{$_}{size}{resize} = 1 foreach ( split( ",", $1 ) );
         }
         | /^disklabel:(msdos|gpt)/
         {
           # set the disk label - actually not only the above, but all types 
           # supported by parted could be allowed, but others are not implemented
           # yet
-          $FAI::configs{ $FAI::device }{ "disklabel" } = $1;
+          $FAI::configs{$FAI::device}{disklabel} = $1;
         }
         | /^bootable:(\d+)/
         {
           # specify a partition that should get the bootable flag set
-          $FAI::configs{ $FAI::device }{ "bootable" } = $1;
+          $FAI::configs{$FAI::device}{bootable} = $1;
           ( $FAI::device =~ /^PHY_(.+)$/ ) or die 
             "INTERNAL ERROR: unexpected device name\n";
           # set the BOOT_DEVICE and BOOT_PARTITION variables
-          $FAI::disk_var{ "BOOT_DEVICE" } = $1; 
-          $FAI::disk_var{ "BOOT_PARTITION" } = $1 . 
-            $FAI::configs{ $FAI::device }{ "bootable" }; 
+          $FAI::disk_var{BOOT_DEVICE} = $1; 
+          $FAI::disk_var{BOOT_PARTITION} = $1 . 
+            $FAI::configs{$FAI::device}{bootable}; 
         }
         | 'virtual'
         {
           # this is a configuration for a virtual disk
-          $FAI::configs{ $FAI::device }{ "virtual" } = 1;
+          $FAI::configs{$FAI::device}{virtual} = 1;
         }
         | /^fstabkey:(device|label|uuid)/
         {
           # the information preferred for fstab device identifieres
-          $FAI::configs{ $FAI::device }{ "fstabkey" } = $1;
+          $FAI::configs{$FAI::device}{fstabkey} = $1;
         }
 
     volume: /^vg\s+/ name devices
@@ -403,16 +398,16 @@
           # make sure that this is a RAID configuration
           ( $FAI::device eq "RAID" ) or die "RAID entry invalid in this context\n";
           # initialise RAID entry, if it doesn't exist already
-          defined( $FAI::configs{"RAID"} ) or $FAI::configs{"RAID"}{"volumes"} = {};
+          defined( $FAI::configs{RAID} ) or $FAI::configs{RAID}{volumes} = {};
           # compute the next available index - the size of the entry
-          my $vol_id = scalar( keys %{ $FAI::configs{"RAID"}{"volumes"} } );
+          my $vol_id = scalar( keys %{ $FAI::configs{RAID}{volumes} } );
           # set the RAID type of this volume
-          $FAI::configs{"RAID"}{"volumes"}{$vol_id}{"mode"} = $1;
+          $FAI::configs{RAID}{volumes}{$vol_id}{mode} = $1;
           # initialise the hash of devices
-          $FAI::configs{"RAID"}{"volumes"}{$vol_id}{"devices"} = {};
+          $FAI::configs{RAID}{volumes}{$vol_id}{devices} = {};
           # set the reference to the current volume
           # the reference is used by all further processing of this config line
-          $FAI::partition_pointer = ( \%FAI::configs )->{"RAID"}->{"volumes"}->{$vol_id};
+          $FAI::partition_pointer = ( \%FAI::configs )->{RAID}->{volumes}->{$vol_id};
         }
         mountpoint devices filesystem mount_options fs_options
         | type mountpoint size filesystem mount_options fs_options
@@ -435,43 +430,43 @@
           defined( $FAI::configs{$FAI::device} ) or 
             die "Volume group $1 has not been declared yet.\n";
           # make sure, $2 has not been defined already
-          defined( $FAI::configs{$FAI::device}{"volumes"}{$2} ) and 
+          defined( $FAI::configs{$FAI::device}{volumes}{$2} ) and 
             die "Logical volume $2 has been defined already.\n";
           # initialise the new hash
-          $FAI::configs{$FAI::device}{"volumes"}{$2} = {};
+          $FAI::configs{$FAI::device}{volumes}{$2} = {};
           # initialise the preserve and resize flags
-          $FAI::configs{$FAI::device}{"volumes"}{$2}{"size"}{"preserve"} = 0;
-          $FAI::configs{$FAI::device}{"volumes"}{$2}{"size"}{"resize"} = 0;
+          $FAI::configs{$FAI::device}{volumes}{$2}{size}{preserve} = 0;
+          $FAI::configs{$FAI::device}{volumes}{$2}{size}{resize} = 0;
           # set the reference to the current volume
           # the reference is used by all further processing of this config line
-          $FAI::partition_pointer = ( \%FAI::configs )->{$FAI::device}->{"volumes"}->{$2};
+          $FAI::partition_pointer = ( \%FAI::configs )->{$FAI::device}->{volumes}->{$2};
         }
 
     mountpoint: '-'
         {
           # this partition should not be mounted
-          $FAI::partition_pointer->{ "mountpoint" } = "-";
+          $FAI::partition_pointer->{mountpoint} = "-";
         }
         | 'swap'
         {
           # this partition is swap space, not mounted
-          $FAI::partition_pointer->{ "mountpoint" } = "none";
+          $FAI::partition_pointer->{mountpoint} = "none";
         }
         | m{^/\S*}
         {
           # set the mount point
-          $FAI::partition_pointer->{ "mountpoint" } = $item[ 1 ];
+          $FAI::partition_pointer->{mountpoint} = $item[ 1 ];
           # if the mount point is / or /boot and we are currently doing a
           # physical device, the variables should be set, unless they are
           # already
-          if ( $FAI::configs{$FAI::device}{"bootable"} == -1 && 
+          if ( $FAI::configs{$FAI::device}{bootable} == -1 && 
             $FAI::device =~ /^PHY_(.+)$/ && 
             ( $item[ 1 ] eq "/boot" || ( $item[ 1 ] eq "/" && 
-              !defined( $FAI::disk_var{ "BOOT_DEVICE" } ) ) ) ) {
+              !defined( $FAI::disk_var{BOOT_DEVICE} ) ) ) ) {
               # set the BOOT_DEVICE and BOOT_PARTITION variables
-              $FAI::disk_var{ "BOOT_DEVICE" } = $1; 
-              $FAI::disk_var{ "BOOT_PARTITION" } = $1 . 
-                $FAI::partition_pointer->{"number"};
+              $FAI::disk_var{BOOT_DEVICE} = $1; 
+              $FAI::disk_var{BOOT_PARTITION} = $1 . 
+                $FAI::partition_pointer->{number};
           }
         }
 
@@ -486,9 +481,9 @@
           ( $FAI::device =~ /^VG_/ ) or
             die "vg is invalid in a non LVM-context.\n";
           # initialise the new hash
-          $FAI::configs{$FAI::device}{"volumes"} = {};
+          $FAI::configs{$FAI::device}{volumes} = {};
           # initialise the list of physical devices
-          $FAI::configs{$FAI::device}{"devices"} = ();
+          $FAI::configs{$FAI::device}{devices} = ();
           # the rule must not return undef
           1;
         }
@@ -515,9 +510,9 @@
           $max   = &FAI::convert_unit($max);
           $range = "$min-$max";
           # enter the range into the hash
-          $FAI::partition_pointer->{ "size" }->{ "range" } = $range;
+          $FAI::partition_pointer->{size}->{range} = $range;
           # set the resize flag, if required
-          defined( $4 ) and $FAI::partition_pointer->{ "size" }->{ "resize" } = 1;
+          defined( $4 ) and $FAI::partition_pointer->{size}->{resize} = 1;
         }
         | /^(-\d+[kMGTP%]?)(:resize)?\s+/
         {
@@ -529,9 +524,9 @@
           $max   = &FAI::convert_unit($max);
           $range = "$min-$max";
           # enter the range into the hash
-          $FAI::partition_pointer->{ "size" }->{ "range" } = $range;
+          $FAI::partition_pointer->{size}->{range} = $range;
           # set the resize flag, if required
-          defined( $2 ) and $FAI::partition_pointer->{ "size" }->{ "resize" } = 1;
+          defined( $2 ) and $FAI::partition_pointer->{size}->{resize} = 1;
         }
         | <error: invalid partition size near "$text">
 
@@ -568,10 +563,10 @@
                 ( $2 =~ /missing/ ) and $missing = 1;
               }
               # each device may only appear once
-              defined( $FAI::partition_pointer->{"devices"}->{$dev} ) and 
+              defined( $FAI::partition_pointer->{devices}->{$dev} ) and 
                 die "$dev is already part of the RAID volume\n";
               # set the options
-              $FAI::partition_pointer->{"devices"}->{$dev}->{"options"} = {
+              $FAI::partition_pointer->{devices}->{$dev}->{options} = {
                 "spare" => $spare,
                 "missing" => $missing
               };
@@ -579,7 +574,7 @@
             else
             {
               # create an empty hash for each device
-              $FAI::configs{$FAI::device}{"devices"}{$dev} = {};
+              $FAI::configs{$FAI::device}{devices}{$dev} = {};
             }
           }
           1;
@@ -588,27 +583,27 @@
 
     mount_options: /\S+/
         {
-          $FAI::partition_pointer->{ "mount_options" } = $item[ 1 ];
+          $FAI::partition_pointer->{mount_options} = $item[ 1 ];
         }
 
     filesystem: '-'
         {
-          $FAI::partition_pointer->{ "filesystem" } = $item[ 1 ];
+          $FAI::partition_pointer->{filesystem} = $item[ 1 ];
         }
         | 'swap'
         {
-          $FAI::partition_pointer->{ "filesystem" } = $item[ 1 ];
+          $FAI::partition_pointer->{filesystem} = $item[ 1 ];
         }
         | /^\S+/
         {
           ( &FAI::in_path("mkfs.$item[1]") == 1 ) or 
             die "unknown/invalid filesystem type $item[1] (mkfs.$item[1] not found in PATH)\n";
-          $FAI::partition_pointer->{ "filesystem" } = $item[ 1 ];
+          $FAI::partition_pointer->{filesystem} = $item[ 1 ];
         }
 
     fs_options: /[^;\n]*/
         {
-          $FAI::partition_pointer->{ "fs_options" } = $item[ 1 ];
+          $FAI::partition_pointer->{fs_options} = $item[ 1 ];
         }
 }
 );

Modified: people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm	2007-11-11 13:34:07 UTC (rev 4721)
+++ people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm	2007-11-11 21:51:39 UTC (rev 4722)
@@ -54,25 +54,25 @@
   # configuration; this matches in fact for than the allowable strings, but
   # this should be caught later on
   if ( $dev =~ /^\/dev\/[sh]d[a-z]$/ ) {
-    defined( $FAI::current_config{$dev}{"end_byte"} )
+    defined( $FAI::current_config{$dev}{end_byte} )
       or die "$dev is not a valid block device\n";
 
     # the size is known, return it
-    return ( $FAI::current_config{$dev}{"end_byte"} -
-        $FAI::current_config{$dev}{"begin_byte"} ) / ( 1024 * 1024 );
+    return ( $FAI::current_config{$dev}{end_byte} -
+        $FAI::current_config{$dev}{begin_byte} ) / ( 1024 * 1024 );
   }
 
   # try a partition
   elsif ( $dev =~ /^(\/dev\/[sh]d[a-z])(\d+)$/ ) {
 
     # the size is configured, return it
-    defined( $FAI::configs{"PHY_$1"}{"partitions"}{$2}{"size"}{"eff_size"} )
-      and return $FAI::configs{"PHY_$1"}{"partitions"}{$2}{"size"}{"eff_size"} /
+    defined( $FAI::configs{"PHY_$1"}{partitions}{$2}{size}{eff_size} )
+      and return $FAI::configs{"PHY_$1"}{partitions}{$2}{size}{eff_size} /
       ( 1024 * 1024 );
 
     # the size is known from the current configuration on disk, return it
-    defined( $FAI::current_config{$1}{"partitions"}{$2}{"count_byte"} )
-      and return $FAI::current_config{$1}{"partitions"}{$2}{"count_byte"} /
+    defined( $FAI::current_config{$1}{partitions}{$2}{count_byte} )
+      and return $FAI::current_config{$1}{partitions}{$2}{count_byte} /
       ( 1024 * 1024 );
 
     # the size is not known (yet?)
@@ -89,12 +89,12 @@
     my $level = "";
 
     # let's see, whether there is a configuration of this volume
-    if ( defined( $FAI::configs{"RAID"}{"volumes"}{$1}{"devices"} ) ) {
-      @devs  = keys %{ $FAI::configs{"RAID"}{"volumes"}{$1}{"devices"} };
-      $level = $FAI::configs{"RAID"}{"volumes"}{$1}{"mode"};
-    } elsif ( defined( $FAI::current_raid_config{$1}{"devices"} ) ) {
-      @devs  = $FAI::current_raid_config{$1}{"devices"};
-      $level = $FAI::current_raid_config{$1}{"mode"};
+    if ( defined( $FAI::configs{RAID}{volumes}{$1}{devices} ) ) {
+      @devs  = keys %{ $FAI::configs{RAID}{volumes}{$1}{devices} };
+      $level = $FAI::configs{RAID}{volumes}{$1}{mode};
+    } elsif ( defined( $FAI::current_raid_config{$1}{devices} ) ) {
+      @devs  = $FAI::current_raid_config{$1}{devices};
+      $level = $FAI::current_raid_config{$1}{mode};
     } else {
       die "$dev is not a known RAID device\n";
     }
@@ -157,7 +157,7 @@
     # least give a rough estimation, we assume 1 % of overhead; the value is
     # stored in megabytes
     my $vg_size = 0;
-    foreach my $dev ( keys %{ $FAI::configs{$config}{"devices"} } ) {
+    foreach my $dev ( keys %{ $FAI::configs{$config}{devices} } ) {
 
       # $dev may be a partition, an entire disk or a RAID device; otherwise we
       # cannot deal with it
@@ -177,13 +177,13 @@
     my $max_space = 0;
 
     # set effective sizes where available
-    foreach my $lv ( keys %{ $FAI::configs{$config}{"volumes"} } ) {
+    foreach my $lv ( keys %{ $FAI::configs{$config}{volumes} } ) {
       # reference to the size of the current logical volume
-      my $lv_ref_size = $FAI::configs->{$config}->{"volumes"}->{$lv}->{"size"};
+      my $lv_ref_size = ( \%FAI::configs )->{$config}->{volumes}->{$lv}->{size};
 
       # make sure the size specification is a range (even though it might be
       # something like x-x) and store the dimensions
-      ( $lv_ref_size->{"range"} =~ /^(\d+%?)-(\d+%?)$/ )
+      ( $lv_ref_size->{range} =~ /^(\d+%?)-(\d+%?)$/ )
         or die "INTERNAL ERROR: Invalid range\n";
       my $start = $1;
       my $end   = $2;
@@ -202,12 +202,12 @@
       $max_space += $end;
 
       # write back the range in MB
-      $lv_ref_size->{"range"} = "$start-$end";
+      $lv_ref_size->{range} = "$start-$end";
 
       # the size is fixed
       if ( $start == $end ) { 
         # write the size back to the configuration
-        $lv_ref_size->{"eff_size"} = $start;
+        $lv_ref_size->{eff_size} = $start;
       } else {
 
         # add this volume to the redistribution list
@@ -228,14 +228,13 @@
     foreach my $lv (@redist_list) {
 
       # get the range again
-      ( $FAI::configs{$config}{"volumes"}{$lv}{"size"}{"range"} =~
-          /^(\d+%?)-(\d+%?)$/ )
+      ( $FAI::configs{$config}{volumes}{$lv}{size}{range} =~ /^(\d+%?)-(\d+%?)$/ )
         or die "INTERNAL ERROR: Invalid range\n";
       my $start = $1;
       my $end   = $2;
 
       # write the final size
-      $FAI::configs{$config}{"volumes"}{$lv}{"size"}{"eff_size"} =
+      $FAI::configs{$config}{volumes}{$lv}{size}{eff_size} =
         $start + ( ( $end - $start ) * $redist_factor );
     }
   }
@@ -264,7 +263,7 @@
       or die "INTERNAL ERROR: invalid config entry $config.\n";
 
     # nothing to be done, if this is a configuration for a virtual disk
-    next if ( $FAI::configs{$config}{"virtual"} == 1 );
+    next if ( $FAI::configs{$config}{virtual} == 1 );
 
     # the device name of the disk
     my $disk = $1;
@@ -281,8 +280,8 @@
     my $current_extended = -1;
 
     # find the first existing extended partition
-    foreach my $part_id ( sort keys %{ $current_disk->{"partitions"} } ) {
-      if ( 1 == $current_disk->{"partitions"}->{$part_id}->{"is_extended"} ) {
+    foreach my $part_id ( sort keys %{ $current_disk->{partitions} } ) {
+      if ( 1 == $current_disk->{partitions}->{$part_id}->{is_extended} ) {
         $current_extended = $part_id;
         last;
       }
@@ -295,28 +294,28 @@
     my $next_start = 0;
 
     # on msdos disk labels, the first partitions starts at head #1
-    if ( $FAI::configs{$config}{"disklabel"} eq "msdos" ) {
-      $next_start = $current_disk->{"bios_sectors_per_track"} *
-        $current_disk->{"sector_size"};
+    if ( $FAI::configs{$config}{disklabel} eq "msdos" ) {
+      $next_start = $current_disk->{bios_sectors_per_track} *
+        $current_disk->{sector_size};
 
       # the MBR requires space, too
-      $min_req_total_space += $current_disk->{"bios_sectors_per_track"} *
-        $current_disk->{"sector_size"};
+      $min_req_total_space += $current_disk->{bios_sectors_per_track} *
+        $current_disk->{sector_size};
     }
 
     # on GPT disk labels the first 34 and last 34 sectors must be left alone
-    if ( $FAI::configs{$config}{"disklabel"} eq "gpt" ) {
-      $next_start = 34 * $current_disk->{"sector_size"};
+    if ( $FAI::configs{$config}{disklabel} eq "gpt" ) {
+      $next_start = 34 * $current_disk->{sector_size};
 
       # modify the disk to claim the space for the second partition table
-      $current_disk->{"end_byte"} -= 34 * $current_disk->{"sector_size"};
+      $current_disk->{end_byte} -= 34 * $current_disk->{sector_size};
 
       # the space required by the GPTs
-      $min_req_total_space += 2 * 34 * $current_disk->{"sector_size"};
+      $min_req_total_space += 2 * 34 * $current_disk->{sector_size};
     }
 
     # the list of partitions that we need to find start and end bytes for
-    my @worklist = ( sort keys %{ $FAI::configs{$config}{"partitions"} } );
+    my @worklist = ( sort keys %{ $FAI::configs{$config}{partitions} } );
 
     while ( scalar(@worklist) > 0 )
     {
@@ -324,62 +323,62 @@
       # work on the first entry of the list
       my $part_id = $worklist[0];
       # reference to the current partition
-      my $part_ref = $FAI::configs->{$config}->{"partitions"}->{$part_id};
+      my $part_ref = ( \%FAI::configs )->{$config}->{partitions}->{$part_id};
 
       # the partition $part_id must be preserved
-      if ( $part_ref->{"size"}->{"preserve"} == 1 ) {
+      if ( $part_ref->{size}->{preserve} == 1 ) {
 
         # a partition that should be preserved must exist already
-        defined( $current_disk->{"partitions"}->{$part_id} )
+        defined( $current_disk->{partitions}->{$part_id} )
           or die "$part_id can't be preserved, it does not exist.\n";
 
-        ( $next_start > $current_disk->{"partitions"}->{$part_id}->{"begin_byte"} )
+        ( $next_start > $current_disk->{partitions}->{$part_id}->{begin_byte} )
           and die "Previous partitions overflow begin of preserved partition $part_id\n";
 
         # set the effective size to the value known already
-        $part_ref->{"size"}->{"eff_size"} = $current_disk->{"partitions"}->{$part_id}->{"count_byte"};
+        $part_ref->{size}->{eff_size} = $current_disk->{partitions}->{$part_id}->{count_byte};
 
         # copy the start_byte and end_byte information
-        $part_ref->{"start_byte"} = $current_disk->{"partitions"}->{$part_id}->{"begin_byte"};
-        $part_ref->{"end_byte"} = $current_disk->{"partitions"}->{$part_id}->{"end_byte"};
+        $part_ref->{start_byte} = $current_disk->{partitions}->{$part_id}->{begin_byte};
+        $part_ref->{end_byte} = $current_disk->{partitions}->{$part_id}->{end_byte};
 
         # and add it to the total disk space required by this config
-        $min_req_total_space += $part_ref->{"size"}->{"eff_size"};
+        $min_req_total_space += $part_ref->{size}->{eff_size};
 
         # set the next start
-        $next_start = $part_ref->{"end_byte"} + 1;
+        $next_start = $part_ref->{end_byte} + 1;
 
         # several msdos specific parts
-        if ( $FAI::configs{$config}{"disklabel"} eq "msdos" ) {
+        if ( $FAI::configs{$config}{disklabel} eq "msdos" ) {
 
           # make sure the partition ends at a cylinder boundary
-          ( 0 == ( $current_disk->{"partitions"}->{$part_id}->{"end_byte"} + 1
-              ) % ( $current_disk->{"sector_size"} *
-                $current_disk->{"bios_sectors_per_track"} *
-                $current_disk->{"bios_heads"}
+          ( 0 == ( $current_disk->{partitions}->{$part_id}->{end_byte} + 1
+              ) % ( $current_disk->{sector_size} *
+                $current_disk->{bios_sectors_per_track} *
+                $current_disk->{bios_heads}
               )
             ) or die "Preserved partition $part_id does not end at a cylinder boundary\n";
 
           # add one head of disk usage if this is a logical partition
-          $min_req_total_space += $current_disk->{"bios_sectors_per_track"} *
-            $current_disk->{"sector_size"} if ( $part_id > 4 );
+          $min_req_total_space += $current_disk->{bios_sectors_per_track} *
+            $current_disk->{sector_size} if ( $part_id > 4 );
 
           # extended partitions consume no space
-          if ( $part_ref->{"size"}->{"extended"} == 1 ) {
+          if ( $part_ref->{size}->{extended} == 1 ) {
 
             # revert the addition of the size
-            $min_req_total_space -= $part_ref->{"size"}->{"eff_size"};
+            $min_req_total_space -= $part_ref->{size}->{eff_size};
 
             # set the next start to the start of the extended partition
-            $next_start = $part_ref->{"start_byte"};
+            $next_start = $part_ref->{start_byte};
           }
 
         }
 
         # on gpt, ensure that the partition ends at a sector boundary
-        if ( $FAI::configs{$config}{"disklabel"} eq "gpt" ) {
-          ( 0 == ( $current_disk->{"partitions"}{$part_id}{"end_byte"} + 1
-              ) % $current_disk->{"sector_size"})
+        if ( $FAI::configs{$config}{disklabel} eq "gpt" ) {
+          ( 0 == ( $current_disk->{partitions}{$part_id}{end_byte} + 1
+              ) % $current_disk->{sector_size})
             or die "Preserved partition $part_id does not end at a sector boundary\n";
         }
 
@@ -388,8 +387,8 @@
       }
 
       # msdos specific: deal with extended partitions
-      elsif ( $part_ref->{"size"}->{"extended"} == 1 ) {
-        ( $FAI::configs{$config}{"disklabel"} eq "msdos" )
+      elsif ( $part_ref->{size}->{extended} == 1 ) {
+        ( $FAI::configs{$config}{disklabel} eq "msdos" )
           or die "found an extended partition on a non-msdos disklabel\n";
 
         # make sure that there is only one extended partition
@@ -413,32 +412,32 @@
         # determine the size of the extended partition
         else {
           my $epbr_size =
-            $current_disk->{"bios_sectors_per_track"} *
-            $current_disk->{"sector_size"};
+            $current_disk->{bios_sectors_per_track} *
+            $current_disk->{sector_size};
 
           # initialise the size and the start byte
-          $part_ref->{"size"}->{"eff_size"} = 0;
-          $part_ref->{"start_byte"} = -1;
+          $part_ref->{size}->{eff_size} = 0;
+          $part_ref->{start_byte} = -1;
 
-          foreach my $p ( sort keys %{ $FAI::configs{$config}{"partitions"} } )
+          foreach my $p ( sort keys %{ $FAI::configs{$config}{partitions} } )
           {
             next if ( $p < 5 );
 
-            if ( -1 == $part_ref->{"start_byte"} )
+            if ( -1 == $part_ref->{start_byte} )
             {
-              $part_ref->{"start_byte"} =
-                $FAI::configs{$config}{"partitions"}{$p}{"start_byte"} -
+              $part_ref->{start_byte} =
+                $FAI::configs{$config}{partitions}{$p}{start_byte} -
                 $epbr_size;
             }
 
-            $part_ref->{"size"}->{"eff_size"} +=
-              $FAI::configs{$config}{"partitions"}{$p}{"size"}{"eff_size"} +
+            $part_ref->{size}->{eff_size} +=
+              $FAI::configs{$config}{partitions}{$p}{size}{eff_size} +
               $epbr_size;
 
-            $part_ref->{"end_byte"} = $FAI::configs{$config}{"partitions"}{$p}{"end_byte"};
+            $part_ref->{end_byte} = $FAI::configs{$config}{partitions}{$p}{end_byte};
           }
 
-          ( $part_ref->{"size"}->{"eff_size"} > 0 )
+          ( $part_ref->{size}->{eff_size} > 0 )
             or die "Extended partition has a size of 0\n";
 
           # partition done
@@ -448,7 +447,7 @@
 
         # make sure the size specification is a range (even though it might be
         # something like x-x) and store the dimensions
-        ( $part_ref->{"size"}->{"range"} =~
+        ( $part_ref->{size}->{range} =~
             /^(\d+%?)-(\d+%?)$/ ) or die "INTERNAL ERROR: Invalid range\n";
         my $start = $1;
         my $end   = $2;
@@ -457,7 +456,7 @@
         if ( $start =~ /^(\d+)%$/ ) {
 
           # rewrite it to bytes
-          $start = POSIX::floor( $current_disk->{"size"} * $1 / 100 );
+          $start = POSIX::floor( $current_disk->{size} * $1 / 100 );
         } else {
 
           # it is given in megabytes, make it bytes
@@ -468,7 +467,7 @@
         if ( $end =~ /^(\d+)%$/ ) {
 
           # rewrite it to bytes
-          $end = POSIX::ceil( $current_disk->{"size"} * $1 / 100 );
+          $end = POSIX::ceil( $current_disk->{size} * $1 / 100 );
         } else {
 
           # it is given in megabytes, make it bytes
@@ -498,25 +497,25 @@
           foreach my $p (@worklist) {
 
             # we have found the delimiter
-            if ( $FAI::configs{$config}{"partitions"}{$p}{"size"}{"preserve"} == 1 ) {
-              $end_of_range = $current_disk->{"partitions"}->{$p}->{"begin_byte"};
+            if ( $FAI::configs{$config}{partitions}{$p}{size}{preserve} == 1 ) {
+              $end_of_range = $current_disk->{partitions}->{$p}->{begin_byte};
 
               # logical partitions require the space for the EPBR to be left
               # out
-              if ( ( $FAI::configs{$config}{"disklabel"} eq "msdos" )
+              if ( ( $FAI::configs{$config}{disklabel} eq "msdos" )
                 && ( $p > 4 ) ) {
-                $end_of_range -= $current_disk->{"bios_sectors_per_track"} *
-                  $current_disk->{"sector_size"};
+                $end_of_range -= $current_disk->{bios_sectors_per_track} *
+                  $current_disk->{sector_size};
               }
               last;
-            } elsif ( $FAI::configs{$config}{"partitions"}{$p}{"size"}{"extended"} == 1 ) {
+            } elsif ( $FAI::configs{$config}{partitions}{$p}{size}{extended} == 1 ) {
               next;
             } else {
 
               # below is a slight duplication of the code
               # make sure the size specification is a range (even though it might be
               # something like x-x) and store the dimensions
-              ( $FAI::configs{$config}{"partitions"}{$p}{"size"}{"range"} =~
+              ( $FAI::configs{$config}{partitions}{$p}{size}{range} =~
                   /^(\d+%?)-(\d+%?)$/ )
                 or die "INTERNAL ERROR: Invalid range\n";
               my $min_size = $1;
@@ -526,7 +525,7 @@
               if ( $min_size =~ /^(\d+)%$/ ) {
 
                 # rewrite it to bytes
-                $min_size = POSIX::floor( $current_disk->{"size"} * $1 / 100 );
+                $min_size = POSIX::floor( $current_disk->{size} * $1 / 100 );
               } else {
 
                 # it is given in megabytes, make it bytes
@@ -538,7 +537,7 @@
 
                 # rewrite it to bytes
                 $max_size =
-                  POSIX::ceil( $current_disk->{"size"} * $1 / 100 );
+                  POSIX::ceil( $current_disk->{size} * $1 / 100 );
               } else {
 
                 # it is given in megabytes, make it bytes
@@ -547,12 +546,12 @@
 
               # logical partitions require the space for the EPBR to be left
               # out
-              if ( ( $FAI::configs{$config}{"disklabel"} eq "msdos" )
+              if ( ( $FAI::configs{$config}{disklabel} eq "msdos" )
                 && ( $p > 4 ) ) {
-                $min_size += $current_disk->{"bios_sectors_per_track"} *
-                  $current_disk->{"sector_size"};
-                $max_size += $current_disk->{"bios_sectors_per_track"} *
-                  $current_disk->{"sector_size"};
+                $min_size += $current_disk->{bios_sectors_per_track} *
+                  $current_disk->{sector_size};
+                $max_size += $current_disk->{bios_sectors_per_track} *
+                  $current_disk->{sector_size};
               }
 
               $min_req_space += $min_size;
@@ -561,7 +560,7 @@
           }
 
           # set the end if we have reached the end of the disk
-          $end_of_range = $current_disk->{"end_byte"} if ( -1 == $end_of_range );
+          $end_of_range = $current_disk->{end_byte} if ( -1 == $end_of_range );
 
           my $available_space = $end_of_range - $next_start + 1;
 
@@ -586,37 +585,37 @@
 
         # now we compute the effective locations on the disk
         # msdos specific offset for logical partitions
-        if ( ( $FAI::configs{$config}{"disklabel"} eq "msdos" )
+        if ( ( $FAI::configs{$config}{disklabel} eq "msdos" )
           && ( $part_id > 4 ) ) {
 
           # add one head of disk usage if this is a logical partition
-          $min_req_total_space += $current_disk->{"bios_sectors_per_track"} *
-            $current_disk->{"sector_size"};
+          $min_req_total_space += $current_disk->{bios_sectors_per_track} *
+            $current_disk->{sector_size};
 
           # move the start byte as well
-          $next_start += $current_disk->{"bios_sectors_per_track"} *
-            $current_disk->{"sector_size"};
+          $next_start += $current_disk->{bios_sectors_per_track} *
+            $current_disk->{sector_size};
         }
 
         # partition starts at where we currently are
-        $FAI::configs{$config}{"partitions"}{$part_id}{"start_byte"} =
+        $FAI::configs{$config}{partitions}{$part_id}{start_byte} =
           $next_start;
 
         # the end may need some alignment, depending on the disk label
         my $end_byte = $next_start + $start - 1;
 
         # on msdos, ensure that the partition ends at a cylinder boundary
-        if ( $FAI::configs{$config}{"disklabel"} eq "msdos" ) {
+        if ( $FAI::configs{$config}{disklabel} eq "msdos" ) {
           $end_byte -=
-            ( $end_byte + 1 ) % ( $current_disk->{"sector_size"} *
-              $current_disk->{"bios_sectors_per_track"} *
-              $current_disk->{"bios_heads"} );
+            ( $end_byte + 1 ) % ( $current_disk->{sector_size} *
+              $current_disk->{bios_sectors_per_track} *
+              $current_disk->{bios_heads} );
         }
 
         # on gpt, ensure that the partition ends at a sector boundary
-        if ( $FAI::configs{$config}{"disklabel"} eq "gpt" ) {
+        if ( $FAI::configs{$config}{disklabel} eq "gpt" ) {
           $end_byte -=
-            ( $end_byte + 1 ) % $current_disk->{"sector_size"};
+            ( $end_byte + 1 ) % $current_disk->{sector_size};
         }
 
         # set $start and $end to the effective values
@@ -624,19 +623,19 @@
         $end   = $start;
 
         # write back the size spec in bytes
-        $part_ref->{"size"}->{"range"} = $start . "-" . $end;
+        $part_ref->{size}->{range} = $start . "-" . $end;
 
         # then set eff_size to a proper value
-        $part_ref->{"size"}->{"eff_size"} = $start;
+        $part_ref->{size}->{eff_size} = $start;
 
         # write the end byte to the configuration
-        $part_ref->{"end_byte"} = $end_byte;
+        $part_ref->{end_byte} = $end_byte;
 
         # and add it to the total disk space required by this config
-        $min_req_total_space += $part_ref->{"size"}->{"eff_size"};
+        $min_req_total_space += $part_ref->{size}->{eff_size};
 
         # set the next start
-        $next_start = $part_ref->{"end_byte"} + 1;
+        $next_start = $part_ref->{end_byte} + 1;
 
         # partition done
         shift @worklist;
@@ -644,17 +643,17 @@
     }
 
     # check, whether there is sufficient space on the disk
-    ( $min_req_total_space > $current_disk->{"size"} )
+    ( $min_req_total_space > $current_disk->{size} )
       and die "Disk $disk is too small - at least $min_req_total_space bytes are required\n";
 
     # make sure, extended partitions are only created on msdos disklabels
-    ( $FAI::configs{$config}{"disklabel"} ne "msdos" && $extended > -1 )
+    ( $FAI::configs{$config}{disklabel} ne "msdos" && $extended > -1 )
       and die "INTERNAL ERROR: extended partitions are not supported by this disklabel\n";
 
     # ensure that we have done our work
-    foreach my $part_id ( sort keys %{ $FAI::configs{$config}{"partitions"} } ) {
-      ( defined( $FAI::configs{$config}{"partitions"}{$part_id}{"start_byte"} )
-          && defined( $FAI::configs{$config}{"partitions"}{$part_id}{"end_byte"} ) )
+    foreach my $part_id ( sort keys %{ $FAI::configs{$config}{partitions} } ) {
+      ( defined( $FAI::configs{$config}{partitions}{$part_id}{start_byte} )
+          && defined( $FAI::configs{$config}{partitions}{$part_id}{end_byte} ) )
         or die "INTERNAL ERROR: start or end of partition $part_id not set\n";
     }
 

Modified: people/michael/features/setup_harddisks_2/implementation/lib/volumes.pm
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/lib/volumes.pm	2007-11-11 13:34:07 UTC (rev 4721)
+++ people/michael/features/setup_harddisks_2/implementation/lib/volumes.pm	2007-11-11 21:51:39 UTC (rev 4722)
@@ -56,7 +56,7 @@
     ( -b $disk ) or die "$disk is not a block special device!\n";
 
     # initialise the hash
-    $FAI::current_config{$disk}{"partitions"} = {};
+    $FAI::current_config{$disk}{partitions} = {};
 
     # the list to hold the output of parted commands as parsed below
     my @parted_print = ();
@@ -75,9 +75,11 @@
     # parted_2 happens when the disk has no disk label, because parted then
     # provides no information about the disk
     if ( $error eq "parted_2" ) {
+      ( $FAI::no_dry_run == 1 ) or die 
+        "Can't run on test-only mode on this system because there is no disklabel on $disk\n";
 
       # if there is no disk configuration, write an msdos disklabel
-      if ( !defined( $FAI::configs{"PHY_$disk"}{"disklabel"} ) ) {
+      if ( !defined( $FAI::configs{"PHY_$disk"}{disklabel} ) ) {
 
         # write the disk label as configured
         $error = &FAI::execute_command( "parted -s $disk mklabel msdos" );
@@ -85,7 +87,7 @@
 
         # write the disk label as configured
         $error = &FAI::execute_command(
-          "parted -s $disk mklabel " . $FAI::configs{"PHY_$disk"}{"disklabel"} );
+          "parted -s $disk mklabel " . $FAI::configs{"PHY_$disk"}{disklabel} );
       }
 
       # set no_dry_run to perform read-only commands always
@@ -161,12 +163,12 @@
 
       # determine the logical sector size
       if ( $line =~ /^Sector size \(logical\/physical\): (\d+)B\/(\d+)B$/ ) {
-        $FAI::current_config{$disk}{"sector_size"} = $1;
+        $FAI::current_config{$disk}{sector_size} = $1;
       }
 
       # read and store the current disk label
       elsif ( $line =~ /^Partition Table: (.+)$/ ) {
-        $FAI::current_config{$disk}{"disklabel"} = $1;
+        $FAI::current_config{$disk}{disklabel} = $1;
       }
 
       # the line containing the table headers
@@ -229,7 +231,7 @@
         $fs =~ s/\s*$//g;
 
         # store the information in the hash
-        $FAI::current_config{$disk}{"partitions"}{$id}{"filesystem"} = $fs;
+        $FAI::current_config{$disk}{partitions}{$id}{filesystem} = $fs;
       }
     }
 
@@ -260,9 +262,9 @@
 
       # the disk size line (Disk /dev/hda: 82348277759B)
       if ( $line =~ /Disk \Q$disk\E: (\d+)B$/ ) {
-        $FAI::current_config{$disk}{"begin_byte"} = 0;
-        $FAI::current_config{$disk}{"end_byte"}   = ( $1 - 1 );
-        $FAI::current_config{$disk}{"size"}       = $1;
+        $FAI::current_config{$disk}{begin_byte} = 0;
+        $FAI::current_config{$disk}{end_byte}   = ( $1 - 1 );
+        $FAI::current_config{$disk}{size}       = $1;
 
         # nothing else to be done
         next;
@@ -275,17 +277,17 @@
         );
 
       # mark the bounds of existing partitions
-      $FAI::current_config{$disk}{"partitions"}{$1}{"begin_byte"} = $2;
-      $FAI::current_config{$disk}{"partitions"}{$1}{"end_byte"}   = $3;
-      $FAI::current_config{$disk}{"partitions"}{$1}{"count_byte"} = $4;
+      $FAI::current_config{$disk}{partitions}{$1}{begin_byte} = $2;
+      $FAI::current_config{$disk}{partitions}{$1}{end_byte}   = $3;
+      $FAI::current_config{$disk}{partitions}{$1}{count_byte} = $4;
 
       # is_extended defaults to false/0
-      $FAI::current_config{$disk}{"partitions"}{$1}{"is_extended"} = 0;
+      $FAI::current_config{$disk}{partitions}{$1}{is_extended} = 0;
 
       # but may be true/1 on msdos disk labels
-      ( ( $FAI::current_config{$disk}{"disklabel"} eq "msdos" )
+      ( ( $FAI::current_config{$disk}{disklabel} eq "msdos" )
           && ( $6 eq "extended" ) )
-        and $FAI::current_config{$disk}{"partitions"}{$1}{"is_extended"} = 1;
+        and $FAI::current_config{$disk}{partitions}{$1}{is_extended} = 1;
     }
 
     # set no_dry_run to perform read-only commands always
@@ -310,21 +312,21 @@
       if ( $line =~
         /^BIOS cylinder,head,sector geometry:\s*(\d+),(\d+),(\d+)\.\s*Each cylinder is \d+kB\.$/
         ) {
-        $FAI::current_config{$disk}{"bios_cylinders"}         = $1;
-        $FAI::current_config{$disk}{"bios_heads"}             = $2;
-        $FAI::current_config{$disk}{"bios_sectors_per_track"} = $3;
+        $FAI::current_config{$disk}{bios_cylinders}         = $1;
+        $FAI::current_config{$disk}{bios_heads}             = $2;
+        $FAI::current_config{$disk}{bios_sectors_per_track} = $3;
       }
     }
 
     # make sure we have determined all the necessary information
-    ( $FAI::current_config{$disk}{"begin_byte"} == 0 )
+    ( $FAI::current_config{$disk}{begin_byte} == 0 )
       or die "Invalid start byte\n";
-    ( $FAI::current_config{$disk}{"end_byte"} > 0 ) or die "Invalid end byte\n";
-    defined( $FAI::current_config{$disk}{"size"} )
+    ( $FAI::current_config{$disk}{end_byte} > 0 ) or die "Invalid end byte\n";
+    defined( $FAI::current_config{$disk}{size} )
       or die "Failed to determine disk size\n";
-    defined( $FAI::current_config{$disk}{"sector_size"} )
+    defined( $FAI::current_config{$disk}{sector_size} )
       or die "Failed to determine sector size\n";
-    defined( $FAI::current_config{$disk}{"bios_sectors_per_track"} )
+    defined( $FAI::current_config{$disk}{bios_sectors_per_track} )
       or die "Failed to determine the number of sectors per track\n";
 
   }
@@ -342,27 +344,28 @@
   # get the existing volume groups
   foreach my $vg (get_volume_group_list()) {
     # initialise the hash entry
-    $FAI::current_lvm_config{$vg}{"physical_volumes"} = ();
+    $FAI::current_lvm_config{$vg}{physical_volumes} = ();
     
     # store the vg size in MB
     my %vg_info = get_volume_group_information($vg);
-    $FAI::current_lvm_config{$vg}{"size"} = 
-      &FAI::convert_unit( $vg_info{"alloc_pe_size"} .
-        $vg_info{"alloc_pe_size_unit"} );
+    $FAI::current_lvm_config{$vg}{size} = 
+      &FAI::convert_unit( $vg_info{alloc_pe_size} .
+        $vg_info{alloc_pe_size_unit} );
     
       # store the logical volumes and their sizes
     my %lv_info = get_logical_volume_information($vg);
     foreach my $lv_name (sort keys %lv_info) {
       my $short_name = $lv_name;
       $short_name =~ "s{/dev/\Q$vg\E/}{}";
-      $FAI::current_lvm_config{$vg}{"volumes"}{$short_name}{"size"} =
-        &FAI::convert_unit( $lv_info{$lv_name}->{"lv_size"} .
-          $lv_info{$lv_name}->{"lv_size_unit"} );
+      $FAI::current_lvm_config{$vg}{volumes}{$short_name}{size} =
+        &FAI::convert_unit( $lv_info{$lv_name}->{lv_size} .
+          $lv_info{$lv_name}->{lv_size_unit} );
     }
     
     # store the physical volumes
-    $FAI::current_lvm_config{$vg}{"physical_volumes"} = 
-      sort keys get_physical_volume_information($vg);
+    my %pv_info = get_physical_volume_information($vg);
+    @{ $FAI::current_lvm_config{$vg}{physical_volumes} } = 
+      sort keys %{ get_physical_volume_information($vg) };
   }
 
 }
@@ -403,9 +406,9 @@
   foreach my $line (@mdadm_print) {
     if ( $line =~ /^ARRAY \/dev\/md(\d+) level=(\S+) num-devices=\d+ UUID=/ ) {
       $id = $1;
-      $FAI::current_raid_config{$id}{"mode"} = $2;
+      $FAI::current_raid_config{$id}{mode} = $2;
     } elsif ( $line =~ /^\s*devices=(\S+)$/ ) {
-      @{ $FAI::current_raid_config{$id}{"devices"} } = split( ",", $1 );
+      @{ $FAI::current_raid_config{$id}{devices} } = split( ",", $1 );
     }
   }
 

Modified: people/michael/features/setup_harddisks_2/implementation/storage-magic
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/storage-magic	2007-11-11 13:34:07 UTC (rev 4721)
+++ people/michael/features/setup_harddisks_2/implementation/storage-magic	2007-11-11 21:51:39 UTC (rev 4722)
@@ -90,9 +90,9 @@
 
 # see which class file to use
 else {
-  foreach my $classfile ( reverse split( /\s+/, $ENV{"classes"} ) ) {
-    next unless ( -r "$ENV{'FAI'}/disk_config/$classfile" );
-    open( $config_file, "$ENV{'FAI'}/disk_config/$classfile" );
+  foreach my $classfile ( reverse split( /\s+/, $ENV{classes} ) ) {
+    next unless ( -r "$ENV{FAI}/disk_config/$classfile" );
+    open( $config_file, "$ENV{FAI}/disk_config/$classfile" );
     last;
   }
 }




More information about the Fai-commit mailing list