home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
root
/
usr
/
share
/
YaST2
/
include
/
partitioning
/
target_modify.ycp
< prev
Wrap
Text File
|
2006-11-29
|
2KB
|
82 lines
/**
* Module: target_modify.ycp
*
* Authors: Thomas Fehr (fehr@suse.de)
* Michael Hager (mike@suse.de)
*
* Purpose:
* Start of new disk preparation
*
*
*
* $Id: target_modify.ycp 24036 2005-07-14 12:16:17Z arvin $
*/
{
textdomain "storage";
import "Directory";
import "Label";
import "Partitions";
import "Storage";
define void RemoveUsedNonEvmsDm( map<string,map> target )
``{
boolean ret = true;
map<string,map> tg = filter( string k, map e, target,
``(find(k,"/dev/evms")!=0));
y2milestone( "RemoveUsedNonEvmsDm tg %1", tg );
list<map> dlist = [];
foreach( string k, map e, tg,
``{
foreach( map p, e["partitions"]:[],
``{
if( size(p["mount"]:"")>0 ||
p["used_by_type"]:`UB_NONE==`UB_NONE ||
p["used_by_type"]:`UB_NONE==`UB_EVMS )
{
dlist = add( dlist, p );
}
});
});
y2milestone( "RemoveUsedNonEvmsDm dlist %1", dlist );
foreach( map p, dlist,
``{
string dmmap = substring( p["device"]:"", 5 );
string cmd = sformat( "dmsetup info %1", dmmap );
y2milestone( "RemoveUsedNonEvmsDm executed %1 ret %2", cmd,
SCR::Execute( .target.bash_output, cmd ));
cmd = sformat( "dmsetup remove %1", dmmap );
y2milestone( "RemoveUsedNonEvmsDm executed %1 ret %2", cmd,
SCR::Execute( .target.bash_output, cmd ));
});
y2milestone( "RemoveUsedNonEvmsDm %1",
SCR::Execute( .target.bash_output, "/sbin/dmsetup ls" ));
}
define map<integer,map> HandleDeletedVgs( map<string,map> tg,
map<integer,map> modify_targets )
``{
y2milestone( "HandleDeletedVgs mod %1", modify_targets );
tg = filter( string dev, map disk, tg,
``(disk["type"]:`CT_UNKNOWN==`CT_LVM&&disk["delete"]:false));
y2milestone( "HandleDeletedVgs tg %1", tg );
foreach( string device, map disk, tg,
``{
if( size( filter( integer n, map p, modify_targets,
``(p["type"]:""=="remove_vg" &&
p["vgname"]:""==substring(device,5))))==0 )
{
modify_targets[size(modify_targets)+1] =
$[ "use_module" : "lvm_ll",
"type" : "remove_vg",
"vgname" : substring(device,5) ];
}
});
y2milestone( "HandleDeletedVgs ret %1", modify_targets );
return( modify_targets );
}
}