[Fai-commit] r5785 - branches/experimental/patches

Julien Blache jblache at alioth.debian.org
Thu May 27 15:42:20 UTC 2010


Author: jblache
Date: 2010-05-27 15:42:16 +0000 (Thu, 27 May 2010)
New Revision: 5785

Added:
   branches/experimental/patches/setup-storage_external-journal
   branches/experimental/patches/setup-storage_ramsize
   branches/experimental/patches/setup-storage_tmpfs
Modified:
   branches/experimental/patches/series
Log:
Add support for:
 - partition sizes defined relative to the amount of RAM
 - tmpfs volumes
 - external journal for ext3/4 and XFS


Modified: branches/experimental/patches/series
===================================================================
--- branches/experimental/patches/series	2010-05-26 07:29:29 UTC (rev 5784)
+++ branches/experimental/patches/series	2010-05-27 15:42:16 UTC (rev 5785)
@@ -15,3 +15,6 @@
 setup-storage_abs-path
 setup-storage_devmapper
 fix-eval_cmdline
+setup-storage_ramsize
+setup-storage_tmpfs
+setup-storage_external-journal

Added: branches/experimental/patches/setup-storage_external-journal
===================================================================
--- branches/experimental/patches/setup-storage_external-journal	                        (rev 0)
+++ branches/experimental/patches/setup-storage_external-journal	2010-05-27 15:42:16 UTC (rev 5785)
@@ -0,0 +1,155 @@
+2010-05-27  Julien BLACHE <jblache at debian.org>
+	* lib/setup-storage/Commands.pm: support the creation of journal
+	devices (ext3/4) and filesystems with external journal (ext3/4, xfs).
+	* lib/setup-storage/Parser.pm: add support for FS_journal and
+	FS:journal=.
+	* man/setup-storage.8: document external journal support.
+
+Index: trunk-w-exp/lib/setup-storage/Commands.pm
+===================================================================
+--- trunk-w-exp.orig/lib/setup-storage/Commands.pm	2010-05-27 16:02:39.000000000 +0200
++++ trunk-w-exp/lib/setup-storage/Commands.pm	2010-05-27 16:10:11.000000000 +0200
+@@ -54,6 +54,7 @@
+   defined ($partition->{filesystem})
+     or &FAI::internal_error("filesystem is undefined");
+   my $fs = $partition->{filesystem};
++  my $journal = $partition->{journal_dev};
+ 
+   return if ($fs eq "-");
+ 
+@@ -66,13 +67,45 @@
+   print "$partition->{mountpoint} FS create_options: $create_options\n" if ($FAI::debug && $create_options);
+   print "$partition->{mountpoint} FS tune_options: $tune_options\n" if ($FAI::debug && $tune_options);
+ 
+-  # create the file system with options
+-  my $create_tool = "mkfs.$fs";
+-  ($fs eq "swap") and $create_tool = "mkswap";
+-  ($fs eq "xfs") and $create_options = "$create_options -f" unless ($create_options =~ m/-f/);
+-  ($fs eq "reiserfs") and $create_options = "$create_options -q" unless ($create_options =~ m/-(f|q|y)/);
+-  &FAI::push_command( "$create_tool $create_options $device", "exist_$device",
+-    "has_fs_$device" );
++  my $prereqs = "exist_$device";
++  my $provides;
++  my $create_tool;
++
++  # create filesystem journal
++  if ($fs =~ m/.*_journal$/) {
++      $provides = "journal_preped_$device";
++      undef($tune_options);
++
++      if ($fs =~ /ext[34]_journal/) {
++	  $create_tool = "mke2fs";
++	  $create_options = "-O journal_dev";
++      } elsif ($fs eq "xfs_journal") {
++	  $create_tool = "/bin/true";
++	  $create_options = "";
++      } else {
++	  &FAI::internal_error("unsupported journal type $fs");
++      }
++  } else {
++      # create regular filesystem
++      $provides = "has_fs_$device";
++      $create_tool = "mkfs.$fs";
++
++      ($fs eq "swap") and $create_tool = "mkswap";
++      ($fs eq "xfs") and $create_options = "$create_options -f" unless ($create_options =~ m/-f/);
++      ($fs eq "reiserfs") and $create_options = "$create_options -q" unless ($create_options =~ m/-(f|q|y)/);
++
++      # adjust options for filesystem with external journal
++      if (defined($journal)) {
++	  $journal =~ s/^journal=//;
++	  $prereqs = "$prereqs,journal_preped_$journal";
++
++	  ($fs eq "xfs") and $create_options = "$create_options -l logdev=$journal";
++	  ($fs eq "ext3") and $create_options = "$create_options -J device=$journal";
++	  ($fs eq "ext4") and $create_options = "$create_options -J device=$journal";
++      }
++  }
++
++  &FAI::push_command( "$create_tool $create_options $device", $prereqs, $provides);
+ 
+   # possibly tune the file system - this depends on whether the file system
+   # supports tuning at all
+@@ -956,10 +989,12 @@
+ 
+     my $fs = $part->{filesystem};
+     $fs = "" unless defined($fs);
++    ($fs) = split(/:/, $fs);
+     $fs = "linux-swap" if ($fs eq "swap");
+     $fs = "fat32" if ($fs eq "vfat");
+     $fs = "fat16" if ($fs eq "msdos");
+     $fs = "ext3" if ($fs eq "ext4");
++    $fs = "" if ($fs =~ m/.*_journal$/);
+     $fs = $FAI::current_config{$disk}{partitions}{$mapped_id}{filesystem}
+       if ($part->{size}->{preserve} || $part->{size}->{resize});
+     $fs = "" if ($fs eq "-");
+Index: trunk-w-exp/lib/setup-storage/Parser.pm
+===================================================================
+--- trunk-w-exp.orig/lib/setup-storage/Parser.pm	2010-05-27 16:02:39.000000000 +0200
++++ trunk-w-exp/lib/setup-storage/Parser.pm	2010-05-27 16:10:11.000000000 +0200
+@@ -869,16 +869,24 @@
+         }
+         | /^\S+/
+         {
+-          $FAI::partition_pointer->{filesystem} = $item[ 1 ];
++          my ($fs, $journal) = split(/:/, $item[1]);
+           my $to_be_preserved = 0;
++
++          $FAI::partition_pointer->{filesystem} = $fs;
++
++          defined($journal) and $journal =~ s/journal=//;
++          $FAI::partition_pointer->{journal_dev} = $journal;
++
+           if ($FAI::device eq "RAID" or $FAI::device eq "CRYPT") {
+             $to_be_preserved = $FAI::partition_pointer->{preserve};
+           } else {
+             $to_be_preserved = $FAI::partition_pointer->{size}->{preserve};
+           }
+           if (0 == $to_be_preserved) {
+-            &FAI::in_path("mkfs.$item[1]") or
+-              die "unknown/invalid filesystem type $item[1] (mkfs.$item[1] not found in PATH)\n";
++            $fs =~ s/_journal$//;
++
++            &FAI::in_path("mkfs.$fs") or
++              die "unknown/invalid filesystem type $fs (mkfs.$fs not found in PATH)\n";
+           }
+         }
+ 
+Index: trunk-w-exp/man/setup-storage.8
+===================================================================
+--- trunk-w-exp.orig/man/setup-storage.8	2010-05-27 16:45:57.000000000 +0200
++++ trunk-w-exp/man/setup-storage.8	2010-05-27 16:28:07.000000000 +0200
+@@ -537,6 +537,33 @@
+ .IP \(bu
+ Mount a tmpfs on /scratch with a maximum size of 3 GiB.
+ 
++.TP
++External log device example
++.sp
++.nf
++.ta 10n 20n 30n 40n 60n
++disk_config /dev/sda fstabkey:uuid bootable:2
++primary	/	20GiB	ext3		defaults
++primary	/boot	250	ext2		defaults
++primary	swap	4GiB	swap		defaults
++logical	-	256	ext3_journal	-
++logical	-	256	ext4_journal	-
++logical	-	256	xfs_journal	-
++
++disk_config /dev/sdb fstabkey:uuid
++primary	/mnt/ext3	33%	ext3:journal=/dev/sda5		defaults
++primary	/mnt/ext4	33%	ext4:journal=/dev/sda6		defaults
++primary	/mnt/xfs	33%	xfs:journal=/dev/sda7		defaults
++.sp
++.fi
++.PP
++.IP \(bu
++Mount an ext3 filesystem on /dev/sdb1 with an external journal on /dev/sda5
++.IP \(bu
++Mount an ext4 filesystem on /dev/sdb2 with an external journal on /dev/sda6
++.IP \(bu
++Mount an XFS filesystem on /dev/sdb3 using /dev/sda7 as the log device
++
+ .SH CAVEATS
+ .IP \(bu
+ Partition UUID cannot be obtained: In case a partition was previously used as

Added: branches/experimental/patches/setup-storage_ramsize
===================================================================
--- branches/experimental/patches/setup-storage_ramsize	                        (rev 0)
+++ branches/experimental/patches/setup-storage_ramsize	2010-05-27 15:42:16 UTC (rev 5785)
@@ -0,0 +1,108 @@
+2010-05-27  Julien BLACHE <jblache at debian.org>
+	* lib/setup-storage/Parser.pm: add support for RAM:XX% in the parser and
+	convert_units().
+	* man/setup-storage.8: document RAM:XX%.
+
+Index: trunk-w-exp/lib/setup-storage/Parser.pm
+===================================================================
+--- trunk-w-exp.orig/lib/setup-storage/Parser.pm	2010-05-27 15:24:30.000000000 +0200
++++ trunk-w-exp/lib/setup-storage/Parser.pm	2010-05-27 15:24:18.000000000 +0200
+@@ -307,6 +307,21 @@
+ {
+   my ($val) = @_;
+ 
++  if ($val =~ /^RAM:(\d+)%/) {
++      $val = $1 / 100.0;
++
++      ## get total RAM
++      open(F, "/proc/meminfo");
++      my @meminfo = <F>;
++      close F;
++
++      my ($totalmem) = grep /^MemTotal:/, @meminfo;
++      $totalmem =~ s/[^0-9]//g;
++      $totalmem = $totalmem / 1024.0;
++
++      return $val * $totalmem;
++  }
++
+   ## don't warn for now, G/GiB/GB are all treated the same way
+   ## ($val =~ /([kKMGTP])\s*$/) and
+   ##   warn "Using $1 as size modifier is deprecated, please use $1iB or $1B
+@@ -673,17 +688,17 @@
+           1;
+         }
+ 
+-    size: /^(\d+[kMGTP%iB]*(-(\d+[kMGTP%iB]*)?)?)(:resize)?\s+/
++    size: /^((RAM:\d+%|\d+[kMGTP%iB]*)(-(RAM:\d+%|\d+[kMGTP%iB]*)?)?)(:resize)?\s+/
+         {
+           # complete the size specification to be a range in all cases
+           my $range = $1;
+           # the size is fixed
+-          if (!defined ($2))
++          if (!defined ($3))
+           {
+             # make it a range of the form x-x
+-            $range = "$range-$1";
++            $range = "$range-$2";
+           }
+-          elsif (!defined ($3))
++          elsif (!defined ($4))
+           {
+             # range has no upper limit, assume the whole disk
+             $range = "${range}100%";
+@@ -699,12 +714,12 @@
+           # enter the range into the hash
+           $FAI::partition_pointer->{size}->{range} = $range;
+           # set the resize flag, if required
+-          if (defined ($4)) {
++          if (defined ($5)) {
+             $FAI::partition_pointer->{size}->{resize} = 1;
+             $FAI::configs{$FAI::device}{preserveparts} = 1;
+           }
+         }
+-        | /^(-\d+[kMGTP%iB]*)(:resize)?\s+/
++        | /^(-(RAM:\d+%|\d+[kMGTP%iB]*))(:resize)?\s+/
+         {
+           # complete the range by assuming 0 as the lower limit 
+           my $range = "0$1";
+@@ -718,7 +733,7 @@
+           # enter the range into the hash
+           $FAI::partition_pointer->{size}->{range} = $range;
+           # set the resize flag, if required
+-          if (defined ($2)) {
++          if (defined ($3)) {
+             $FAI::partition_pointer->{size}->{resize} = 1;
+             $FAI::configs{$FAI::device}{preserveparts} = 1;
+           }
+Index: trunk-w-exp/man/setup-storage.8
+===================================================================
+--- trunk-w-exp.orig/man/setup-storage.8	2010-05-27 15:24:30.000000000 +0200
++++ trunk-w-exp/man/setup-storage.8	2010-05-27 15:24:18.000000000 +0200
+@@ -341,19 +341,19 @@
+ .br
+ 
+ 
+-size ::= [[:digit:]]+[kKMGTP%iB]*(-([[:digit:]]+[kKMGTP%iB]*)?)?(:resize)?
++size ::= (RAM:[[:digit:]]+%|[[:digit:]]+[kKMGTP%iB]*)(-(RAM:[[:digit:]]+%|[[:digit:]]+[kKMGTP%iB]*)?)?(:resize)?
+ .br
+-         /* size in kilo (KiB), mega (default, MiB), giga (GiB), tera (TiB) or
++         /* size in kilo (KiB), mega (default, MiB), giga (GiB), tera (TiB),
+ .br
+-          * petabytes (PiB) or %, possibly given as a range; physical
++          * petabytes (PiB) or percentage of disk size or RAM size, possibly
+ .br
+-          * partitions or lvm logical volumes only; in future releases KB, MB,
++          * given as a range; physical partitions or lvm logical volumes only;
+ .br
+-          * GB, ... will be treated as 1000 instead of 1024 (KiB, MiB, GiB, ...)
++          * in future releases KB, MB, GB, ... will be treated as 1000 instead
+ .br
+-          * multipliers */
++          * of 1024 (KiB, MiB, GiB, ...) multipliers */
+ .br
+-         | -[[:digit:]]+[kKMGTP%iB]*(:resize)?
++         | -(RAM:[[:digit:]]+%|[[:digit:]]+[kKMGTP%iB]*)(:resize)?
+ .br
+          /* size in kilo, mega (default), giga, tera or petabytes or %,
+ .br

Added: branches/experimental/patches/setup-storage_tmpfs
===================================================================
--- branches/experimental/patches/setup-storage_tmpfs	                        (rev 0)
+++ branches/experimental/patches/setup-storage_tmpfs	2010-05-27 15:42:16 UTC (rev 5785)
@@ -0,0 +1,285 @@
+2010-05-27  Julien BLACHE <jblache at debian.org>
+	* lib/setup-storage/Commands.pm: support the TMPFS key where necessary.
+	* lib/setup-storage/Fstab.pm: add support for tmpfs mounts.
+	* lib/setup-storage/Parser.pm: add a new tmpfs stanza, a new tmpfs volume
+	type and tmpfs_size (slightly differing from the regular size, no range
+	support).
+	* man/setup-storage.8: document the tmpfs stanza.
+
+Index: trunk-w-exp/lib/setup-storage/Commands.pm
+===================================================================
+--- trunk-w-exp.orig/lib/setup-storage/Commands.pm	2010-05-27 16:02:39.000000000 +0200
++++ trunk-w-exp/lib/setup-storage/Commands.pm	2010-05-27 16:02:39.000000000 +0200
+@@ -235,8 +235,8 @@
+ sub build_raid_commands {
+ 
+   foreach my $config (keys %FAI::configs) { # loop through all configs
+-    # no LVM or physical devices here
+-    next if ($config eq "CRYPT" || $config =~ /^VG_./ || $config =~ /^PHY_./);
++    # no encrypted, tmpfs, LVM or physical devices here
++    next if ($config eq "CRYPT" || $config eq "TMPFS" || $config =~ /^VG_./ || $config =~ /^PHY_./);
+     ($config eq "RAID") or &FAI::internal_error("Invalid config $config");
+ 
+     # create all raid devices
+@@ -574,8 +574,8 @@
+   # loop through all configs
+   foreach my $config (keys %FAI::configs) {
+ 
+-    # no physical devices, RAID or encrypted here
+-    next if ($config =~ /^PHY_./ || $config eq "RAID" || $config eq "CRYPT");
++    # no physical devices, RAID, encrypted or tmpfs here
++    next if ($config =~ /^PHY_./ || $config eq "RAID" || $config eq "CRYPT" || $config eq "TMPFS");
+     ($config =~ /^VG_(.+)$/) or &FAI::internal_error("Invalid config $config");
+     next if ($1 eq "--ANY--");
+     my $vg = $1; # the volume group
+@@ -1000,8 +1000,8 @@
+ 
+   # loop through all configs
+   foreach my $config ( keys %FAI::configs ) {
+-    # no RAID, encrypted or LVM devices here
+-    next if ($config eq "RAID" || $config eq "CRYPT" || $config =~ /^VG_./);
++    # no RAID, encrypted, tmpfs or LVM devices here
++    next if ($config eq "RAID" || $config eq "CRYPT" || $config eq "TMPFS" || $config =~ /^VG_./);
+     ($config =~ /^PHY_(.+)$/) or &FAI::internal_error("Invalid config $config");
+     my $disk = $1; # the device to be configured
+ 
+Index: trunk-w-exp/lib/setup-storage/Fstab.pm
+===================================================================
+--- trunk-w-exp.orig/lib/setup-storage/Fstab.pm	2010-05-27 16:02:39.000000000 +0200
++++ trunk-w-exp/lib/setup-storage/Fstab.pm	2010-05-27 16:02:39.000000000 +0200
+@@ -58,9 +58,10 @@
+   push @fstab_line, ($d_ref->{mountpoint}, $d_ref->{filesystem},
+     $d_ref->{mount_options}, 0, 2);
+   # order of filesystem checks: the root filesystem gets a 1, the others
+-  # get 2, swap gets 0
++  # get 2, swap and tmpfs get 0
+   $fstab_line[-1] = 1 if ($d_ref->{mountpoint} eq "/");
+   $fstab_line[-1] = 0 if ($d_ref->{filesystem} eq "swap");
++  $fstab_line[-1] = 0 if ($d_ref->{filesystem} eq "tmpfs");
+ 
+   # set the ROOT_PARTITION variable, if this is the mountpoint for /
+   $FAI::disk_var{ROOT_PARTITION} = $name
+@@ -159,6 +160,9 @@
+         return $this_mp if ($this_mp eq "/boot");
+         $mnt_point = $this_mp if ($this_mp eq "/");
+       }
++    } elsif ($c eq "TMPFS") {
++      # not usable for /boot
++      next;
+     } else {
+       &FAI::internal_error("Unexpected key $c");
+     }
+@@ -303,6 +307,26 @@
+ 
+         push @fstab, &FAI::create_fstab_line($c_ref, $device_name, $device_name);
+       }
++    } elsif ($c eq "TMPFS") {
++      foreach my $v (keys %{ $config->{$c}->{volumes} }) {
++        my $c_ref = $config->{$c}->{volumes}->{$v};
++
++        next if ($c_ref->{mountpoint} eq "-");
++
++        ($c_ref->{mountpoint} eq "/boot" || ($c_ref->{mountpoint} eq "/" &&
++            !defined ($FAI::disk_var{BOOT_PARTITION}))) and
++          die "Boot partition cannot be a tmpfs\n";
++
++	if (($c_ref->{mount_options} =~ m/size=/) || ($c_ref->{mount_options} =~ m/nr_blocks=/)) {
++          warn "Specified tmpfs size for $c_ref->{mountpoint} ignored as mount options contain size= or nr_blocks=\n";
++        } else {
++	  $c_ref->{mount_options} .= "," if ($c_ref->{mount_options} ne "");
++          # Size will be in % or MiB
++	  $c_ref->{mount_options} .= "size=" . $c_ref->{size};
++	}
++
++        push @fstab, &FAI::create_fstab_line($c_ref, "tmpfs", "tmpfs");
++      }
+     } else {
+       &FAI::internal_error("Unexpected key $c");
+     }
+Index: trunk-w-exp/lib/setup-storage/Parser.pm
+===================================================================
+--- trunk-w-exp.orig/lib/setup-storage/Parser.pm	2010-05-27 16:02:39.000000000 +0200
++++ trunk-w-exp/lib/setup-storage/Parser.pm	2010-05-27 16:02:39.000000000 +0200
+@@ -398,6 +398,12 @@
+           # exit config mode
+           $FAI::device = "";
+         }
++        | /^tmpfs/
++        {
++          $FAI::device = "TMPFS";
++          $FAI::configs{$FAI::device}{fstabkey} = "device";
++          $FAI::configs{$FAI::device}{volumes} = {};
++        }
+         | /^disk(\d+)/
+         {
+           # check, whether parted is available
+@@ -616,6 +622,26 @@
+           $FAI::partition_pointer = (\%FAI::configs)->{CRYPT}->{volumes}->{$vol_id};
+         }
+         mountpoint devices filesystem mount_options lv_or_fsopts
++        | /^tmpfs\s+/
++        {
++          ($FAI::device eq "TMPFS") or die "tmpfs entry invalid in this context\n";
++          defined ($FAI::configs{TMPFS}) or &FAI::internal_error("TMPFS entry missing");
++
++          my $vol_id = 0;
++          foreach my $ex_vol_id (&FAI::numsort(keys %{ $FAI::configs{TMPFS}{volumes} })) {
++            defined ($FAI::configs{TMPFS}{volumes}{$ex_vol_id}{device}) or last;
++            $vol_id++;
++          }
++
++          $FAI::configs{TMPFS}{volumes}{$vol_id}{device} = "tmpfs";
++          $FAI::configs{TMPFS}{volumes}{$vol_id}{filesystem} = "tmpfs";
++
++          # We don't do preserve for tmpfs
++          $FAI::configs{TMPFS}{volumes}{$vol_id}{preserve} = 0;
++
++          $FAI::partition_pointer = (\%FAI::configs)->{TMPFS}->{volumes}->{$vol_id};
++        }
++        mountpoint tmpfs_size mount_options
+         | type mountpoint size filesystem mount_options lv_or_fsopts
+ 
+     type: 'primary'
+@@ -740,6 +766,27 @@
+         }
+         | <error: invalid partition size near "$text">
+ 
++    tmpfs_size: /^(RAM:(\d+%)|\d+[kMGTPiB]*)\s+/
++        {
++          my $size;
++
++          # convert the units, if necessary
++          # A percentage is kept as is as tmpfs handles it
++          if (defined($2)) {
++            $size = $2;
++          } else {
++            $size = $1;
++            $size .= "MiB" if ($size =~ /\d\s*$/);
++            $size  = &FAI::convert_unit($size);
++            # Size in MiB for tmpfs
++            $size .= "m";
++          }
++
++          # enter the size into the hash
++          $FAI::partition_pointer->{size} = $size;
++        }
++        | <error: invalid tmpfs size near "$text">
++
+     devices: /^([^\d,:\s\-][^,:\s]*(:(spare|missing))*(,[^,:\s]+(:(spare|missing))*)*)/
+         {
+           # split the device list by ,
+Index: trunk-w-exp/lib/setup-storage/Sizes.pm
+===================================================================
+--- trunk-w-exp.orig/lib/setup-storage/Sizes.pm	2010-05-27 16:02:39.000000000 +0200
++++ trunk-w-exp/lib/setup-storage/Sizes.pm	2010-05-27 16:02:39.000000000 +0200
+@@ -201,8 +201,8 @@
+   # loop through all device configurations
+   foreach my $config (keys %FAI::configs) {
+ 
+-    # for RAID, encrypted or physical disks there is nothing to be done here
+-    next if ($config eq "RAID" || $config eq "CRYPT" || $config =~ /^PHY_./);
++    # for RAID, encrypted, tmpfs or physical disks there is nothing to be done here
++    next if ($config eq "RAID" || $config eq "CRYPT" || $config eq "TMPFS" || $config =~ /^PHY_./);
+     ($config =~ /^VG_(.+)$/) or &FAI::internal_error("invalid config entry $config");
+     next if ($1 eq "--ANY--");
+     my $vg = $1; # the volume group name
+@@ -597,8 +597,8 @@
+   # loop through all device configurations
+   foreach my $config (keys %FAI::configs) {
+ 
+-    # for RAID, encrypted or LVM, there is nothing to be done here
+-    next if ($config eq "RAID" || $config eq "CRYPT" || $config =~ /^VG_./);
++    # for RAID, encrypted, tmpfs or LVM, there is nothing to be done here
++    next if ($config eq "RAID" || $config eq "CRYPT" || $config eq "TMPFS" || $config =~ /^VG_./);
+     ($config =~ /^PHY_(.+)$/) or &FAI::internal_error("invalid config entry $config");
+     # nothing to be done, if this is a configuration for a virtual disk
+     next if $FAI::configs{$config}{virtual};
+Index: trunk-w-exp/lib/setup-storage/Volumes.pm
+===================================================================
+--- trunk-w-exp.orig/lib/setup-storage/Volumes.pm	2010-05-27 16:02:39.000000000 +0200
++++ trunk-w-exp/lib/setup-storage/Volumes.pm	2010-05-27 16:02:39.000000000 +0200
+@@ -65,6 +65,9 @@
+     } elsif ($config eq "CRYPT") {
+       # devices must be one of the above already
+       next;
++    } elsif ($config eq "TMPFS") {
++      # no devices
++      next;
+     } else {
+       &FAI::internal_error("Unexpected key $config");
+     }
+@@ -558,6 +561,9 @@
+     } elsif ($config eq "CRYPT") {
+       # We don't do preserve for encrypted partitions
+       next;
++    } elsif ($config eq "TMPFS") {
++      # We don't do preserve for tmpfs
++      next;
+     } else {
+       &FAI::internal_error("Unexpected key $config");
+     }
+Index: trunk-w-exp/man/setup-storage.8
+===================================================================
+--- trunk-w-exp.orig/man/setup-storage.8	2010-05-27 16:02:39.000000000 +0200
++++ trunk-w-exp/man/setup-storage.8	2010-05-27 16:08:41.000000000 +0200
+@@ -137,6 +137,8 @@
+ .br
+            | disk_config cryptsetup( <cryptsetupoption>)*
+ .br
++           | disk_config tmpfs
++.br
+            | disk_config end 
+ .br
+            | disk_config disk[[:digit:]]+( <option>)*
+@@ -289,6 +291,10 @@
+ .br
+            /* lvm vg */
+ .br
++           | tmpfs <mountpoint> <tmpfs_size> <mount_options>
++.br
++           /* tmpfs volume */
++.br
+ 
+ 
+ type ::= primary
+@@ -367,6 +373,14 @@
+ .br
+ 
+ 
++tmpfs_size ::= (RAM:[[:digit:]]+%|[[:digit:]]+[kKMGTPiB]*)
++.br
++         /* tmpfs size in percentage of the total RAM or fixed size in
++.br
++          kilo (KiB), mega (default, MiB), giga (GiB), tera (TiB) or petabytes (PiB).
++.br
++
++
+ mount_options ::= [^[:space:]]+
+ .br
+ 
+@@ -504,6 +518,25 @@
+ .sp
+ .fi
+ .PP
++
++.TP
++tmpfs example
++.sp
++.nf
++.ta 10n 20n 30n 40n 50n
++disk_config tmpfs
++tmpfs	/tmp	RAM:20%	defaults
++tmpfs	/scratch	3GiB	defaults
++.sp
++.fi
++.PP
++.IP \(bu
++Mount a tmpfs on /tmp with a maximum size equal to 20% of the total amount of
++RAM in the machine. This is equivalent to using size=20% in the tmpfs mount
++options.
++.IP \(bu
++Mount a tmpfs on /scratch with a maximum size of 3 GiB.
++
+ .SH CAVEATS
+ .IP \(bu
+ Partition UUID cannot be obtained: In case a partition was previously used as




More information about the Fai-commit mailing list