Author: ug
Date: Thu Mar 29 11:10:12 2012
New Revision: 67734
URL: http://svn.opensuse.org/viewcvs/yast?rev=67734&view=rev
Log:
device guessing code in autoyast can ignore configured devices now (patch is in SP2)
Modified:
branches/SuSE-Code-11-SP2-Branch/autoinstallation/VERSION
branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes
branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/clients/ayast_probe.ycp
branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/modules/AutoinstStorage.ycp
Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoinstallation/VERSION?rev=67734&r1=67733&r2=67734&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/autoinstallation/VERSION (original)
+++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/VERSION Thu Mar 29 11:10:12 2012
@@ -1 +1 @@
-2.17.56
+2.17.57
Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes?rev=67734&r1=67733&r2=67734&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes (original)
+++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/package/autoyast2.changes Thu Mar 29 11:10:12 2012
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Wed Jan 4 17:36:34 CET 2012 - ug@suse.de
+
+- the device guessing code in autoyast can ignore configured
+ devices now - like USB sticks (bnc#736530)
+- 2.17.57
+
+-------------------------------------------------------------------
Mon Jan 2 12:54:54 CET 2012 - ug@suse.de
- ask-dialog for password displays too small field for password
Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/clients/ayast_probe.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/clients/ayast_probe.ycp?rev=67734&r1=67733&r2=67734&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/clients/ayast_probe.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/clients/ayast_probe.ycp Thu Mar 29 11:10:12 2012
@@ -12,6 +12,7 @@
{
import "Stage";
+ import "Storage";
Stage::Set( "initial" );
import "AutoInstallRules";
import "Label";
@@ -50,6 +51,18 @@
text = text + sformat("<tr><td>%1</td><td> = </td><td>%2<br></td></tr>",k,v);
});
text = text + "</table>";
+ text = text + "<h3>Storage Data</h3>";
+
+ map tm = Storage::GetTargetMap();
+
+ foreach( string k, map v, tm, ``{
+ text = text + "<h2>" + k + "</h2><table>";
+ foreach( string key, any value, (map)v, ``{
+ text = sformat("%1<tr><td>%2</td><td> = </td><td>%3<br></td></tr>", text, key, value);
+ });
+ text = text + "</table>";
+ });
+
UI::OpenDialog( `opt(`defaultsize),
`VBox(
`RichText( text ),
Modified: branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/modules/AutoinstStorage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/modules/AutoinstStorage.ycp?rev=67734&r1=67733&r2=67734&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/modules/AutoinstStorage.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/autoinstallation/src/modules/AutoinstStorage.ycp Thu Mar 29 11:10:12 2012
@@ -45,6 +45,9 @@
// some architectures need a boot partition. Do we have one?
global boolean planHasBoot = false;
+ // list of devices to ignore when guessing devices
+ global list<string> tabooDevices = [];
+
/**
* Function sets internal variable, which indicates, that any
* settings were modified, to "true"
@@ -88,9 +91,12 @@
string mbr_disk = "";
if( after == "" ) {
foreach (string device, map disk, initial_target_map, ``{
- if (disk["type"]:`jo == `CT_DMRAID ||
- disk["type"]:`jo == `CT_MDPART ||
- disk["type"]:`jo == `CT_DMMULTIPATH)
+ if (
+ ( disk["type"]:`jo == `CT_DMRAID ||
+ disk["type"]:`jo == `CT_MDPART ||
+ disk["type"]:`jo == `CT_DMMULTIPATH ) &&
+ !contains( tabooDevices, device )
+ )
{
mbr_disk = device;
}
@@ -99,7 +105,7 @@
if( after == "" && mbr_disk == "" ) {
foreach (string device, map disk, initial_target_map, ``{
- if (disk["bios_id"]:"" == "0x80")
+ if (disk["bios_id"]:"" == "0x80" && !contains( tabooDevices, device ) )
{
mbr_disk = device;
}
@@ -110,7 +116,7 @@
if( mbr_disk == "" ) {
foreach (string device, map disk, initial_target_map, ``{
if( disk["type"]:`x == `CT_DISK ) {
- if( device == after )
+ if( device == after || contains( tabooDevices, device ) )
continue;
mbr_disk = device;
break;
@@ -507,6 +513,80 @@
d["partitions"] = sort( map x, map y, d["partitions"]:[], ``( x["partition_nr"]:99 < y["partition_nr"]:99 ));
return d;
});
+
+ // fill tabooDevice list with devices to ignore
+ map initial_target_map = Storage::GetTargetMap();
+ foreach ( map drive, settings, ``{
+ if( drive["device"]:"" != "" ) {
+ // if <device> is set, it can not end in the taboo list
+ continue;
+ }
+
+ /* XML example
+ <drive>
+
+ <listentry>
+ driver
+ usb-storage
+ </listentry>
+ <listentry>
+ size_k
+ 1048576
+ true
+ </listentry>
+
+ ...
+ */
+ foreach (string device, map disk, initial_target_map, ``{
+ foreach( map toSkip, drive["skip_list"]:[], ``{
+ string skipKey = toSkip["skip_key"]:"__missing_key__";
+ string skipType = "";
+
+ if( is(disk[skipKey]:nil, string) )
+ skipType = "string";
+ else if( is(disk[skipKey]:nil, integer) )
+ skipType = "integer";
+ else if( is(disk[skipKey]:nil, symbol) )
+ skipType = "symbol";
+ else
+ y2error("skipKey '%1' is of unknown type. Will be ignored.", skipKey);
+
+ if( skipType == "string" ) {
+ string skipValue = toSkip["skip_value"]:"__missing__";
+ if( disk[skipKey]:"__not_found__" == skipValue ) {
+ tabooDevices = add( tabooDevices, device );
+ y2milestone("%1 added to device taboo list (%2 == %3)", device, skipKey, skipValue);
+ break;
+ }
+ } else if( skipType == "integer" ) {
+ integer skipValue = tointeger(toSkip["skip_value"]:"0");
+ boolean skipValueLess = toSkip["skip_if_less_than"]:false;
+ boolean skipValueMore = toSkip["skip_if_more_than"]:false;
+ boolean skipValueEqual = toSkip["skip_if_equal"]:true;
+ if( skipValueLess && disk[skipKey]:0 < skipValue ) {
+ tabooDevices = add( tabooDevices, device );
+ y2milestone("%1 added to device taboo list (%2 < %3)", device, disk[skipKey]:0, skipValue );
+ } else if( skipValueMore && disk[skipKey]:0 > skipValue ) {
+ tabooDevices = add( tabooDevices, device );
+ y2milestone("%1 added to device taboo list (%2 > %3)", device, disk[skipKey]:0, skipValue );
+ }
+ if( skipValueEqual && disk[skipKey]:0 == skipValue ) {
+ tabooDevices = add( tabooDevices, device );
+ y2milestone("%1 added to device taboo list (%2 == %3)", device, skipKey, skipValue);
+ break;
+ }
+ } else if( skipType == "symbol" ) {
+ string skipValue = toSkip["skip_value"]:"`nothing";
+ if( sformat("%1",disk[skipKey]:`nothing) == skipValue ) {
+ tabooDevices = add( tabooDevices, device );
+ y2milestone("%1 added to device taboo list (%2 == %3)", device, skipKey, skipValue);
+ break;
+ }
+ }
+ });
+ });
+ });
+
settings = udev2dev(settings);
settings = mountBy(settings);
settings = region4resize(settings);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org