Author: ug
Date: Fri Oct 26 14:22:26 2007
New Revision: 41593
URL: http://svn.opensuse.org/viewcvs/yast?rev=41593&view=rev
Log:
reuse of LVM and EVMS fixed (#335763)
Modified:
branches/SuSE-SLE-10-SP2-Branch/autoinstallation/package/autoyast2.changes
branches/SuSE-SLE-10-SP2-Branch/autoinstallation/src/modules/AutoinstLVM.ycp
Modified: branches/SuSE-SLE-10-SP2-Branch/autoinstallation/package/autoyast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/autoinstallation/package/autoyast2.changes?rev=41593&r1=41592&r2=41593&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP2-Branch/autoinstallation/package/autoyast2.changes (original)
+++ branches/SuSE-SLE-10-SP2-Branch/autoinstallation/package/autoyast2.changes Fri Oct 26 14:22:26 2007
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Fri Oct 26 14:21:36 CEST 2007 - ug@suse.de
+
+- reuse of LVM and EVMS fixed (#335763)
+
+-------------------------------------------------------------------
Tue Aug 7 16:40:36 CEST 2007 - ug@suse.de
- no frame if no frametitle is defined in ask-questions
Modified: branches/SuSE-SLE-10-SP2-Branch/autoinstallation/src/modules/AutoinstLVM.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/autoinstallation/src/modules/AutoinstLVM.ycp?rev=41593&r1=41592&r2=41593&view=diff
==============================================================================
--- branches/SuSE-SLE-10-SP2-Branch/autoinstallation/src/modules/AutoinstLVM.ycp (original)
+++ branches/SuSE-SLE-10-SP2-Branch/autoinstallation/src/modules/AutoinstLVM.ycp Fri Oct 26 14:22:26 2007
@@ -34,6 +34,10 @@
global list<string> ExistingVGs = [];
+ global map keepLVM = $[];
+ global map keepEVMS = $[];
+
+
// LVM map as imported from Profile
global map lvm = $[];
@@ -90,8 +94,37 @@
return (substring(d, 5) );
});
+ /* look for VGs to reuse */
+ foreach ( string k, map v, AutoinstStorage::AutoTargetMap, ``{
+ foreach ( map p, v["partitions"]:[], ``{
+ if( haskey( p, "lvm_group" ) && p["create"]:true == false ) {
+ keepLVM[p["lvm_group"]:"x"] = [];
+ if( !contains( ExistingVGs, p["lvm_group"]:"x" ) )
+ Report::Error( sformat( _("can't reuse volume group %1. The volume group does not exist"), p["lvm_group"]:"x" ) );
+ map atm = AutoinstStorage::AutoTargetMap;
+ foreach ( map vg_p, atm["/dev/"+p["lvm_group"]:"x","partitions"]:[], ``{
+ if( vg_p["create"]:true == false )
+ keepLVM[p["lvm_group"]:"x"] = add( keepLVM[p["lvm_group"]:"x"]:[], vg_p["lv_name"]:"" );
+ });
+ } else if( haskey( p, "evms_group" ) && p["create"]:true == false ) {
+ keepEVMS[p["evms_group"]:"x"] = [];
+ if( !contains( ExistingVGs, "evms/lvm2/"+p["evms_group"]:"x" ) )
+ Report::Error( sformat( _("can't reuse volume group %1. The volume group does not exist"), p["evms_group"]:"x" ) );
+ map atm = AutoinstStorage::AutoTargetMap;
+ foreach ( map vg_p, atm["/dev/"+p["evms_group"]:"x","partitions"]:[], ``{
+ if( vg_p["create"]:true == false )
+ keepEVMS[p["evms_group"]:"x"] = add( keepEVMS[p["evms_group"]:"x"]:[], vg_p["lv_name"]:"" );
+ });
+ }
+ });
+ });
+
+
+
y2milestone("Existing VGs: %1", ExistingVGs );
y2milestone("Existing LVM: %1", ExistingLVM);
+ y2milestone("keep LVM: %1", keepLVM);
+ y2milestone("keep EVMS: %1", keepEVMS);
symbol dropType = ( vmType == `CT_LVM ? `CT_EVMS : `CT_LVM );
@@ -99,13 +132,16 @@
// and vice versa
// it's not possible to mix LVM and EVMS with autoyast
//
+ // FIXME: code dropped because EVMS looks like LVM too
+ // reusing EVMS fails then!
+ /*
map toDrop = filter(string k, map v, Storage::GetTargetMap(), ``(v["type"]:`CT_UNKNOWN==dropType));
foreach (string device, map volume_group, toDrop , ``{
string vgname = substring(device, 5);
y2milestone("removing %1 %2",dropType,vgname);
removeVolumeGroup(vgname); // FIXME: I expect this to work recursive
});
-
+*/
// FIXME
foreach (string v, ExistingVGs, ``{
@@ -185,16 +221,27 @@
y2milestone("Existing LVs: %1", lvs);
foreach(map lv, lvs, ``{
+/*
if (!contains(lvm["/dev/"+vgname, "keep_lv"]:[], lv["name"]:"")) {
removeLogicalVolume( "/dev/"+vgname,
"/dev/"+vgname+"/"+lv["name"]:"" ); //FIXME: does removeLogicalVolume work for EVMS?
}
- });
+*/
+ if (!contains(keepLVM[vgname]:[], lv["name"]:"")) {
+ removeLogicalVolume( "/dev/"+vgname,
+ "/dev/"+vgname+"/"+lv["name"]:"" ); //FIXME: does removeLogicalVolume work for EVMS?
+ }
+ });
+/*
if (size(lvm["/dev/"+vgname, "keep_lv"]:[]) == 0 &&
ExistingLVM["/dev/" +vgname]:$[] != $[]) {
removeVolumeGroup( vgname ); //FIXME: does removeVolumeGroup work for EVMS?
}
+*/
+ if( ! haskey( keepLVM, vgname ) && ExistingLVM["/dev/" +vgname]:$[] != $[] )
+ removeVolumeGroup( vgname ); //FIXME: does removeVolumeGroup work for EVMS?
+
return true;
}
@@ -435,11 +482,15 @@
list<map> lvlist = ExistingLVM[device, "partitions"]:[];
- if (contains(volume_group["keep_lv"]:[], lv["nr"]:"_error_")) {
+// if (contains(volume_group["keep_lv"]:[], lv["nr"]:"_error_")) {
+ if( contains(keepLVM[vgname]:[], lv["lv_name"]:"") ) {
list<map> lvtokeep = filter(map p, lvlist, ``(p["nr"]:"" == lv["lv_name"]:""));
map this_lv = lvtokeep[0]:$[];
y2milestone("Keeping LV: %1", this_lv);
+ y2milestone("lv = %1",lv);
+
+ lv["device"] = "/dev/"+vgname+"/"+lv["lv_name"]:"";
lv["used_fs"] = this_lv["used_fs"]:`reiser;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org