[Fai-commit] r3394 - in people/michael/features: . setup_harddisks_2 setup_harddisks_2/examples

fai-repository at svn.debian.org fai-repository at svn.debian.org
Tue Apr 11 15:21:33 UTC 2006


Author: michael-guest
Date: 2006-04-11 15:21:32 +0000 (Tue, 11 Apr 2006)
New Revision: 3394

Added:
   people/michael/features/setup_harddisks_2/
   people/michael/features/setup_harddisks_2/examples/
   people/michael/features/setup_harddisks_2/examples/model
   people/michael/features/setup_harddisks_2/examples/vil
   people/michael/features/setup_harddisks_2/setup_harddisks_2
Log:
starting implementation of new setup_harddisks


Added: people/michael/features/setup_harddisks_2/examples/model
===================================================================
--- people/michael/features/setup_harddisks_2/examples/model	2006-04-09 13:53:44 UTC (rev 3393)
+++ people/michael/features/setup_harddisks_2/examples/model	2006-04-11 15:21:32 UTC (rev 3394)
@@ -0,0 +1,8 @@
+disk_config hda
+primary /boot     20        rw                  ext3
+primary swap      1000     sw         swap
+primary /         12000      rw                  ext3
+logical /tmp      1000      rw,nosuid		ext3
+logical /usr      15000      rw                  ext3
+logical /var      preserve7      rw                  ext3
+logical /nobackup 0-	rw                   ext3

Added: people/michael/features/setup_harddisks_2/examples/vil
===================================================================
--- people/michael/features/setup_harddisks_2/examples/vil	2006-04-09 13:53:44 UTC (rev 3393)
+++ people/michael/features/setup_harddisks_2/examples/vil	2006-04-11 15:21:32 UTC (rev 3394)
@@ -0,0 +1,47 @@
+# disk configuration for a 6 disk configuration
+
+# This is set up much like everything else; 
+
+# <type> <mountpoint> <size in mb> <mount options> <filesystem> [extra options]
+
+disk_config sda
+
+primary  /    256         - -  
+primary  swap 1024        -                   -
+primary  -		0-				 - -
+
+disk_config sdb
+primary  -		0-				 - -
+
+disk_config sdc
+primary  -		0-				 - -
+
+disk_config sdd
+primary  -             	256         - -
+primary  -          	1024        -                   -
+primary  -		0-				 - -
+
+disk_config sde
+primary  -		0-				 - -
+
+disk_config sdf
+primary  -		0-				 - -
+
+disk_config raid
+
+1        /    sda1,sdd1  rw,errors=remount-ro    ext2
+1        swap sda2,sdd2  rw                      swap
+1        -    sda3,sdd3  default                 ext2
+
+1        -    sdb1,sde1  default                 ext2
+1        -    sdc1,sdf1  default                 ext2
+
+# config the LVM
+disk_config lvm
+pv  default   md2,md3   
+lv:default	_usr:/usr			2048        rw,notail    reiser
+lv:default	_var:/var			600         rw,notail    reiser
+lv:default	_e_h:/export/home		10240       rw,notail    reiser
+lv:default	_e_s:/export/sites		2048        rw,notail    reiser
+lv:default	_v:/vservers		2048        rw       ext3
+

Added: people/michael/features/setup_harddisks_2/setup_harddisks_2
===================================================================
--- people/michael/features/setup_harddisks_2/setup_harddisks_2	2006-04-09 13:53:44 UTC (rev 3393)
+++ people/michael/features/setup_harddisks_2/setup_harddisks_2	2006-04-11 15:21:32 UTC (rev 3394)
@@ -0,0 +1,243 @@
+#!/usr/bin/perl -w
+ 
+# file ::= <lines> EOF
+# 
+# lines ::= EOL
+#           /* empty lines or whitespace only */
+#           | <comment> EOL
+#           | <config> EOL
+# 
+# comment ::= #.*
+# 
+# config ::= disk_config lvm
+#            | disk_config raid
+#            | disk_config end
+#            | disk_config disk[[:digit:]]+
+#            | disk_config [^[:space:]]+ 
+#            /* fully qualified device-path or short form, like hda, whereby full
+#             * path is assumed to be /dev/hda */
+#            | <volume>
+# 
+# volume ::= <type> <mountpoint> <size> <mount_options> <filesystem> <fs_options>
+#            | pv <name> <size>
+#            /* lvm pv */
+# 
+# type ::= primary
+#          /* for physical disks only */
+#          | logical
+#          /* for physical disks only */
+#          | [015]
+#          /* raid level */
+#          | lv:[^/[:space:]]+
+#          /* lvm logical volume and pv name */
+# 
+# mountpoint ::= -
+#                /* do not mount */
+#                | swap
+#                /* swap space */
+#                | /[^[:space:]]*
+#                /* fully qualified path */
+#                | [^:[:space:]]:/[^[:space:]]*
+#                /* lvm lv name:fully qualified path */
+# 
+# name ::= [^/[:space:]]+
+#          /* lvm volume group name */
+# 
+# size ::= [[:digit:]]+%?(-[[:digit:]]+%?)?
+#          /* size in megabytes or %, possibly given as a range; physical
+#           * partitions or lvm logical volumes only */
+#          | -[[:digit:]]+%?
+#          /* size in megabytes or % given as upper limit; physical partitions 
+#           * or lvm logical volumes only */
+#          | preserve[[:digit:]]+
+#          /* do not modify this partition */
+#          | [^,[:space:]]+(,[^,[:space:]])*
+#          /* devices for a raid or lvm pv */
+#     
+# mount_options ::= [^[:space:]]+
+# 
+# filesystem ::= -
+#                | swap
+#                | [^[:space:]]
+#                /* mkfs.xxx must exist */
+# 
+# fs_options ::= .*
+#                /* options appended to mkfs.xxx call */
+#
+#
+# TODO - Other things the parser/semantic analysis must take care of in the future:
+# * for lv:<name> a line pv <name> must have been found before
+# * only a single RAID and LVM stanza should be allowed
+# * boot option is not supported yet - is it used by anybody?
+# * check Debian BTS for other requests
+#
+# TODO - next steps
+# * create fstab from input
+# * create command script
+
+my $mode = "";
+my $line_no = 0;
+
+while(<>)
+{
+  $line_no++;
+  chomp;
+  my $line = $_;
+  # throw away trailing whitespace
+  if( $line =~ /(.*?)\s+$/ )
+  {
+    $line = $1;
+  }
+
+  # comment
+  if( $line =~ /^\s*#/ )
+  {
+    next;
+  }
+  # blank line
+  elsif( $line =~ /^\s*$/ )
+  {
+    next;
+  }
+  # disk_config
+  elsif( $line =~ /^disk_config\s+(end|lvm|raid|disk\d+|[^\s]+)$/ )
+  {
+    my $dev = $1;
+    # end of disk_config
+    if( $dev =~ /^end$/ )
+    {
+      $mode = "";
+    }
+    # lvm
+    elsif( $dev =~ /^lvm$/ )
+    {
+      $mode = "lvm";
+    }
+    # raid
+    elsif( $dev =~ /^raid$/ )
+    {
+      $mode = "raid";
+    }
+    # n-th of disklist
+    elsif( $dev =~ /^disk(\d+)$/ )
+    {
+      $mode = "phy_";
+      my $i = 0;
+      foreach my $d ( split( /\s/, $ENV{disklist} ) )
+      {
+        $i++;
+        if( $i == $1 )
+        {
+          $dev = "/dev/" . $d;
+          last;
+        }
+      }
+      $mode = $mode . $dev;
+    }
+    # device name, full path name given
+    elsif( $dev =~ /^\// )
+    {
+      $mode = "phy_" . $dev;
+    }
+    # device name, short form
+    else
+    {
+      $mode = "phy_/dev/" . $dev;
+    }
+  }
+  # volume
+  else
+  {
+    my $type = "";
+    my $mountpoint = "";
+    my $size = "";
+    my $mount_options = "";
+    my $filesystem = "";
+    my $fs_options = "";
+    if( $mode eq "lvm" && $line =~ /^pv\s+([^\/\s]+)\s+(\S+)$/ )
+    {
+      $type = "pv";
+      $mountpoint = $1;
+      $size = $2;
+    }
+    elsif( $mode =~ /^phy/ && $line =~ /^(primary|logical)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)(\s+(.*))?$/ )
+    {
+      $type = $1;
+      $mountpoint = $2;
+      $size = $3;
+      $mount_options = $4;
+      $filesystem = $5;
+      $fs_options = $7;
+    }
+    elsif( $mode eq "raid" && $line =~ /^([015])\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)(\s+(.*))?$/ )
+    {
+      $type = $1;
+      $mountpoint = $2;
+      $size = $3;
+      $mount_options = $4;
+      $filesystem = $5;
+      $fs_options = $7;
+    }
+    elsif( $mode eq "lvm" && $line =~ /^(lv:\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)(\s+(.*))?$/ )
+    {
+      $type = $1;
+      $mountpoint = $2;
+      $size = $3;
+      $mount_options = $4;
+      $filesystem = $5;
+      $fs_options = $7;
+    }
+    else
+    {
+      die "Syntax error in line " . $line_no . "\n";
+    }
+
+    if( $mode ne "lvm" && $mountpoint =~ /^(-|swap|\/(\S+)?)$/ )
+    {
+    }
+    elsif( $type =~ /^lv/ && $mountpoint =~ /^[^:\s]+:(-|swap|\/(\S+)?)$/ )
+    {
+    }
+    elsif( $type eq "pv" )
+    {
+    }
+    else
+    {
+      die "Syntax error in line " . $line_no . " - invalid mount point " . $mountpoint . "\n";
+    }
+    
+    if( ( $type eq "pv" || $mode eq "raid" ) && $size =~ /^[^,\s]+(,[^,\s]+)*$/ )
+    {
+    }
+    elsif( ( $mode =~ /^phy/ || $type =~ /^lv/ ) && ( $size =~ /^(\d+%?(-(\d+%?)?)?|-\d+%?)$/ ) )
+    {
+    }
+    elsif( $mode =~ /^phy/ && ( $size =~ /^preserve\d+$/ ) )
+    {
+    }
+    else
+    {
+      if( $type eq "pv" || $mode eq "raid" )
+      {
+        die "Syntax error in line " . $line_no . " - invalid device name\n";
+      }
+      else
+      {
+        die "Syntax error in line " . $line_no . " - invalid size\n";
+      }
+    }
+
+    if( $type ne "pv" )
+    {
+      if( $filesystem =~ /^(-|swap)$/ )
+      {
+      }
+      else
+      {
+        # test for existance of mkfs.$filesystem
+      }
+    } 
+  }
+}
+      
+


Property changes on: people/michael/features/setup_harddisks_2/setup_harddisks_2
___________________________________________________________________
Name: svn:executable
   + *




More information about the Fai-commit mailing list