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

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Thu Jun 8 15:07:38 UTC 2006


Author: michael-guest
Date: 2006-06-01 20:47:45 +0000 (Thu, 01 Jun 2006)
New Revision: 3485

Modified:
   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:
merged suggestions from linux-fai


Modified: people/michael/features/setup_harddisks_2/examples/model
===================================================================
--- people/michael/features/setup_harddisks_2/examples/model	2006-05-02 21:01:13 UTC (rev 3484)
+++ people/michael/features/setup_harddisks_2/examples/model	2006-06-01 20:47:45 UTC (rev 3485)
@@ -1,8 +1,8 @@
 disk_config hda   preserve:6,7   disklabel:msdos  bootable:3
-primary /boot     20        rw                  ext3
-primary swap      1000     sw         swap
-primary /         12000      rw                  ext3  -b 2048
-logical /tmp      1000      rw,nosuid		ext3
-logical /usr      preserve6      rw                  ext3
-logical /var      2000-      rw                  ext3 -L var_part
-logical /nobackup 0-	rw                   xfs
+primary /boot     20       ext3       rw 
+primary swap      1000     swap       sw 
+primary /         12000      ext3          rw   -b 2048
+logical /tmp      1000      ext3     rw,nosuid
+logical /usr      preserve6      ext3     rw
+logical /var      2000-      ext3    rw     -L var_part
+logical /nobackup 0-	xfs    rw 

Modified: people/michael/features/setup_harddisks_2/examples/vil
===================================================================
--- people/michael/features/setup_harddisks_2/examples/vil	2006-05-02 21:01:13 UTC (rev 3484)
+++ people/michael/features/setup_harddisks_2/examples/vil	2006-06-01 20:47:45 UTC (rev 3485)
@@ -29,19 +29,19 @@
 
 disk_config raid
 
-raid1        /    sda1,sdd1  rw,errors=remount-ro    ext2
-raid1        swap sda2,sdd2  rw                      swap
-raid1        -    sda3,sdd3  default                 ext2
+raid1        /    sda1,sdd1  ext2    rw,errors=remount-ro   
+raid1        swap sda2,sdd2  swap    rw                     
+raid1        -    sda3,sdd3  ext2    default                
 
-raid0        -    sdb1,sde1  default                 ext2
-raid0        -    sdc1,sdf1  default                 ext2
+raid0        -    sdb1,sde1  ext2    default
+raid0        -    sdc1,sdf1  ext2    default
 
 # config the LVM
 disk_config lvm
-pv  my_pv   md2,md3   
-my_pv:_usr	/usr			2048        rw,notail    reiser
-my_pv:_var	/var			600         rw,notail    reiser
-my_pv:_e_h	/export/home		10240       rw,notail    reiser
-my_pv:_e_s	/export/sites		2048        rw,notail    reiser
-my_pv:_v	/vservers		2048        rw       ext3
+vg  my_pv   md2,md3   
+my_pv-_usr	/usr			2048        reiser  rw,notail
+my_pv-_var	/var			600         reiser  rw,notail
+my_pv-_e_h	/export/home		10240       reiser          rw,notail
+my_pv-_e_s	/export/sites		2048        reiser          rw,notail
+my_pv-_v	/vservers		2048        ext3    rw 
 

Modified: people/michael/features/setup_harddisks_2/setup_harddisks_2
===================================================================
--- people/michael/features/setup_harddisks_2/setup_harddisks_2	2006-05-02 21:01:13 UTC (rev 3484)
+++ people/michael/features/setup_harddisks_2/setup_harddisks_2	2006-06-01 20:47:45 UTC (rev 3485)
@@ -9,39 +9,56 @@
 # # one could say preserve7 below. The disklabel is msdos, which is the default
 # # for x86. Furthermore the 3rd partition is made bootable, which would have
 # # happened as well by default as it is mounted as /
-# primary /boot     20        rw                  ext3
-# # create a primary partition /dev/hda1 with a size of 20 MB and mount it
+# primary /boot     20-100        ext3            rw
+# # create a primary partition /dev/hda1 with a size between 20 and 100 MB and mount it
 # # read-write as /boot; it is formatted using ext3 filesystem
-# primary swap      1000     sw         swap
+# primary swap      1000     swap       sw
 # # /dev/hda2 will be a swap space of 1000 MB
-# primary /         12000      rw                  ext3  -b 2048
+# primary /         12000      ext3           rw        -b 2048
 # # /dev/hda3 should be formatted using ext3 filesystem; when calling mkfs.ext3
 # # the option "-b 2048" is appended.
-# logical /tmp      1000      rw,nosuid		ext3
+# logical /tmp      1000      ext3            rw,nosuid
 # # create the logical partition /dev/hda5
-# logical /usr      preserve6      rw                  ext3
-# logical /var      2000-      rw                  ext3
-# # make /dev/hda7 at least 2000 MB
-# logical /nobackup 0-	rw                   xfs
+# logical /usr      preserve6      ext3          rw
+# logical /var      10%-      ext3               rw
+# # make /dev/hda7 at least 10% of the disk size
+# logical /nobackup 0-	      xfs                rw
 # # use mkfs.xfs to format the partition
 #
+# # Configure the virtual device /dev/sda (for, e.g., Xen setups), all
+# # partitions are primary and sizes are ignored (so one could as well specify
+# # anything other than 0)
+# disk_config sda virtual
+# primary /boot     0            ext3                 rw
+# primary /         0            ext3                 rw
+# primary /tmp      0            ext3                 rw
+# primary /usr      0            ext3                 rw
+# primary /var      0            ext3                 rw
 #
+# # resizing partitions is possible by appending :resize to any given size
+# disk_config /dev/scsi/host0/bus0/target1/lun0 
+# primary /      3000-6000:resize         ext3         rw
+# # resize to any value between 3000 and 6000 MB, as limited by the disk size,
+# # the desired sizes of the other partitions, and the data on the partition
+# primary /tmp   1000                     ext3         rw
+#
 # # Create a softRAID
 # disk_config raid
-# raid1        /    sda1,sdd1  rw,errors=remount-ro    ext2
+# raid1        /    sda1,sdd1  ext2        rw,errors=remount-ro
 # # create a RAID-1 on /dev/sda1 and /dev/sdd1, format using mkfs.ext2 and mount
 # # it as /
-# raid0        -    sdb1,sde1  default                 ext2
-# # create a RAID-0 on /dev/sdb1 and /dev/sde1
+# raid0        -    disk2.2,sdc1,sde1:spare:missing  ext2       default
+# # create a RAID-0 on the second partition of the second disk, /dev/sdc1, and
+# # /dev/sde1 as a spare partition, which (may?) me missing
 #
 #
 # # config an LVM
 # disk_config lvm
-# pv  my_pv   md2,md3
-# # create the physical volume group my_pv on the (RAID) devices /dev/md2 and
+# vg  my_vg   md2,md3
+# # create the physical volume group my_vg on the (RAID) devices /dev/md2 and
 # # /dev/md3
-# my_pv:_usr	/usr			2048        rw,notail    reiser
-# # create the logical volume _usr on the physical volume group my_pv
+# my_vg-_usr	/usr			2048        reiser        rw,notail
+# # create the logical volume _usr on the physical volume group my_vg
 #
 #
 #
@@ -72,10 +89,12 @@
 #            /* write a disklabel - default is msdos */
 #            | bootable:[[:digit:]]
 #            /* mark a partition bootable, default is / */
+#            | virtual
+#            /* do not assume the disk to be a physical device, use with xen */
 # 
-# volume ::= <type> <mountpoint> <size> <mount_options> <filesystem> <fs_options>
-#            | pv <name> <size>
-#            /* lvm pv */
+# volume ::= <type> <mountpoint> <size> <filesystem> <mount_options> <fs_options>
+#            | vg <name> <size>
+#            /* lvm vg */
 # 
 # type ::= primary
 #          /* for physical disks only */
@@ -83,8 +102,8 @@
 #          /* for physical disks only */
 #          | raid[015]
 #          /* raid level */
-#          | [^/[:space:]]+:[^/[:space:]]+
-#          /* lvm logical volume: pv name and lv name*/
+#          | [^/[:space:]]+-[^/[:space:]]+
+#          /* lvm logical volume: vg name and lv name*/
 # 
 # mountpoint ::= -
 #                /* do not mount */
@@ -96,16 +115,16 @@
 # name ::= [^/[:space:]]+
 #          /* lvm volume group name */
 # 
-# size ::= [[:digit:]]+%?(-[[:digit:]]+%?)?
+# size ::= [[:digit:]]+%?(-[[:digit:]]+%?)?(:resize)?
 #          /* size in megabytes or %, possibly given as a range; physical
 #           * partitions or lvm logical volumes only */
-#          | -[[:digit:]]+%?
+#          | -[[:digit:]]+%?(:resize)?
 #          /* 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 */
+#          | [^,:[:space:]]+(:(spare|missing))*(,[^,:[:space:]]+(:(spare|missing))*)*
+#          /* devices and options for a raid or lvm vg */
 #     
 # mount_options ::= [^[:space:]]+
 # 
@@ -119,8 +138,10 @@
 #
 #
 # * TODO - single function to read partition table for a given physical device and store it in
-#   some internal format
+#   some internal format - /sbin/parted -s /dev/hda unit B print might be
+#   helpful
 # * TODO - backend to write things to disk, using e.g. parted (parted -s)
+# * TODO - test mode, regression test suite
 # * TODO - command script:
 #   - init_script
 #   - make_cmds
@@ -131,7 +152,14 @@
 # * TODO - dependencies between LVM/RAID commands -> should be detected by
 #   parser/semantic analysis
 #   multiple RAID/LVM stanzas, but deps must be satisfied, global RAID-dev counter
-# 
+#
+# * suggestions for modifications of the above format
+#   - put options on a separate line
+#   - size specification via size_sda1
+#   - size specs by RAM size
+#   - options for lvcreate (e.g. physical volume)
+#
+#
 # internal format, generated by parser:
 # 
 # - list of records: line_no[int], mode[string], type[string], size[string],
@@ -168,12 +196,12 @@
   {
     my $dev = $1;
     my $dev_options = undef;
+    # additional options appended
     if( $dev =~ /^(\S+)\s+(\S+.*)$/ )
     {
       $dev = $1;
       $dev_options = $2;
     }
-    
     # end of disk_config
     if( $dev =~ /^end$/ )
     {
@@ -230,6 +258,9 @@
         elsif( $o =~ /^bootable:\d+$/ )
         {
         }
+        elsif( $o =~ /^virtual$/ )
+        {
+        }
         else
         {
           die "Syntax error in line " . $line_no . " - invalid option " . $o . "\n";
@@ -251,40 +282,40 @@
     my $filesystem = "";
     my $fs_options = "";
     # volume group
-    if( $mode eq "lvm" && $line =~ /^pv\s+([^\/\s]+)\s+(\S+)$/ )
+    if( $mode eq "lvm" && $line =~ /^vg\s+([^\/\s]+)\s+(\S+)$/ )
     {
-      $type = "pv";
+      $type = "vg";
       $mountpoint = $1;
       $size = $2;
     }
     # physical partition
-    elsif( $mode =~ /^phy/ && $line =~ /^(primary|logical)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)(\s+(.*))?$/ )
+    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;
+      $filesystem = $4;
+      $mount_options = $5;
       $fs_options = $7;
     }
     # RAID definition
-    elsif( $mode eq "raid" && $line =~ /^(raid[015])\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)(\s+(.*))?$/ )
+    elsif( $mode eq "raid" && $line =~ /^(raid[015])\s+(\S+)\s+(\S+)\s+([^,\s]+)\s+(\S+)(\s+(.*))?$/ )
     {
       $type = $1;
       $mountpoint = $2;
       $size = $3;
-      $mount_options = $4;
-      $filesystem = $5;
+      $filesystem = $4;
+      $mount_options = $5;
       $fs_options = $7;
     }
     # logical volume
-    elsif( $mode eq "lvm" && $line =~ /^(\S+:\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)(\s+(.*))?$/ )
+    elsif( $mode eq "lvm" && $line =~ /^(\S+\-\S+)\s+(\S+)\s+(\S+)\s+([^,\s]+)\s+(\S+)(\s+(.*))?$/ )
     {
       $type = $1;
       $mountpoint = $2;
       $size = $3;
-      $mount_options = $4;
-      $filesystem = $5;
+      $filesystem = $4;
+      $mount_options = $5;
       $fs_options = $7;
     }
     else
@@ -293,10 +324,10 @@
     }
 
     # test for valid mount point
-    if( $type ne "pv" && $mountpoint =~ /^(-|swap|\/(\S+)?)$/ )
+    if( $type ne "vg" && $mountpoint =~ /^(-|swap|\/(\S+)?)$/ )
     {
     }
-    elsif( $type eq "pv" )
+    elsif( $type eq "vg" )
     {
     }
     else
@@ -305,18 +336,21 @@
     }
     
     # test valid size format
-    if( ( $type eq "pv" || $mode eq "raid" ) && $size =~ /^[^,\s]+(,[^,\s]+)*$/ )
+    if( $type eq "vg" &&  $size =~ /^[^,:\s]+(,[^,:\s]+)*$/ )
     {
     }
-    elsif( ( $mode =~ /^phy/ || $type =~ /\S+:\S+/ ) && ( $size =~ /^(\d+%?(-(\d+%?)?)?|-\d+%?)$/ ) )
+    elsif( $mode eq "raid" && $size =~ /^[^,:\s]+(:(spare|missing))*(,[^,\s]+(:(spare|missing))*)*$/ )
     {
     }
+    elsif( ( $mode =~ /^phy/ || $type =~ /\S+\-\S+/ ) && ( $size =~ /^(\d+%?(-(\d+%?)?)?|-\d+%?)(:resize)?$/ ) )
+    {
+    }
     elsif( $mode =~ /^phy/ && ( $size =~ /^preserve\d+$/ ) )
     {
     }
     else
     {
-      if( $type eq "pv" || $mode eq "raid" )
+      if( $type eq "vg" || $mode eq "raid" )
       {
         die "Syntax error in line " . $line_no . " - invalid device name\n";
       }
@@ -327,7 +361,7 @@
     }
 
     # make sure that filesystem creator exists
-    if( $type ne "pv" )
+    if( $type ne "vg" )
     {
       if( $filesystem =~ /^(-|swap)$/ )
       {
@@ -338,9 +372,9 @@
       }
     } 
 
-    if( $type =~ /\S+:\S+/ )
+    if( $type =~ /\S+\-\S+/ )
     {
-      # TODO - verify that pv name has been defined already
+      # TODO - verify that vg name has been defined already
     }
   }
 }




More information about the Fai-commit mailing list