Andrea,
I see what your at here...
If you try to use the $flags variable in the sections just above, does it not do the right thing?
If it does, then I think that would be a cleaner way to go.
If it doesn't, then go ahead and commit this.
And can you send an example autoinstallscript.conf && master.script with the code you decide on?
Thanks, -Brian
Andrea Righi wrote:
This patch adds the commands to retrieve the lvm group that every partition belongs (if the partition is assigned to an lvm group).
Unfortunately I've had to add the $disk argument to the function _print_to_auto_install_conf_file()... I've not found any other way...
IMHO it could a good solution if we specify the lvm group belongings with an attribute of the <part> tag, instead of creating a new tag and a new function (expecially for the clarity of xml schema syntax!).
What do you think? if you like this I will commit this changes...
Bye, -Andrea
Brian Elliott Finley wrote:
Andrea,
Looks good to me. let's go with that, and modify later if necessary.
Cheers, -Brian
Andrea Righi wrote:
This is another configuration that doesn't correspond to the autoinstallscript.conf definition... but the differences are only in the sizes.
# sfdisk -l -uM /dev/sda
Disk /dev/sda: 4425 cylinders, 255 heads, 63 sectors/track
Units = megabytes of 1048576 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End MB #blocks Id System /dev/sda1 * 0+ 101- 102- 104391 83 Linux /dev/sda2 101+ 2157- 2056- 2104515 82 Linux swap /dev/sda3 2157+ 34710- 32554- 33334875 8e Linux LVM /dev/sda4 0 - 0 0 0 Empty
# parted -s /dev/sda print Disk geometry for /dev/sda: 0.000-34713.745 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.031 101.975 primary ext2 boot, type=83 2 101.975 2157.165 primary linux-swap type=82 3 2157.166 34710.754 primary lvm, type=8e
Then... if you want to get a volume groups / logical volumes list from a working machine you must use 'vgscan' and 'lvscan' commands...
Bye, Andrea
Brian Elliott Finley wrote:
Andrea Righi wrote:
Hi all,
here is a new patch for the LVM stuff (made from the CVS source). I've added also the commands to create LVM groups.
Before to continue the development I'd like to know what do you think about an opportune syntax to express and define LVM volumes, groups, etc... For now I've tried to use a syntax to integrate this features as easy as possible in the XML schema.
I'll have to think about that one. I think what you've got below makes sense.
Can you send the output from 'parted /dev/sda print' and 'sfdisk -l -uM /dev/sda'.
Cheers, -Brian
This is the definition of the tags I've used:
--- Disk Section ... part - ... ... lvm_group - name of the LVM group the partition will be added.
LVM Section
This section is used to create LVM groups and volumes. The section is indicated with the "lvm" tag.
lvm_group - LVM group definition. name - volume group name. lv - start information about a new logical volume. name - logical volume name. size - the size of the logical volume. ---
And this is an example of a possible autoinstallscript.conf with LVM decalarations:
---
<disk dev="/dev/sda" label_type="msdos" unit_of_measurement="MB">
<part num="1" size="24" p_type="primary" fs="ext2" p_name="-" flags="-" />
<part num="2" size="256" p_type="primary" fs="linux-swap" p_name="-" flags="-" />
<part num="3" size="3000" p_type="primary" p_name="-" flags="lvm" lvm_group="user" />
<part num="4" size="end_of_disk" p_type="primary" p_name="-" flags="lvm" lvm_group="system" />
</disk>
<disk dev="/dev/sdb" label_type="msdos" unit_of_measurement="MB">
<part num="1" size="1500" p_type="primary" fs="ext2" p_name="-" flags="-" />
<part num="2" size="1500" p_type="primary" p_name="-" flags="lvm" lvm_group="system" />
<part num="3" size="end_of_disk" p_type="primary" p_name="-" flags="lvm" lvm_group="user" />
</disk>
<lvm>
<lvm_group name="system">
<lv name="usrlv" size="500" />
<lv name="optlv" size="1500" />
<lv name="varlv" size="256" />
</lvm_group>
<lvm_group name="user">
<lv name="homelv" size="5000" fs="xfs" mp="/home" options="defaults,rw,user" />
<lv name="scratchlv" size="2000" fs="xfs" mp="/scratch" options="defaults,rw,user" />
</lvm_group>
</lvm>
<fsinfo line="10" real_dev="/dev/sdb1" mp="/" fs="ext3" options="defaults,errors=remount-ro" />
<fsinfo line="20" real_dev="/dev/sda1" mp="/boot" fs="ext3" options="defaults,ro,noexec" dump="0" pass="2" />
<fsinfo line="30" real_dev="/dev/system/usrlv" fs="ext3" mp="/usr" options="defaults,rw,user,exec" />
<fsinfo line="40" real_dev="/dev/system/optlv" fs="reiserfs" mp="/opt" options="defaults,rw,user" />
<fsinfo line="50" real_dev="/dev/system/varlv" fs="ext3" mp="/var" options="defaults,rw,user,noexec" />
<fsinfo line="60" real_dev="/dev/user/homelv" fs="xfs" mp="/home" options="defaults,rw,user,exec" />
<fsinfo line="70" real_dev="/dev/system/scratchlv" fs="ext3" mp="/scratch" options="defaults,rw,user,noexec" />
<fsinfo line="80" real_dev="/dev/fd0" mp="/floppy" fs="auto" options="defaults,user,noauto" dump="0" pass="0" format="no" />
<fsinfo line="90" real_dev="proc" mp="/proc" fs="proc" options="defaults" dump="0" pass="0" />
---
Regards, -Andrea
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Sisuite-devel mailing list Sisuite-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sisuite-devel
------------------------------------------------------------------------
--- lib/SystemImager/Common.pm~ 2005-01-28 09:47:21.000000000 +0100
+++ lib/SystemImager/Common.pm 2005-01-28 09:57:29.000000000 +0100
@@ -450,7 +450,7 @@
unless($id) { $id=""; }
- _print_to_auto_install_conf_file( $minor, $size, $partition_type, $id, $name, $flags );
+ _print_to_auto_install_conf_file( $disk, $minor, $size, $partition_type, $id, $name, $flags );
}
@@ -710,7 +710,7 @@
$size = "*";
}
- _print_to_auto_install_conf_file( $minor, $size, $partition_type, $id, $name, $flags );
+ _print_to_auto_install_conf_file( $disk, $minor, $size, $partition_type, $id, $name, $flags );
}
}
@@ -718,10 +718,10 @@
# Usage:
-# _print_to_auto_install_conf_file($minor, $startMB, $endMB, $partition_type, $id, $name, $flags);
+# _print_to_auto_install_conf_file($disk, $minor, $startMB, $endMB, $partition_type, $id, $name, $flags);
sub _print_to_auto_install_conf_file {
- my ($minor, $size, $partition_type, $id, $name, $flags) = @_;
+ my ($disk, $minor, $size, $partition_type, $id, $name, $flags) = @_;
# Name may not be set in some cases.
unless ($name) { $name = "-"; }
@@ -742,6 +742,28 @@
("$id" eq "41") # 41 PPC PReP Boot ) {
print DISK_FILE qq( id="$id");
+ } elsif (
+ ("$id" eq "8e") # LVM partition needs lvm_group attribute -AR-
+ ) {
+ my $part;
+ $_ = "$disk";
+ if ((m|\S/(c[0-9]+d[0-9]+)|) or (m|\S/ar[0-9]+/|) or (m|\S/ataraid/|)) {
+ # Hardware RAID device -AR-
+ $part = '/dev/' . $disk . 'p' . $minor;
+ } else {
+ # Standard block device -AR-
+ $part = '/dev/' . $disk . $minor;
+ }
+ # Get physical volume information -AR-
+ my $cmd = "pvs --noheadings --separator : /dev/$part 2>/dev/null";
+ open (PV_INFO, "$cmd|");
+ unless (eof(PV_INFO)) {
+ my @pv_data = split(/:/, <PV_INFO>);
+ my $vg_name = $pv_data[1];
+ # This partition will become part to the volume group $vg_name -AR-
+ print DISK_FILE qq( lvm_group="$vg_name");
+ }
+ close(PV_INFO);
}
print DISK_FILE qq( />\n);
}
-- ------------------------------------------------------ Brian Elliott Finley Mobile: 630.631.6621 gpg --keyserver wwwkeys.pgp.net --recv-keys 10F8EE52 ------------------------------------------------------
------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Sisuite-devel mailing list Sisuite-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sisuite-devel