[yast-commit] r67832 - in /trunk/storage: package/ storage/src/include/
Author: aschnell Date: Thu Mar 29 18:34:11 2012 New Revision: 67832 URL: http://svn.opensuse.org/viewcvs/yast?rev=67832&view=rev Log: - improved mount checks and feedback during resize (bnc#732766) Modified: trunk/storage/package/yast2-storage.changes trunk/storage/storage/src/include/custom_part_check_generated.ycp trunk/storage/storage/src/include/custom_part_dialogs.ycp trunk/storage/storage/src/include/custom_part_lib.ycp trunk/storage/storage/src/include/ep-dialogs.ycp Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=67832&r1=67831&r2=67832&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Thu Mar 29 18:34:11 2012 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Thu Mar 29 18:30:25 CEST 2012 - aschnell@suse.de + +- improved mount checks and feedback during resize (bnc#732766) + +------------------------------------------------------------------- Thu Mar 29 12:14:35 CEST 2012 - fehr@suse.de - patch proofread text back into ycp Modified: trunk/storage/storage/src/include/custom_part_check_generated.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_check_generated.ycp?rev=67832&r1=67831&r2=67832&view=diff ============================================================================== --- trunk/storage/storage/src/include/custom_part_check_generated.ycp (original) +++ trunk/storage/storage/src/include/custom_part_check_generated.ycp Thu Mar 29 18:34:11 2012 @@ -585,49 +585,10 @@ if( !installation ) { - string mounts = Storage::DeviceMounted( part_name ); - if( mounts != "" ) - { - // popup text %1 is directory name - string message = sformat(_("The selected device is currently mounted on %1. -We *strongly* recommend to unmount it manually -before deleting it. - -Click Cancel unless you know exactly what you are doing. - -If you proceed, YaST will try unmounting before deleting it. -"), mounts ); - - - if( !Popup::ContinueCancel(message)) - { - return false; - } - else - { - symbol ret = `none; - do - { - if( !Storage::Umount( part_name ) ) - { - // popup text %1 is directory name - message = sformat(_("Unmount of %1 failed. -Remove the device anyway? -"), mounts ); - ret = Popup::AnyQuestion3( Label::WarningMsg(), message, - Label::YesButton(), - Label::NoButton(), - // button text - _("&Retry umount"), - `focus_yes ); - } - } - while( ret == `retry ); - if( ret == `no ) - return false; - } - } + if (!TryUmount(part_name, _("It cannot be deleted while mounted."), true)) + return false; } + if( !installation && curr_part["type"]:`unknown==`logical ) { boolean ok = true; Modified: trunk/storage/storage/src/include/custom_part_dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_dialogs.ycp?rev=67832&r1=67831&r2=67832&view=diff ============================================================================== --- trunk/storage/storage/src/include/custom_part_dialogs.ycp (original) +++ trunk/storage/storage/src/include/custom_part_dialogs.ycp Thu Mar 29 18:34:11 2012 @@ -1102,18 +1102,6 @@ return( ret ); } -define void FsysCannotResizeMountPopup( boolean lvm, string mount ) - ``{ - // %1 is either replaced by "logical volume" or by "partition" - string txt = sformat( _(" -The file system is currently mounted on %1. -It is not possible to resize the file system while it is mounted. - -Unmount the file system and retry resizing. -"), - mount ); - Popup::Error( txt ); - } define boolean FsysShrinkReiserWarning( boolean lvm ) ``{ Modified: trunk/storage/storage/src/include/custom_part_lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_lib.ycp?rev=67832&r1=67831&r2=67832&view=diff ============================================================================== --- trunk/storage/storage/src/include/custom_part_lib.ycp (original) +++ trunk/storage/storage/src/include/custom_part_lib.ycp Thu Mar 29 18:34:11 2012 @@ -820,30 +820,81 @@ } -define boolean CheckResizePossible( boolean ask, boolean lvm, integer resize, - symbol fsys, string mount ) - ``{ - map poss = FileSystems::IsResizable( fsys ); +boolean TryUmount(string device, string text, boolean allow_ignore) +{ + while (true) + { + string mountpoint = Storage::DeviceMounted(device); + if (isempty(mountpoint)) + return true; + + if (allow_ignore) + { + string full_text = sformat(_("The file system is currently mounted on %1."), mountpoint) + "\n\n" + + _("You can try to unmount it now, continue without unmounting or cancel. +Click Cancel unless you know exactly what you are doing."); + + symbol ret = Popup::AnyQuestion3(Label::WarningMsg(), full_text, + Label::ContinueButton(), + Label::CancelButton(), + // button text + _("Unmount"), + `focus_no); + + if (ret == `no) + return false; + + if (ret == `yes) + return true; + } + else + { + string full_text = sformat(_("The file system is currently mounted on %1."), mountpoint) + "\n\n" + + _("You can try to unmount it now or cancel. +Click Cancel unless you know exactly what you are doing."); + + boolean ret = Popup::AnyQuestion(Label::WarningMsg(), full_text, + // button text + _("Unmount"), + Label::CancelButton(), `focus_no); + + if (ret == false) + return false; + } + + if (Storage::Umount(device)) + return true; + } +} + + +boolean CheckResizePossible(string device, boolean ask, boolean lvm, integer resize, + symbol fsys) +{ + map<string, boolean> poss = FileSystems::IsResizable(fsys); + string mountpoint = Storage::DeviceMounted(device); + boolean ret = true; - y2milestone( "CheckResizePossible resize %1 ask %2 lvm %3 fsys %4 mount %5", - resize, ask, lvm, fsys, mount ); - if( size(mount)>0 && !Stage::initial() && resize < 0 && + y2milestone("CheckResizePossible device:%1 ask:%2 lvm:%3 resize:%4 fsys:%5", + device, ask, lvm, resize, fsys); + + if( !isempty(mountpoint) && !Stage::initial() && resize < 0 && !poss["mount_shrink"]:false && poss["shrink"]:false ) { - FsysCannotResizeMountPopup( lvm, mount ); - ret = false; + if (!TryUmount(device, _("It is not possible to shrink the file system while it is mounted."), true)) + ret = false; } - else if( size(mount)>0 && !Stage::initial() && resize > 0 && + else if( !isempty(mountpoint) && !Stage::initial() && resize > 0 && !poss["mount_extend"]:false && poss["extend"]:false ) { - FsysCannotResizeMountPopup( lvm, mount ); - ret = false; + if (!TryUmount(device, _("It is not possible to extend the file system while it is mounted."), true)) + ret = false; } - else if( size(mount)>0 && !Stage::initial() && resize != 0 && !lvm ) + else if( !isempty(mountpoint) && !Stage::initial() && resize != 0 && !lvm ) { - FsysCannotResizeMountPopup( lvm, mount ); - ret = false; + if (!TryUmount(device, _("It is not possible to resize the file system while it is mounted."), true)) + ret = false; } else if( resize < 0 && !poss["shrink"]:false ) { @@ -858,8 +909,7 @@ ret = FsysCannotGrowPopup( ask, lvm ); } y2milestone( "ret %1", ret ); - return( ret ); - } - + return ret; +} } Modified: trunk/storage/storage/src/include/ep-dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-dialogs.ycp?rev=67832&r1=67831&r2=67832&view=diff ============================================================================== --- trunk/storage/storage/src/include/ep-dialogs.ycp (original) +++ trunk/storage/storage/src/include/ep-dialogs.ycp Thu Mar 29 18:34:11 2012 @@ -648,19 +648,22 @@ return false; } - integer cyl_size = 0; integer free_cyl_after = 0; string device = data["device"]:"error"; symbol used_fs = data["used_fs"]:`none; - integer used_k = FileSystems::MinFsSizeK(used_fs); + if (!data["format"]:false) { if (used_fs != `swap) { + if (used_fs == `ntfs && !TryUmount(device, _("It is not possible to check whether a NTFS +can be resized while it is mounted."), false)) + return false; + map free_data = Storage::GetFreeSpace(device, used_fs, true); if (isempty(free_data) || !free_data["ok"]:false) { @@ -834,12 +837,11 @@ if (size_k != old_size_k) { - string mountpoint = data["inactive"]:false ? "" : data["mount"]:""; + string mountpoint = Storage::DeviceMounted(device); boolean lvm = data["type"]:`unknown == `lvm; - //1 - ask & be interactive, 2 - we are on lvm, 3 - cyl.diff, 4 - filesystem, 5 - mountpoint if (!data["format"]:false && - !CheckResizePossible(false, lvm, size_k - old_size_k, used_fs, mountpoint)) + !CheckResizePossible(device, false, lvm, size_k - old_size_k, used_fs)) { //FIXME: To check whether the part. can be resized only //after user tries to do that is stupid - in some cases -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
aschnell@svn2.opensuse.org