On Thu, 4 Oct 2007, Andrea Righi wrote:

> Frank Corrao wrote:
>> On Thu, 4 Oct 2007, Andrea Righi wrote:
>>
>>> Frank Corrao wrote:
>>>> Greetings,
>>>>
>>>> I'm currently using systemimager 3.8.2 and would like to take advantage
>>>> of the lvm support that has been added.  I've defined 2 partitions on
>>>> the disk and used the size="*" statement to specify that the second
>>>> partition should use all of the remaining space since I won't know the
>>>> size of the disk in advance.  This partition will make up VolGroup00.
>>>> Within VolGroup00 I want to define a 2GB logical volume for swap and
>>>> use the remaining space in the volume group to create a logical volume
>>>> for /.  Unfortunately the lv statement doesn't seem to recognize
>>>> size="*" as the part statement does.  Omitting the size= definition
>>>> doesn't seem to work either.  Is there any other way to accomplish this
>>>> without knowing the size of the physical disk?
>>>>
>>>
>>> No, at the moment you can specify only a fixed size for logical
>>> volumes. But patches or suggestions are welcome... :-)
>>>
>>> -Andrea
>>
>> It seems recent versions of the lvcreate command support the %FREE flag
>> when specifying volume size by extent.  If there were a way to configure
>> autoinstallscript.conf to define the lv size by extent rather than only
>> by the raw size, we could pass 100%FREE:
>>
>> i.e.  <lv name="LogVol01" extents="100%FREE" />
>>
>> This would generate the following lvcreate command:
>>
>> lvcreate  -l100%FREE -n LogVol01 VolGroup00 || shellout
>
> Frank,
>
> very good! So, what do you think about the following patch (untested)?
>
> -Andrea
>
> Index: lib/SystemImager/Server.pm
> ===================================================================
> --- lib/SystemImager/Server.pm        (revision 4289)
> +++ lib/SystemImager/Server.pm        (working copy)
> @@ -1111,6 +1111,11 @@
>                 print "WARNING: undefined logical volume size! skipping 
> volume creation.\n";
>                 next;
>             }
> +            if ($lv_size eq '*') {
> +                $lv_size = '-l100%FREE';
> +            } else {
> +                $lv_size = '-L' . $lv_size;
> +            }
>             # Get additional options (expressed in lvcreate format) -AR-
>             my $lv_options = $lv->{lv_options};
>             unless (defined($lv_options)) {
> @@ -1118,7 +1123,7 @@
>             }
>
>             # Create the logical volume -AR-
> -            $cmd = "lvcreate $lv_options -L${lv_size} -n $lv_name 
> $group_name || shellout";
> +            $cmd = "lvcreate $lv_options $lv_size -n $lv_name $group_name || 
> shellout";
>             print $out qq(logmsg "$cmd"\n);
>             print $out "$cmd\n";

Andrea,

I think your patch will work just fine for my needs, though perhaps 
some folks might like the ability to define logical volume size by 
extents.  Here is a patch against 3.8.2 - let me know what you think.

Frank





--- Server.pm-orig      2007-10-10 08:20:41.000000000 -0400
+++ Server.pm   2007-10-10 08:38:02.000000000 -0400
@@ -1104,10 +1104,18 @@
              }
              # Get logical volume size -AR-
              my $lv_size = $lv->{size};
-            unless (defined($lv_size)) {
+            my $lv_extent = $lv->{extent};
+            my $lv_vsize;
+            if (!defined($lv_size) && !defined($lv_extent)) {
                  print "WARNING: undefined logical volume size! 
skipping volume
creation.\n";
                  next;
              }
+            if (defined($lv_size)) {
+              $lv_vsize = "-L${lv_size}";
+            } else {
+              $lv_vsize = "-l${lv_extent}";
+            }
+
              # Get additional options (expressed in lvcreate format) 
-AR-
              my $lv_options = $lv->{lv_options};
              unless (defined($lv_options)) {
@@ -1115,7 +1123,7 @@
              }

              # Create the logical volume -AR-
-            $cmd = "lvcreate $lv_options -L${lv_size} -n $lv_name 
$group_name |
| shellout";
+            $cmd = "lvcreate $lv_options $lv_vsize -n $lv_name 
$group_name || s
hellout";
              print $out qq(logmsg "$cmd"\n);
              print $out "$cmd\n";

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
sisuite-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisuite-users

Reply via email to