[yast-commit] r62829 - in /trunk/packager: VERSION package/yast2-packager.changes src/modules/Packages.ycp src/modules/SpaceCalculation.ycp
Author: lslezak Date: Thu Nov 11 18:35:05 2010 New Revision: 62829 URL: http://svn.opensuse.org/viewcvs/yast?rev=62829&view=rev Log: - fixed error handling for failed mounts, do not display negative disk space, allow installation in some cases (bnc#627969) - 2.20.11 Modified: trunk/packager/VERSION trunk/packager/package/yast2-packager.changes trunk/packager/src/modules/Packages.ycp trunk/packager/src/modules/SpaceCalculation.ycp Modified: trunk/packager/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/VERSION?rev=62829&r1=62828&r2=62829&view=diff ============================================================================== --- trunk/packager/VERSION (original) +++ trunk/packager/VERSION Thu Nov 11 18:35:05 2010 @@ -1 +1 @@ -2.20.10 +2.20.11 Modified: trunk/packager/package/yast2-packager.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.changes?rev=62829&r1=62828&r2=62829&view=diff ============================================================================== --- trunk/packager/package/yast2-packager.changes (original) +++ trunk/packager/package/yast2-packager.changes Thu Nov 11 18:35:05 2010 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Thu Nov 11 17:14:29 UTC 2010 - lslezak@suse.cz + +- fixed error handling for failed mounts, do not display negative + disk space, allow installation in some cases (bnc#627969) +- 2.20.11 + +------------------------------------------------------------------- Wed Nov 10 17:20:53 UTC 2010 - lslezak@suse.cz - update the number of the remaining packages when package Modified: trunk/packager/src/modules/Packages.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/Packages.ycp?rev=62829&r1=62828&r2=62829&view=diff ============================================================================== --- trunk/packager/src/modules/Packages.ycp (original) +++ trunk/packager/src/modules/Packages.ycp Thu Nov 11 18:35:05 2010 @@ -465,6 +465,54 @@ ret["warning"] = ret["warning"]:"" + warning; } +// list of basic system directories, if any of them cannot be mounted +// the installation will be blocked +const list<string> basic_dirs = ["/", "/bin", "/boot", "/etc", "/lib", "/lib64", + "/opt", "/sbin", "/usr", "/var"]; + +map AddFailedMounts(map summary) +{ + list<map> failed_mounts = SpaceCalculation::GetFailedMounts(); + y2milestone("Failed mounts: %1: %2", size(failed_mounts), failed_mounts); + + foreach(map failed_mount, failed_mounts, + { + string delim = (size(summary["warning"]:"") > 0) ? "<BR>" : ""; + + if (contains(basic_dirs, failed_mount["mount"]:"")) + { + summary["warning"] = summary["warning"]:"" + delim + + // error message: %1: e.g. "/usr", %2: "/dev/sda2" + sformat(_("Error: Cannot check free space in basic directory %1 (device %2), cannot start installation."), + failed_mount["mount"]:"", + failed_mount["device"]:""); + + // we could not mount a basic directory, this indicates + // a severe problem in partition setup + summary["warning_level"] = `blocker; + } + else + { + summary["warning"] = summary["warning"]:"" + delim + + // error message: %1: e.g. "/local", %2: "/dev/sda2" + sformat(_("Warning: Cannot check free space in directory %1 (device %2)."), + failed_mount["mount"]:"", + failed_mount["device"]:""); + + // keep blocker, fatal and error level, they are higher than warning + if (!contains([`blocker, `fatal, `error], summary["warning_level"]:`ok)) + { + summary["warning_level"] = `warning; + } + } + } + ); + + y2milestone("Proposal summary: %1", summary); + + return summary; +} + /** * Print the installatino proposal summary * @param flags a list of symbols, see above @@ -528,6 +576,9 @@ } } + // add failed mounts + ret = AddFailedMounts(ret); + // FATE #304488 if (Mode::update()) CheckOldAddOns (ret); Modified: trunk/packager/src/modules/SpaceCalculation.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/SpaceCalculation.ycp?rev=62829&r1=62828&r2=62829&view=diff ============================================================================== --- trunk/packager/src/modules/SpaceCalculation.ycp (original) +++ trunk/packager/src/modules/SpaceCalculation.ycp Thu Nov 11 18:35:05 2010 @@ -28,6 +28,7 @@ boolean info_called = false; // list partition_info already initialized? list partition_info = []; // information about available partitions + list<map> failed_mounts = []; /* * Return partition info list @@ -37,6 +38,11 @@ return partition_info; } + global define list<map> GetFailedMounts() + { + return failed_mounts; + } + /** * Get mountpoint for a directory * @param target directory @@ -262,6 +268,9 @@ } // !Stage::initial () + // remove the previous failures + failed_mounts = []; + // installation stage - Storage:: is definitely present // call Storage::GetTargetMap() map<string, map> targets = (map<string, map>)WFM::call("wrapper_storage", ["GetTargetMap"]); @@ -286,6 +295,8 @@ foreach( map part, part_info, ``{ + y2milestone("Adding partition: %1", part); + symbol used_fs = part["used_fs"]:`unknown; // ignore VFAT and NTFS partitions (bnc#) @@ -337,22 +348,33 @@ y2milestone("Executing mount command: %1", mount_command); - SCR::Execute(.target.bash, mount_command); + integer result = (integer)SCR::Execute(.target.bash, mount_command); + y2milestone("Mount result: %1", result); - list<map<string,string> > partition = - (list<map<string, string> >) - SCR::Read(.run.df); - foreach (map p, partition, { - if (p["name"]:"" == tmpdir) - { - y2internal ("P: %1", p); - free_size = tointeger (p["free"]:"0") - * 1024; - used = tointeger (p["used"]:"0") * 1024; - } - }); - SCR::Execute (.target.bash, sformat ( - "/bin/umount %1", tmpdir)); + if (result == 0) + { + list<map<string,string> > partition = + (list<map<string, string> >) + SCR::Read(.run.df); + foreach (map p, partition, { + if (p["name"]:"" == tmpdir) + { + y2internal ("P: %1", p); + free_size = tointeger (p["free"]:"0") + * 1024; + used = tointeger (p["used"]:"0") * 1024; + } + }); + SCR::Execute (.target.bash, sformat ( + "/bin/umount %1", tmpdir)); + } + else + { + y2error("Mount failed, ignoring partition %1", part["device"]:""); + failed_mounts = add(failed_mounts, part); + + continue; + } } // convert into kB for TargetInitDU -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn2.opensuse.org