Author: aschnell Date: Fri Aug 1 10:57:04 2008 New Revision: 49562 URL: http://svn.opensuse.org/viewcvs/yast?rev=49562&view=rev Log: - Merged rest of part-design branch changes r44410:49561 into the trunk. Added: trunk/storage/storage/src/include/ep-all.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp trunk/storage/storage/src/include/ep-dialogs.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp trunk/storage/storage/src/include/ep-dm-dialogs.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm-dialogs.ycp trunk/storage/storage/src/include/ep-dm-lib.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm-lib.ycp trunk/storage/storage/src/include/ep-dm.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-dm.ycp trunk/storage/storage/src/include/ep-hd-dialogs.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp trunk/storage/storage/src/include/ep-hd-lib.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-lib.ycp trunk/storage/storage/src/include/ep-hd.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd.ycp trunk/storage/storage/src/include/ep-lib.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-lib.ycp trunk/storage/storage/src/include/ep-log.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-log.ycp trunk/storage/storage/src/include/ep-loop-dialogs.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-dialogs.ycp trunk/storage/storage/src/include/ep-loop-lib.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-lib.ycp trunk/storage/storage/src/include/ep-loop.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop.ycp trunk/storage/storage/src/include/ep-lvm-dialogs.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp trunk/storage/storage/src/include/ep-lvm-lib.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-lib.ycp trunk/storage/storage/src/include/ep-lvm.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm.ycp trunk/storage/storage/src/include/ep-main.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp trunk/storage/storage/src/include/ep-nfs.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-nfs.ycp trunk/storage/storage/src/include/ep-raid-dialogs.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-raid-dialogs.ycp trunk/storage/storage/src/include/ep-raid-lib.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-raid-lib.ycp trunk/storage/storage/src/include/ep-raid.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-raid.ycp trunk/storage/storage/src/include/ep-settings.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-settings.ycp trunk/storage/storage/src/include/ep-unused.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/ep-unused.ycp trunk/storage/storage/src/include/icons.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/include/icons.ycp trunk/storage/storage/src/modules/DevicesSelectionBox.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/modules/DevicesSelectionBox.ycp trunk/storage/storage/src/modules/DualMultiSelectionBox.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/modules/DualMultiSelectionBox.ycp trunk/storage/storage/src/modules/Greasemonkey.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/modules/Greasemonkey.ycp trunk/storage/storage/src/modules/MiniWorkflow.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/modules/MiniWorkflow.ycp trunk/storage/storage/src/modules/StorageFields.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/modules/StorageFields.ycp trunk/storage/storage/src/modules/StorageSettings.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/modules/StorageSettings.ycp trunk/storage/storage/src/modules/TabPanel.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/modules/TabPanel.ycp trunk/storage/storage/src/modules/TreePanel.ycp - copied unchanged from r49561, branches/tmp/aschnell/part-redesign/storage/src/modules/TreePanel.ycp Removed: trunk/storage/lvm/src/lvm_config.desktop Modified: trunk/storage/VERSION trunk/storage/configure.in.in trunk/storage/data/sysconfig.storage trunk/storage/disk/src/disk.ycp trunk/storage/disk/src/disk_worker.ycp trunk/storage/lvm/src/Makefile.am trunk/storage/package/yast2-storage.changes trunk/storage/storage/src/include/custom_part_dialogs.ycp trunk/storage/storage/src/include/lvm_lib.ycp trunk/storage/storage/src/include/lvm_lv_lib.ycp trunk/storage/storage/src/include/lvm_pv_lib.ycp trunk/storage/storage/src/include/partition_defines.ycp trunk/storage/storage/src/include/raid_lib.ycp trunk/storage/storage/src/inst_custom_part.ycp trunk/storage/storage/src/inst_disk.ycp trunk/storage/storage/src/modules/FileSystems.ycp trunk/storage/storage/src/modules/Makefile.am trunk/storage/storage/src/modules/Partitions.ycp trunk/storage/storage/src/modules/Storage.ycp trunk/storage/storage/src/storage_finish.ycp trunk/storage/yast2-storage.spec.in Modified: trunk/storage/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=49562&r1=... ============================================================================== --- trunk/storage/VERSION (original) +++ trunk/storage/VERSION Fri Aug 1 10:57:04 2008 @@ -1 +1 @@ -2.17.7 +2.17.8 Modified: trunk/storage/configure.in.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/configure.in.in?rev=49562... ============================================================================== --- trunk/storage/configure.in.in (original) +++ trunk/storage/configure.in.in Fri Aug 1 10:57:04 2008 @@ -7,6 +7,15 @@ AM_CONDITIONAL(ARCH_S390, test "$target_cpu" == "s390x" -o "$target_cpu" == "s390") +AC_CHECK_PROGS([SWIG], [swig]) +if test -z "$SWIG"; then + AC_MSG_ERROR([install swig]) +fi +AC_CHECK_PROGS([SABCMD], [sabcmd]) +if test -z "$SABCMD"; then + AC_MSG_ERROR([install sablotron]) +fi + ## some common checks @YAST2-CHECKS-COMMON@ @YAST2-CHECKS-YCP@ Modified: trunk/storage/data/sysconfig.storage URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/data/sysconfig.storage?re... ============================================================================== --- trunk/storage/data/sysconfig.storage (original) +++ trunk/storage/data/sysconfig.storage Fri Aug 1 10:57:04 2008 @@ -9,9 +9,25 @@ USED_FS_LIST="" ## Type: string(id,path,device,uuid,label) -# List of possible default mount-by methods +# Default mount-by method. DEVICE_NAMES="id" +## Type: string +# Default filesystem type. +DEFAULT_FS="ext3" + ## Type: integer(0:1) -# Show warning at start of yast2 disk +# Show warning at start of yast2 disk. WARN_EXPERT="1" + +## Type: string(id,path,device) +# Display name in expert-partitioner. +DISPLAY_NAME="device" + +## Type: string +# List of hidden fields in expert-partitioner. +# Allowed values are: label uuid mount_by used_by bios_id start_cyl +# end_cyl num_cyl cyl_size fc_wwpn fc_port_id +# +# Separate individual values by single space +HIDDEN_FIELDS="" Modified: trunk/storage/disk/src/disk.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/disk/src/disk.ycp?rev=495... ============================================================================== --- trunk/storage/disk/src/disk.ycp (original) +++ trunk/storage/disk/src/disk.ycp Fri Aug 1 10:57:04 2008 @@ -16,20 +16,15 @@ * Wrapper file for inst_disk.ycp * */ - { - -/*** - * <h3>Configuration of the disk</h3> - */ - textdomain "storage"; import "Popup"; import "Wizard"; import "Misc"; - string msg=_("Only use this program if you are familiar with partitioning hard disks. + + string msg = _("Only use this program if you are familiar with partitioning hard disks. Never partition disks that may, in any way, be in use (mounted, swap, etc.) unless you know exactly what you are @@ -39,10 +34,10 @@ To continue despite this warning, click Yes. "); - any ret = `back; // no params == UI, some params == commandline - if (size (WFM::Args()) == 0) { + if (size (WFM::Args()) == 0) + { Wizard::CreateDialog(); Wizard::SetContents ( _("Expert Partitioner"), @@ -53,7 +48,6 @@ ); Wizard::SetTitleIcon ("yast-disk"); - ret = `back; // popup headline integer warn = tointeger(Misc::SysconfigRead( .sysconfig.storage.WARN_EXPERT, "1" )); y2milestone( "warn:%1", warn ); @@ -61,16 +55,18 @@ warn = 1; if (warn==0||Popup::YesNoHeadline(_("Warning"),msg)==true) { y2milestone ("--- Calling disk_worker %1 ---", WFM::Args()); - ret = WFM::call("disk_worker", WFM::Args()); + any ret = WFM::call("disk_worker", WFM::Args()); y2milestone ("--- Returned: %1 ---", ret); } else { - y2milestone ("User decided not to run storage..."); + y2milestone ("User decided not to run disk..."); } Wizard::CloseDialog(); - } else { + } + else + { y2milestone ("--- Calling disk_worker %1 ---", WFM::Args()); - ret = WFM::call("disk_worker", WFM::Args()); + any ret = WFM::call("disk_worker", WFM::Args()); y2milestone ("--- Returned: %1 ---", ret); } Modified: trunk/storage/disk/src/disk_worker.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/disk/src/disk_worker.ycp?... ============================================================================== --- trunk/storage/disk/src/disk_worker.ycp (original) +++ trunk/storage/disk/src/disk_worker.ycp Fri Aug 1 10:57:04 2008 @@ -16,40 +16,35 @@ * Wrapper file for inst_disk.ycp * */ - { + textdomain "storage"; -/*** - * <h3>Configuration of the disk</h3> - */ + import "CommandLine"; + import "Storage"; - textdomain "storage"; - import "CommandLine"; - import "StorageClients"; - import "Popup"; - import "Storage"; - -define any DiskSequence () { - Storage::SwitchUiAutomounter( false ); - any ret = WFM::CallFunction("inst_disk", [ true, true ]); - Storage::SwitchUiAutomounter( true ); - Storage::SaveUsedFs(); + any DiskSequence() + { + Storage::SwitchUiAutomounter(false); + any ret = WFM::CallFunction("inst_disk", [ true, true ]); + Storage::SwitchUiAutomounter(true); + Storage::SaveUsedFs(); + + return ret; + } - return ret; -} -/* -- the command line description map -------------------------------------- */ -map cmdline = $[ - "id" : "disk", - // translators: command line help text for disk module - "help" : _("Disk partitioner"), - // custum help text (should replace default one) - "customhelp" : _("Command line interface for the partitioner module is not available"), - "guihandler" : DiskSequence, -]; + /* -- the command line description map -------------------------------------- */ + map cmdline = $[ + "id" : "disk", + // translators: command line help text for disk module + "help" : _("Disk partitioner"), + // custum help text (should replace default one) + "customhelp" : _("Command line interface for the partitioner module is not available"), + "guihandler" : DiskSequence, + ]; -CommandLine::Run (cmdline); -return true; + CommandLine::Run(cmdline); + return true; } Modified: trunk/storage/lvm/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/lvm/src/Makefile.am?rev=4... ============================================================================== --- trunk/storage/lvm/src/Makefile.am (original) +++ trunk/storage/lvm/src/Makefile.am Fri Aug 1 10:57:04 2008 @@ -10,6 +10,4 @@ lvm_config.ycp \ lvm_config_ui.ycp -desktop_DATA = lvm_config.desktop - -EXTRA_DIST = $(client_DATA) $(desktop_DATA) +EXTRA_DIST = $(client_DATA) Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.cha... ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Fri Aug 1 10:57:04 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Aug 01 10:42:52 CEST 2008 - aschnell@suse.de + +- redesigned expert partitioner (fate #302054) +- added dialog to choose partition table type (fate #303924) +- version 2.17.8 + +------------------------------------------------------------------- Thu Jul 31 15:29:12 CEST 2008 - aschnell@suse.de - recognise NetBSD partitions (bnc #412244) Modified: trunk/storage/storage/src/include/custom_part_dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custo... ============================================================================== --- trunk/storage/storage/src/include/custom_part_dialogs.ycp (original) +++ trunk/storage/storage/src/include/custom_part_dialogs.ycp Fri Aug 1 10:57:04 2008 @@ -29,6 +29,7 @@ import "Mode"; import "Arch"; import "Label"; + import "Popup"; ////////////////////////////////////////////////////////////////////////////// // Dialog Password for Crypted FS @@ -346,10 +347,10 @@ * @parm new_val map that contains a partition * @parm file_systems filesystem definitions */ -define map FileSystemOptions( map< any, map<string,any> > org_fs_options, - map fs_define ) +map <any, map<string, any> > FileSystemOptions(map< any, map<string,any> > org_fs_options, + map fs_define) ``{ - y2milestone( "FileSystemOptions org_fs_options %1", org_fs_options ); + y2milestone( "FileSystemOptions org_fs_options:%1 fs_define:%2", org_fs_options, fs_define ); map<any, map<string,any> > fs_options = org_fs_options; term contents = `VBox(`VSpacing (1)); string helptext = ""; @@ -620,33 +621,32 @@ y2milestone( "FstabOptions old_state=%1", old_state ); UI::OpenDialog( `opt(`decorated), - `HBox( - `HWeight(4, `RichText( helptext )), - `HWeight(7, - `VBox( - `HSpacing(50), - // heading text - `Left(`Heading(_("Fstab options:"))), - `VStretch(), - `VSpacing(1), - `HBox(`HStretch(), - `HSpacing(1), - contents, - `HStretch(), - `HSpacing(1)), - `VSpacing(1), - `VStretch(), - `HBox( - `Bottom(`PushButton(`id(`ok), - `opt(`default), - Label::OKButton())), - `Bottom(`PushButton(`id(`cancel), - Label::CancelButton())) - ) - ) - ) - ) + `VBox ( + `HSpacing(50), + // heading text + `Left(`Heading(_("Fstab options:"))), + `VStretch(), + `VSpacing(1), + `HBox(`HStretch(), + `HSpacing(1), + contents, + `HStretch(), + `HSpacing(1)), + `VSpacing(1), + `VStretch(), + `HBox( + `Left(`PushButton(`id(`help),`opt(`helpButton), Label::HelpButton())), + `Right(`HBox ( + `PushButton(`id(`ok), + `opt(`default), + Label::OKButton()), + `PushButton(`id(`cancel), + Label::CancelButton())) + ) + ) + ) ); + if( UI::WidgetExists( `id(`mt_group) )) { list no_mountby_type = [ `loop ]; @@ -706,6 +706,10 @@ { ret = UI::UserInput(); y2milestone( "FstabOptions ret %1", ret ); + if( ret == `help) + { + Popup::LongText(_("Fstab Options Help"), `RichText(helptext), 50,20); + } if( ret == "opt_noauto" ) { if( UI::WidgetExists( `id("opt_user") )) @@ -912,7 +916,7 @@ if( !Arch::s390 () ) { boolean cr = new_val["enc_type"]:`none != `none; - CryptWidget = `VBox( `VSpacing(0.7), + CryptWidget = `VBox( // `VSpacing(0.7), `Left(`CheckBox(`id(`crypt_fs), `opt(`notify), // button text _("&Encrypt file system"), cr ))); @@ -923,9 +927,9 @@ `ComboBox(`id(`fs), `opt(`hstretch, `notify), // label text _("File &system"), filesystems )), - `PushButton( `id(`fs_options ),`opt(`hstretch), + `PushButton( `id(`fs_options ), `opt(`hstretch), // button text - _("O&ptions") ), + _("O&ptions...") ), CryptWidget ); } @@ -1593,62 +1597,57 @@ }; -define symbol ReallyInstPrepdisk( ) - ``{ - map<string,map> targetMap = Storage::GetTargetMap(); +symbol ReallyInstPrepdisk() +{ symbol ret = `none; string doto = Storage::ChangeText(); - y2milestone( "ReallyInstPrepdisk doto:%1", doto ); - term dlg = `Empty(); - if( size(doto) == 0 ) - { + y2milestone("ReallyInstPrepdisk doto:%1", doto); + + if (size(doto) == 0) + { // popup text - Popup::Message( _("No unsaved changes exist.")); + Popup::Message(_("No unsaved changes exist.")); ret = `back; - } + } else - { - dlg = `VBox( `VSpacing(1), - `HSpacing(60), - // label text - `Left(`Heading(_("Changes:"))), - `RichText( doto ) ); + { + term dlg = `VBox(`VSpacing(1), + `HSpacing(60), + // label text + `Left(`Heading(_("Changes:"))), + `RichText(doto)); UI::OpenDialog(`opt(`decorated, `warncolor), `HBox( - `HSpacing(1), - `VBox( - dlg, - `VSpacing(1), - // popup text - `Heading(_(" Do you really want to execute these changes?")), - `VSpacing(1), - - `HBox( - // all right, start installation *now* - - `PushButton(`id(`back), Label::CancelButton()), - `HStretch(), - // button text - `PushButton(`id(`apply), _("&Apply")), - `PushButton(`id(`finish), Label::FinishButton() ) - // no, don't go on, i just changed my mind - ), - `VSpacing(0.2) + `HSpacing(1), + `VBox( + dlg, + `VSpacing(1), + // popup text + `Heading(_(" Do you really want to execute these changes?")), + `VSpacing(1), + `HBox( + `PushButton(`id(`back), Label::CancelButton()), + `HStretch(), + // button text + `PushButton(`id(`apply), _("&Apply")), + `PushButton(`id(`finish), Label::FinishButton() ) ), - `HSpacing(1) - ) - ); + `VSpacing(0.2) + ), + `HSpacing(1) + ) + ); - ret = (symbol)UI::UserInput(); + ret = (symbol) UI::UserInput(); UI::CloseDialog(); - } + } - y2milestone( "ReallyInstPrepdisk ret=%1", ret ); + y2milestone("ReallyInstPrepdisk ret=%1", ret); return ret; - }; +} /** Modified: trunk/storage/storage/src/include/lvm_lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/lvm_l... ============================================================================== --- trunk/storage/storage/src/include/lvm_lib.ycp (original) +++ trunk/storage/storage/src/include/lvm_lib.ycp Fri Aug 1 10:57:04 2008 @@ -15,8 +15,9 @@ * */ - { - +{ + import "Integer"; + include "partitioning/partition_defines.ycp"; include "partitioning/signatures.ycp"; @@ -35,12 +36,11 @@ ////////////////////////////////////////////////////////////////////// // get a list of all volume groups in the targetMap -define list get_vgs( map<string,map> targetMap ) - ``{ - list lvm_vg = []; +list<string> get_vgs( map<string,map> targetMap ) +{ + list<string> lvm_vg = []; - foreach( string dev, map devmap, targetMap, - ``{ + foreach( string dev, map devmap, targetMap, { if ( devmap["type"]:`CT_UNKNOWN==`CT_LVM ) { // add a found volume group @@ -48,7 +48,7 @@ } }); return( lvm_vg ); - }; +}; ////////////////////////////////////////////////////////////////////// // pesize to byte @@ -56,35 +56,17 @@ // // return "0" if input is invalid // -// pesize is valid 8K to 512M in power of 2 -// 8 is 8k -// 16K == 16k == 16KB == 16kb -define integer pesize_str_to_byte( string input ) - ``{ - integer num = kmgt_str_to_byte( input ); - if( findfirstnotof( input, "0123456789 " ) == nil ) - num = num*1024; - - integer ret = num; +// pesize is valid 8kB to 512MB in power of 2 +define integer pesize_str_to_byte(string input) +{ + integer ret = kmgt_str_to_byte(input); - if( ret % 1024 != 0 ) + if (!Integer::IsPowerOfTwo(ret)) ret = 0; - else - { - while( num>1 && ret>0 ) - { - if( num%2 != 0 ) - ret = 0; - else - num = num/2; - } - } - if( ret < 8*1024 || ret > 524288*1024 ) - { + else if (ret < 8*1024 || ret > 512*1024*1024) ret = 0; - } - return( ret ); - }; + return ret; +}; ////////////////////////////////////////////////////////////////////// Modified: trunk/storage/storage/src/include/lvm_lv_lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/lvm_l... ============================================================================== --- trunk/storage/storage/src/include/lvm_lv_lib.ycp (original) +++ trunk/storage/storage/src/include/lvm_lv_lib.ycp Fri Aug 1 10:57:04 2008 @@ -191,12 +191,12 @@ //////////////////////////////////////////////////////////////////////////////// // Get all existing lv names of a volume group -define list get_lv_names( map<string,map> targetMap, string current_vg ) - ``{ - list<map> part = targetMap["/dev/"+current_vg,"partitions"]:[]; - list ret = maplist( map e, part, ``(e["name"]:"") ); - return( ret ); - }; +list<string> get_lv_names(map<string, map> target_map, string vg_name) +{ + list<map> parts = target_map["/dev/" + vg_name, "partitions"]:[]; + list<string> ret = maplist(map part, parts, { return part["name"]:""; }); + return ret; +}; ////////////////////////////////////////////////////////////////////// // partition list to widget table Modified: trunk/storage/storage/src/include/lvm_pv_lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/lvm_p... ============================================================================== --- trunk/storage/storage/src/include/lvm_pv_lib.ycp (original) +++ trunk/storage/storage/src/include/lvm_pv_lib.ycp Fri Aug 1 10:57:04 2008 @@ -161,7 +161,6 @@ ///////////////////////////////////////////////////////////////// // Get all partitions, we can probably use as physical volumes // Add needed information: disksize - define list<map> get_possible_pvs( map<string,map> targetMap ) ``{ list<map> ret = []; Modified: trunk/storage/storage/src/include/partition_defines.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/parti... ============================================================================== --- trunk/storage/storage/src/include/partition_defines.ycp (original) +++ trunk/storage/storage/src/include/partition_defines.ycp Fri Aug 1 10:57:04 2008 @@ -26,7 +26,7 @@ import "Partitions"; import "FileSystems"; import "Report"; - + import "String"; import "Popup"; // include "partitioning/custom_part_testdata.ycp"; @@ -64,64 +64,24 @@ }; - /*--------------------------------------------------------------------- - * returns for a string a string with a minimum of 9 characters: - * "1" -> " 1" - * "22" -> " 22" - * "145" -> " 145" - * "2134" -> " 2134" - *---------------------------------------------------------------------- - */ - define string sto8string( string str ) - ``{ - integer nb = size( str ); - if ( nb > 8 ) return( sformat( "%1", str )); - if ( nb > 7 ) return( sformat( " %1", str )); - if ( nb > 6 ) return( sformat( " %1", str )); - if ( nb > 5 ) return( sformat( " %1", str )); - if ( nb > 4 ) return( sformat( " %1", str )); - if ( nb > 3 ) return( sformat( " %1", str )); - if ( nb > 2 ) return( sformat( " %1", str )); - if ( nb > 1 ) return( sformat( " %1", str )); - return( sformat( " %1", str )); - }; - /*--------------------------------------------------------------------- * Convert <number-of-bytes> to XXX.X MB or XXX.X GB or XXX.X TB * * see also ByteToHumanStringWithZero ! * Return value: string "unknown" if input == 0 *---------------------------------------------------------------------- + * TODO: remove */ -define string ByteToHumanString ( integer number ) - ``{ - // column description, if disk space is not known - if( number == 0 ) return( _("unknown") ); - - if( number < 1073741824 ) - { - // < 1 GB - integer MB = number / 1048576; - integer hunKB = (number - (MB * 1048576)) / 104858; - return( sto8string(sformat( "%1.%2 MB", MB,hunKB ))); - } - else if ( number < 1099511627776 ) - { - // < 1 TB - integer GB = number / 1073741824; - integer hunMB = (number - (GB * 1073741824)) / 107374183; - return( sto8string(sformat( "%1.%2 GB", GB,hunMB ))); - } - else - { - // >= 1 TB - integer TB = number / 1099511627776; - integer hunGB = (number - (TB * 1099511627776)) / 109951162778; - return( sto8string(sformat( "%1.%2 TB", TB,hunGB ))); - } - }; - +string ByteToHumanString(integer number) +{ + if (number == 0) + { + // column description, if disk space is not known + return _("unknown"); + } + return String::FormatSizeWithPrecision(number, 2, false); +}; /*--------------------------------------------------------------------- @@ -163,23 +123,20 @@ * see also ByteToHumanString ! * Return value: string "0" if input == 0 *---------------------------------------------------------------------- + * TODO: remove */ -define string ByteToHumanStringWithZero ( integer number ) - ``{ - // string or locale - string ret = ByteToHumanString( number ); - - // label text - if( ret == _("unknown") ) - { +string ByteToHumanStringWithZero(integer number) +{ + if (number == 0) + { // label text, short for Megabyte (MB) - return( "0 " + _("MB") ); - } + return "0 " + _("MB"); + } else - { - return( ret ); - } - }; + { + return ByteToHumanString(number); + } +}; /*--------------------------------------------------------------------- Modified: trunk/storage/storage/src/include/raid_lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/raid_... ============================================================================== --- trunk/storage/storage/src/include/raid_lib.ycp (original) +++ trunk/storage/storage/src/include/raid_lib.ycp Fri Aug 1 10:57:04 2008 @@ -372,4 +372,3 @@ } } - Modified: trunk/storage/storage/src/inst_custom_part.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/inst_custom_p... ============================================================================== --- trunk/storage/storage/src/inst_custom_part.ycp (original) +++ trunk/storage/storage/src/inst_custom_part.ycp Fri Aug 1 10:57:04 2008 @@ -64,20 +64,6 @@ include "partitioning/evms_lib.ycp"; - // Which columns show the main window have - boolean showT_dev = true; // show /dev/hda1 - boolean showT_id = false; // s390 show FD01 - boolean showT_cyl = true; // show start and endcyl - boolean showT_size = true; // show size of partition - boolean showT_format = true; // show format flag - boolean showT_fs = true; // show filesystem - boolean showT_mount = true; // show mountpoint - boolean showT_mby = true; // show mount by - boolean showT_Used = true; // show using entity - boolean showT_Label = true; // show assigned label - boolean showT_udev_id = true; // show persistent id - boolean showT_udev_path = true; // show persistent path - // hide some details in the table by default boolean show_T_details = Storage::GetExpertDetail(); @@ -126,13 +112,11 @@ if( Arch::ppc () ) { - showT_cyl = false; bsd_label = false; } if( Arch::s390 () ) { - showT_id = true; button_resize = false; button_loop = false; } @@ -872,314 +856,6 @@ }; - /*--------------------------------------------------------------------- - * returns for nonnegative numbers a string with a minimum of 4 characters: - * 1 -> " 1" - * 22 -> " 22" - * 145 -> " 145" - * 2134 -> "2134" - * 34111 -> "34111" - *---------------------------------------------------------------------- - */ -define string to4string( integer nb ) - ``{ - if ( nb < 10 ) return( sformat( " %1", nb )); - if ( nb < 100 ) return( sformat( " %1", nb )); - if ( nb < 1000 ) return( sformat( " %1", nb )); - return( sformat( "%1", nb )); - }; - -define string usedByString( symbol ub_type, string used_by ) - { - string ret = ""; - if( ub_type == `UB_LVM ) - ret = "LVM " + used_by; - else if( ub_type == `UB_EVMS ) - ret = "EVMS " + used_by; - else if( ub_type == `UB_DM ) - ret = "DM " + used_by; - else if( ub_type == `UB_DMRAID ) - ret = "RAID " + used_by; - else if( ub_type != `UN_NONE ) - ret = used_by; - return( ret ); - } - - /*--------------------------------------------------------------------- - * Fill the selection box with ID 'selbox_id' inside widget tree - * 'widget' with disk and partition info from 'all_disks'. - * - * Return value: - * term contents = `VBox(`Label("Partitions"), - * `Table(`header("Device", "Start", "End", "Size", "F", "Type", "Mount", "RAID" , "LVM" ), - * [ - * `item(`id("/dev/hda"), "/dev/hda", "8.5 GB", " ", "Seagate ST 48012", " ", "1", "1115" ,"", ""), - * `item(`id("1//dev/hda"), " /dev/hda1", "509.8 MB", " ", "FAT16", " ", "1", "65" ,"", ""), - * `item(`id("2//dev/hda"), " /dev/hda2", "666.7 MB", " ", "NTFS", " ", "66", "150" ,"", ""), - * `item(`id("3//dev/hda"), " /dev/hda3", "5.5 GB", " ", "Extended", " ", "301","1024" ,"", ""), - * `item(`id("4//dev/hda"), " /dev/hda5", "7.8 MB", "F", "Linux ", "/boot", "301","302" ,"", ""), - * `item(`id("5//dev/hda"), " /dev/hda6", "7.8 MB", "", "Linux LVM ", "", "303","304" ,"", "system"), - * `item(`id("6//dev/hda"), " /dev/hda7", "7.8 MB", "", "Linux RAID ", "", "305","307" ,"/dev/md1", ""), - * ] )) ; - * - * PPC: without Start End - * - *---------------------------------------------------------------------- - */ - -define list FillPartitionList(map<string,map> targets) - ``{ - list<term> table_input = []; - boolean log_mode = false; - - // order should be md, then loop, then LVM, then EVMS - map disk_order = $[ `CT_DMRAID : 0, `CT_DISK : 1, `CT_MD : 2, `CT_LOOP : 3, - `CT_LVM : 4, `CT_EVMS : 5, `CT_DM : 6, `CT_NFS : 7 ]; - list<string> keys = maplist( string dev, map disk, targets, - ``{return(dev);} ); - keys = sort( string a, string b, keys, - ``{ - integer oa = disk_order[targets[a,"type"]:`CT_UNKNOWN]:8; - integer ob = disk_order[targets[b,"type"]:`CT_UNKNOWN]:8; - return( (oa==ob) ? (a<b) : (oa<ob) ); - }); - - SCR::Write(.target.ycp,Storage::SaveDumpPath("targetMap_c"), targets ); - foreach( string dev, keys, - ``{ - map disk = targets[dev]:$[]; - boolean real_disk = Storage::IsPartitionable( disk ); - integer cyl_count = disk["cyl_count"]:0; - integer cyl_size = disk["cyl_size"]:1000000; - string vendor = disk["vendor"]:""; - string model = disk["model"]:""; - string dev_size = ByteToHumanString(disk["size_k"]:0*1024); - string dev_start_cyl = to4string(0); - string dev_nb_cyl = to4string(cyl_count==0?cyl_count:(cyl_count-1)); - string udev_id = mergestring( disk["udev_id"]:[], " "); - string udev_path = disk["udev_path"]:""; - - if ( (model != "") && (vendor != "") ) - vendor = vendor + "-" + model; - else - vendor = vendor + model; - - // entry in column "Type" for a unknown disk - if( vendor == "" ) - { - if (disk["bus"]:"" == "RAID") - { - vendor = "RAID "+dev; - } - else if( disk["type"]:`CT_UNKNOWN==`CT_LVM ) - { - vendor = "LVM" + (disk["lvm2"]:false ? "2 " : " ") + - disk["name"]:""; - } - else if( disk["type"]:`CT_UNKNOWN==`CT_EVMS ) - { - vendor = "EVMS " + disk["name"]:""; - } - else if( disk["type"]:`CT_UNKNOWN==`CT_DMRAID ) - { - vendor = "BIOS RAID " + disk["name"]:""; - } - else - // label text - vendor = sformat( _("DISK %1"), substring( dev, 5 )); - } - - boolean id_sw_raid_dev = (dev == "/dev/md"); - - ///////////////////////////////////////////////////////////// - // Insert line for the entire disk into selection box widget - // Look, if for the architecture disk, and Cylinder are shown - - if( !real_disk ) - { - dev_nb_cyl = " -- "; - dev_start_cyl = " -- "; - } - - if( show_disk && - !(disk["type"]:`CT_UNKNOWN==`CT_DISK && !real_disk) && - (disk["type"]:`CT_UNKNOWN==`CT_DISK || - disk["type"]:`CT_UNKNOWN==`CT_DMRAID || - disk["type"]:`CT_UNKNOWN==`CT_LVM || - (disk["type"]:`CT_UNKNOWN==`CT_EVMS && size(disk["name"]:"")>0 && - (!haskey( targets, "/dev/"+substring( disk["name"]:"", search( disk["name"]:"", "/")+1 ))|| - disk["create"]:false)))) - { - y2milestone( "disk:%1", disk ); - term a = `item(`id(dev)); - - if( showT_dev ) a = add(a, dev ); - if( showT_id ) a = add(a, sformat( " (%1)", - disk["bios_id"]:"" ) ); - if( showT_size ) a = add(a, dev_size ); - if( showT_format ) a = add(a, (disk["dasdfmt"]:false)?"X":" " ); - if( showT_fs ) a = add(a, vendor); - if( showT_mount ) a = add(a, "" ); - if( show_T_details && showT_mby ) a = add(a, ""); - if( show_T_details && showT_cyl ) a = add(a, dev_start_cyl ); - if( show_T_details && showT_cyl ) a = add(a, dev_nb_cyl ); - if( showT_Used ) a = add(a, usedByString( disk["used_by_type"]:`UB_NONE, - disk["used_by"]:"" )); - if( showT_Label ) a = add(a, ""); - if( show_T_details && showT_udev_id ) a = add(a, udev_id); - if( show_T_details && showT_udev_path ) a = add(a, udev_path); - - table_input = add( table_input, a ); - } - - ///////////////////////////////////////////////////////////// - // Now we come to the partitions ... - - list<map> partitions = disk["partitions"]:[]; - - foreach( map partition, partitions, - ``{ - // dont show "system partitions" - string fstype = partition["fstype"]:""; - boolean hide = partition["fsid"]:0 == Partitions::fsid_mac_hidden || - disk["used_by_type"]:`UB_NONE==`UB_DMRAID; - if( !hide && search( partition["device"]:"", "/dev/evms/" )==0 ) - { - y2milestone( "evms p: %1", partition ); - string d1 = evms_dev_disk( partition["device"]:"" ); - y2milestone( "evms d1:%1", d1 ); - integer val = search( d1, "/lvm/" ); - if( val!=nil && val>0 ) - { - d1 = "/dev/" + substring( d1, 9 ); - } - else - { - val = search( d1, "/lvm2/" ); - if( val!=nil && val>0 ) - { - d1 = "/dev/" + substring( d1, 10 ); - } - } - hide = size(partition["mount"]:"")==0; - if( hide ) - { - y2milestone( "evms p: %1", Storage::GetPartition( targets, d1 )); - hide = (size(Storage::GetPartition( targets, d1 ))>0|| - Storage::IsPartType(targets[d1,"type"]:`CT_UNKNOWN)) && - !partition["evms_native"]:false; - } - y2milestone( "evms d1:%1 hide:%2", d1, hide ); - } - if( !hide || log_mode ) - { - string part_id = ""; - - string part_dev_name = partition["device"]:""; - string id = part_dev_name; - - //////////////////////////////////////////////////////////// - // Format other Colums: - - integer start_cyl = partition["region",0]:0; - integer nb_cyl = partition["region",1]:0; - symbol type = partition["type"]:`unknown; - boolean format = partition["format"]:false; - boolean crypt_fs = partition["enc_type"]:`none != `none; - symbol used_fs = partition["used_fs"]:`unknown; - string mount_point = partition["mount"]:""; - symbol mount_by = partition["mountby"]:`device; - string filesystem_name = ""; - string label = partition["label"]:""; - string udev_id = mergestring( partition["udev_id"]:[], " "); - string udev_path = partition["udev_path"]:""; - - string used_by = - usedByString( partition["used_by_type"]:`UB_NONE, - partition["used_by"]:"" ); - - filesystem_name = partition["fstype"]:""; - - if( format && partition["fsid"]:0 == Partitions::fsid_native) - { - string fs_name = FileSystems::GetName( used_fs, "Ext2" ); - filesystem_name = filesystem_name + " (" + fs_name + ") "; - } - - string format_flag = ""; - if ( format ) format_flag = "F"; - if ( crypt_fs ) format_flag = "C" + format_flag; - - string bytes_of_part = - ByteToHumanString( partition["size_k"]:0*1024 ); - - ///////////////////////////////////////////////////// - // Insert line for this partition into selection box widget - // - // Start- and EndCly are shown (intel) or not (ppc) ... - - term a = `item(`id(id)); - - if( showT_dev ) a = add(a, part_dev_name ); - if( showT_id ) a = add(a, part_id ); - if( showT_size ) a = add(a, bytes_of_part); - if( showT_format ) a = add(a, format_flag); - if( showT_fs ) a = add(a, filesystem_name); - if( showT_mount ) - { - string tmp = mount_point; - if( Mode::normal() && partition["inactive"]:false ) - { - tmp = tmp + " *"; - } - a = add(a, tmp ); - } - if( show_T_details && showT_mby ) - { - if (size (mount_point) > 0) - { - map tmp = $[ `device : "K", `uuid : "U", `label : "L", - `id : "I", `path : "P" ]; - a = add(a, tmp[mount_by]:""); - } - else - a = add(a, ""); - } - if( show_T_details && showT_cyl ) - { - if( real_disk ) - { - a = add(a, to4string(start_cyl)); - integer num = start_cyl + nb_cyl - 1; - if( num<0 ) - num=0; - a = add(a, to4string(num)); - } - else - { - a = add(a, " -- "); - a = add(a, " -- "); - } - } - if( showT_Used ) a = add(a, used_by); - if( showT_Label ) a = add(a, label); - - if( show_T_details && showT_udev_id ) a = add(a, udev_id); - if( show_T_details && showT_udev_path ) a = add(a, udev_path); - - table_input = add( table_input, a ); - } - else - { - // as deleted marked - // y2debug( "ddddddddddddd----"); - } - }); - }); - - return( table_input ); - }; - /*------------------------------------------------------------------- * * Now check start an end cylinder @@ -2401,53 +2077,6 @@ return( "---" ); }; -define term GetTableHeader () { - term header = `header(); - - // Column header - if ( showT_dev ) header = add( header, _("Device")); - - // Column header - if ( showT_id ) header = add( header, _("ID")); - - // Column header: centered / minimum = 11 characters / - // fill with space if needed - if ( showT_size ) header = add( header, `Right(_(" Size "))); - - // Column header: centered / minimum = 3 characters / - // fill with space if needed - if ( showT_format ) header = add( header, `Right(_(" F "))); - - // Column header - if ( showT_fs ) header = add( header, _("Type")); - - // Column header: centered / minimum = 7 characters / - // fill with space if needed - if ( showT_mount ) header = add( header, _(" Mount ")); - - // Column header - if ( show_T_details && showT_mby ) header = add( header, _("Mount By")); - - // Column header: minimum = 5 characters fill with space if needed - if ( show_T_details && showT_cyl ) header = add( header, `Right(_("Start"))); - - // Column header: minimum = 4 characters fill with space if needed - if ( show_T_details && showT_cyl ) header = add( header, `Right(_("End "))); - - // Column header - if ( showT_Used ) header = add( header, `Left(_("Used By"))); - - // Column header - if ( showT_Label ) header = add( header, `Left(_("Label"))); - - // Column header - if ( show_T_details && showT_udev_id ) header = add( header, `Left(_("Device ID"))); - - // Column header - if ( show_T_details && showT_udev_path ) header = add( header, `Left(_("Device Path"))); - - return header; -} /*--------------------------------------------------------------------- * Make a output string for "you can not create a partition, because: " @@ -2503,6 +2132,18 @@ // MAIN: ///////////////////////////////////////////////////////////////// + + + + if (true) + { + include "partitioning/ep-main.ycp"; + return test_new_ep(); + } + + + + symbol ret = nil; y2milestone( "Custom partitioner started" ); @@ -2512,7 +2153,6 @@ Storage::GetTargetMap() ); map<string,map> tg = Storage::GetTargetMap(); - list table_list = FillPartitionList(tg); if( !Storage::CheckBackupState("custom_part") ) { @@ -2623,16 +2263,6 @@ `CheckBox (`id(`show_table_details), `opt(`notify), _("&Show Details"), show_T_details) ); - term contents = `VBox( `VSpacing(0.5), - `ReplacePoint( - `id(`table_rp), - `Table( `id(`table), `opt(`notify,`keepSorting), - GetTableHeader(), table_list ) - ), - details_checkbox, - buttonline_a, - buttonline_b ) ; - string help_text = ""; if( Arch::s390 () ) { @@ -2660,8 +2290,8 @@ } // heading text - Wizard::SetContentsButtons(_("Expert Partitioner"), contents, help_text, - back_label, next_label ); + // Wizard::SetContentsButtons(_("Expert Partitioner"), contents, help_text, + // back_label, next_label ); ////////////////////////////////////////////////////////////////// @@ -2671,8 +2301,8 @@ repeat { map<string,map> tg = Storage::GetTargetMap(); - table_list = FillPartitionList(tg); - UI::ChangeWidget(`id(`table), `Items, table_list); + // table_list = FillPartitionList(tg); + // UI::ChangeWidget(`id(`table), `Items, table_list); /////////////////////////////////////////////////////// // Now set the focus @@ -2695,11 +2325,7 @@ if( ret==`show_table_details ) { - show_T_details = (boolean) UI::QueryWidget(`id(`show_table_details), `Value); - UI::ReplaceWidget( `id(`table_rp), - `Table( `id(`table), `opt(`notify,`keepSorting), - GetTableHeader(), [] )); - continue; + continue; } @@ -3112,137 +2738,6 @@ ///////////////////////////////////////////////////////////// if (ret == `delete) { - map<string,any> part = $[]; - string id = (string)UI::QueryWidget( `id(`table), `CurrentItem); - map<string,any> disk = Storage::GetDisk( tg, id ); - - if( !haskey( tg, id ) ) - part = Storage::GetPartition( tg, id ); - y2milestone( "id:%1 part:%2", id, part ); - if( !haskey( tg, id ) && size(part)==0 ) - { - ret = `again; - continue; - } - - if( disk["readonly"]:false ) - { - Popup::Error( Partitions::RdonlyText( disk["device"]:"", true )); - ret = `again; - continue; - } - - if( haskey( tg, id ) ) - { - if( tg[id,"type"]:`CT_UNKNOWN == `CT_MD ) - { - ret = `again; - continue; - } - else if( tg[id,"type"]:`CT_UNKNOWN == `CT_LVM ) - { - string current_vg = substring( tg[id,"device"]:"", 5 ); - HandleRemoveVg( tg, current_vg ); - } - else if( tg[id,"type"]:`CT_UNKNOWN == `CT_DMRAID ) - { - if( Popup::YesNo( sformat(_("Really delete BIOS RAID %1?"), id ))) - { - if( deleteAllDevPartitions( disk, Stage::initial(), bsd_label )) - Storage::DeleteDmraid( id ); - } - } - // YesNo popup text %1 is replaced by a disk name e.g. /dev/hda - else if( Popup::YesNo( sformat(_("Really delete all partitions on %1?"), id ))) - { - focusline = id; - deleteAllDevPartitions( disk, Stage::initial(), bsd_label ); - } - } - else if( part["type"]:`unknown==`lvm ) - { - if( !check_device_delete( part, false, Stage::initial(), $[] )) - { - ret = `again; - continue; - } - else - HandleRemoveLv( tg, id ); - } - else - { - ///////////////////////////////////////////////////// - // delete algorithm: - // if you find newly created (but until now not realy - // written) partition (sign: "create = true"): delete it - // else there must be already existing partition: mark it - // with "delete = true" - - focusline = id; - - y2milestone( "delete part %1", part ); - ///////////////////////////////////////////////////// - // check if the partition can be deleted - - if( part["type"]:`primary == `extended && - !check_extended_delete( disk, Stage::initial() )) - { - ret = `again; - continue; - } - if( part["type"]:`primary != `extended && - !check_device_delete( part, bsd_label, Stage::initial(), - disk )) - { - ret = `again; - continue; - } - - ///////////////////////////////////////////////////// - // now delete partition!! - - // YesNo popup text, %1 is replaced by a device name e.g. /dev/hda1 - if( Popup::YesNo( sformat(_("Really delete %1?"), - part["device"]:"" ))) - { - if( (search( id, "/dev/loop")==0 || - search( id, "/dev/mapper/")==0) && - size(part["fpath"]:"")>0 && - Mode::normal() && - // YesNo popup. %1 is path to a file - Popup::YesNo( sformat(_("\nShould the loop file %1 also be removed? -"), part["fpath"]:"" ))) - { - Storage::DeleteLoop( disk["device"]:"", - part["fpath"]:"", true ); - } - if( part["type"]:`unknown == `nfs ) - { - Storage::DeleteDevice( "/dev/nfs", - part["device"]:"" ); - } - else - { - Storage::DeleteDevice( disk["device"]:"", - part["device"]:"" ); - } - focusline = Storage::GetIdSmaller( disk["device"]:"", - part["nr"]:0 ); - } - if( search( id, "/dev/md" )==0 ) - { - map raid = Storage::GetDisk( Storage::GetTargetMap(), "/dev/md" ); - UI::ReplaceWidget( `id(`raid_button), - RaidButton(size(raid["partitions"]:[])) ); - } - else if( search( id, "/dev/loop" )==0 || - search( id, "/dev/mapper/" )==0 ) - { - map dev = Storage::GetDisk( Storage::GetTargetMap(), "/dev/loop" ); - UI::ReplaceWidget( `id(`loop_button), - LoopButton(size(dev["partitions"]:[])) ); - } - } } Modified: trunk/storage/storage/src/inst_disk.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/inst_disk.ycp... ============================================================================== --- trunk/storage/storage/src/inst_disk.ycp (original) +++ trunk/storage/storage/src/inst_disk.ycp Fri Aug 1 10:57:04 2008 @@ -17,207 +17,68 @@ * Main file for disk configuration. Uses all other files. * */ - { + textdomain "storage"; -/*** - * <h3>Configuration of the disk</h3> - */ - y2milestone( "start disk"); + import "Wizard"; + import "Mode"; + import "Storage"; + import "StorageClients"; + -import "Arch"; -import "Wizard"; -import "Mode"; -import "Storage"; -import "StorageClients"; -import "Sequencer"; - -textdomain "storage"; - -include "partitioning/signatures.ycp"; -include "partitioning/custom_part_helptexts.ycp"; -include "partitioning/custom_part_dialogs.ycp"; -include "partitioning/custom_part_lib.ycp"; -include "partitioning/raid_lib.ycp"; -include "partitioning/raid_ui.ycp"; -include "partitioning/loop.ycp"; -include "partitioning/lvm_pv_lib.ycp"; -include "partitioning/partition_defines.ycp"; -include "partitioning/custom_part_check_generated.ycp"; + y2milestone("start inst_disk"); y2milestone( "PartMode %1 ProposalActive %2 ", Storage::GetPartMode(), Storage::GetPartProposalActive() ); if( !Storage::GetCustomDisplay() && Storage::GetPartMode() != "CUSTOM" && - Storage::GetPartMode() != "PROP_MODIFY" ) - return Storage::GetExitKey(); - - if( !Storage::CheckBackupState("disk")) - Storage::CreateTargetBackup("disk"); - - - boolean installation = Stage::initial (); - - y2milestone( " running in instsys %1", installation ); - - -define symbol InitSettings( boolean in ) - ``{ - return `next; + Storage::GetPartMode() != "PROP_MODIFY" ) + { + symbol ret = Storage::GetExitKey(); + y2milestone("end inst_disk ret:%1", ret); + return ret; } - map aliases = $[ - "RaidTypeWizard" : ``(ChooseRaidType(`wizard )), - "RaidDeviceWizard" : ``(RaidDevices(`wizard )), - "RaidDeviceSettings" : ``(RaidDevices(`settings)), - "LoopCreateWizard" : ``(LoopSetup(false)), - "LoopEditWizard" : ``(LoopSetup(true)), - "RaidExpertWizard" : ``(RaidExpertWizard()), - "RaidMpAutodetect" : ``(RaidMultipathAuto()), - "ReallyInstPrepdisk" : ``(ReallyInstPrepdisk()), - "LvmPv" : ``(WFM::CallFunction("inst_lvm_pv", [true, true])), - "LvmLv" : ``(WFM::CallFunction("inst_lvm_lv", [true, true])), - "S390Zfcp" : ``(WFM::call("xfcp")), - "S390Dasd" : ``(WFM::call("dasd")), - "Evms" : ``(WFM::CallFunction("inst_evms", [true, true])), - "Custom" : ``(WFM::CallFunction("inst_custom_part", [true, true])), - "PrepDiskEnd" : ``(WFM::CallFunction("inst_prepdisk", [true, true])), - "PrepDiskApply" : ``(WFM::CallFunction("inst_prepdisk", [true, true])), - "ReInitSettings" : ``(InitSettings(installation)), - "abort" : ``(AbortDialog()) - ]; - - - map sequence = $[ - "ws_start" : "Custom", - - "RaidTypeWizard" : $[ `abort : "abort", - `cancel : `cancel, - `mp_auto : "RaidMpAutodetect", - `next : "RaidDeviceWizard" ], - - "RaidDeviceWizard" : $[ `abort : "abort", - `cancel : `cancel, - `next : "RaidExpertWizard" ], - - "RaidMpAutodetect" : $[ `abort : "abort", - `cancel : `cancel, - `next : "Custom" ], - - "RaidExpertWizard" : $[ `abort : "abort", - `cancel : `cancel, - `next : "Custom" ], - - "RaidDeviceSettings" : $[ `abort : "abort", - `cancel : `cancel, - `next : "Custom" ], - - "LoopCreateWizard" : $[ `abort : "abort", - `cancel : `cancel, - `next : "Custom" ], - - "LoopEditWizard" : $[ `abort : "abort", - `cancel : `cancel, - `next : "Custom"], - - "ReallyInstPrepdisk" : $[ `abort : `abort, - `cancel : `cancel, - `finish : "PrepDiskEnd", - `apply : "PrepDiskApply" ], - - "Custom" : $[ `abort : "abort", - `cancel : `cancel, - `raid_wizard : "RaidTypeWizard", - `raid_settings : "RaidDeviceSettings", - `loop_create : "LoopCreateWizard", - `loop_edit : "LoopEditWizard", - `backtoi : `back, - `sysnext : "ReallyInstPrepdisk", - `lvm : "LvmPv", - `lvmlv : "LvmLv", - `zfcp : "S390Zfcp", - `dasd : "S390Dasd", - `evms : "Evms", - `again : "Custom", - `apply : "PrepDiskApply", - `instnext : `next ], - - "LvmPv" : $[ `abort : "abort", - `cancel : `cancel, - `next : "LvmLv" ], - - "LvmLv" : $[ `abort : "abort", - `cancel : `cancel, - `next : "Custom" ], - - "Evms" : $[ `abort : "abort", - `cancel : `cancel, - `next : "Custom" ], - - "S390Zfcp" : $[ `abort : "abort", - `cancel : `cancel, - `next : "Custom" ], - - "S390Dasd" : $[ `abort : "abort", - `cancel : `cancel, - `next : "Custom" ], - - "PrepDiskApply" : $[ `abort : "ReInitSettings", - `cancel : `cancel, - `back : "ReInitSettings", - `next : "ReInitSettings" ], - - "PrepDiskEnd" : $[ `abort : "ReInitSettings", - `cancel : `cancel, - `back : "ReInitSettings", - `next : `next ], - - "ReInitSettings" : $[ `abort : "abort", - `cancel : `cancel, - `next : "Custom" ], - - "abort" : $[ `yes : `abort, - `cancel : `cancel] - ]; + if (!Storage::CheckBackupState("disk")) + Storage::CreateTargetBackup("disk"); + boolean handle_dialog = Mode::normal() || Mode::repair(); - if ( handle_dialog ) { - Wizard::CreateDialog(); - Wizard::SetDesktopIcon("disk"); + if (handle_dialog) + { + Wizard::CreateDialog(); + Wizard::SetDesktopIcon("disk"); StorageClients::EnablePopup(); } /*************************************************/ /* Let's do the work ... */ /*************************************************/ - symbol ret = Sequencer::Run(aliases, sequence); - /*************************************************/ - y2milestone( "Sequencer ret=%1 handle_dialog=%2", ret, handle_dialog ); - + symbol ret = (symbol) WFM::CallFunction("inst_custom_part", [true, true]); - if( handle_dialog ) - { + if (handle_dialog) + { UI::CloseDialog(); - } + } else - { + { if( ret == `back || ret == `abort ) - { + { Storage::RestoreTargetBackup("disk"); - } + } else if( ret == `next ) - { + { Storage::DisposeTargetBackup("disk"); Storage::SetPartProposalActive(false); - } } + } - y2milestone("Disk module finished"); - Storage::SaveExitKey( ret ); - return( ret ); + Storage::SaveExitKey(ret); + y2milestone("end inst_disk ret:%1", ret); + return ret; } Modified: trunk/storage/storage/src/modules/FileSystems.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/FileS... ============================================================================== --- trunk/storage/storage/src/modules/FileSystems.ycp (original) +++ trunk/storage/storage/src/modules/FileSystems.ycp Fri Aug 1 10:57:04 2008 @@ -1039,7 +1039,8 @@ global define string GetName( symbol used_fs, string defaultv )``{ map<symbol,any> fsmap = GetFsMap( used_fs); string ret = fsmap[`name]:""; - if ( ret == "" && used_fs == `ntfs ) ret = "NTFS"; + if ( ret == "" && used_fs == `ntfs ) ret = "NTFS"; // obsolete? (included in RealFileSystems) + if ( ret == "" && used_fs == `nfs ) ret = "NFS"; if ( ret == "" ) ret = defaultv; return ret; } @@ -1452,9 +1453,10 @@ return( fst_default ); } -global map DefaultFormatOptions( map part ) + +global map <any, map <string, any> > DefaultFormatOptions( map part ) { - map ret = $[]; + map <any, map <string, any> > ret = $[]; symbol fsys = part["used_fs"]:`none; if( part["format"]:false ) { Modified: trunk/storage/storage/src/modules/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Makef... ============================================================================== --- trunk/storage/storage/src/modules/Makefile.am (original) +++ trunk/storage/storage/src/modules/Makefile.am Fri Aug 1 10:57:04 2008 @@ -13,7 +13,15 @@ Storage.ycp \ StorageClients.ycp \ StorageControllers.ycp \ - StorageDevices.ycp + StorageDevices.ycp \ + StorageFields.ycp \ + StorageSettings.ycp \ + TreePanel.ycp \ + TabPanel.ycp \ + MiniWorkflow.ycp \ + Greasemonkey.ycp \ + DevicesSelectionBox.ycp \ + DualMultiSelectionBox.ycp EXTRA_DIST = $(module_DATA) Modified: trunk/storage/storage/src/modules/Partitions.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Parti... ============================================================================== --- trunk/storage/storage/src/modules/Partitions.ycp (original) +++ trunk/storage/storage/src/modules/Partitions.ycp Fri Aug 1 10:57:04 2008 @@ -16,6 +16,7 @@ import "Mode"; import "Stage"; import "AsciiFile"; + import "String"; // The filesystem ids for the partitions global integer fsid_empty = 0; @@ -97,36 +98,40 @@ ]; -global define void Partitions() - ``{ - return ; - } +global void SetDefaultFs(symbol new_default_fs) +{ + default_fs = new_default_fs; +} -global define symbol DefaultFs() - ``{ - if( default_fs == `unknown ) - { - default_fs = `ext3; - } - return( default_fs ); +global symbol DefaultFs() +{ + if (default_fs == `unknown) + { + string tmp = (string) SCR::Read(.sysconfig.storage.DEFAULT_FS); + if (tmp == nil || !contains([ "ext2", "ext3", "reiserfs" ], tolower(tmp))) + tmp = "ext3"; + + default_fs = symbolof(toterm(tolower(tmp))); } + return default_fs; +} -global define symbol DefaultBootFs() - ``{ - if( default_boot_fs == `unknown ) +global symbol DefaultBootFs() +{ + if (default_boot_fs == `unknown) + { + default_boot_fs = DefaultFs(); + if (Arch::ia64()) { - default_boot_fs = `ext3; - if( Arch::ia64 () ) - { default_boot_fs = `vfat; - } - else if( Arch::board_mac () ) - { + } + else if (Arch::board_mac()) + { default_boot_fs = `hfs; - } } - return( default_boot_fs ); } + return default_boot_fs; +} global define string BootMount() ``{ @@ -284,6 +289,11 @@ return( fsid==fsid_extended || fsid==fsid_extended_win ); } +global define boolean IsSwapPartition( integer fsid ) + ``{ + return( !IsDosWinNtPartition( fsid ) && fsid==fsid_swap ); + } + global define integer SwapSizeMb( integer slot_size ) ``{ integer swap_size = 0; @@ -746,62 +756,4 @@ return( text ); } - /*--------------------------------------------------------------------- - * returns for a string a string with a minimum of 9 characters: - * "1" -> " 1" - * "22" -> " 22" - * "145" -> " 145" - * "2134" -> " 2134" - *---------------------------------------------------------------------- - */ -define string sto8string( string str ) - ``{ - integer nb = size( str ); - if ( nb > 8 ) return( sformat( "%1", str )); - if ( nb > 7 ) return( sformat( " %1", str )); - if ( nb > 6 ) return( sformat( " %1", str )); - if ( nb > 5 ) return( sformat( " %1", str )); - if ( nb > 4 ) return( sformat( " %1", str )); - if ( nb > 3 ) return( sformat( " %1", str )); - if ( nb > 2 ) return( sformat( " %1", str )); - if ( nb > 1 ) return( sformat( " %1", str )); - return( sformat( " %1", str )); - }; - -/*--------------------------------------------------------------------- - * Convert <number-of-bytes> to XXX.X MB or XXX.X GB or XXX.X TB - * - * see also ByteToHumanStringWithZero ! - * Return value: string "unknown" if input == 0 - *---------------------------------------------------------------------- - */ -global define string ByteToHumanString ( integer number ) - ``{ - // column description, if disk space is not known - if( number == 0 ) return( _("unknown") ); - - if( number < 1073741824 ) - { - // < 1 GB - integer MB = number / 1048576; - integer hunKB = (number - (MB * 1048576)) / 104858; - return( sto8string(sformat( "%1.%2 MB", MB,hunKB ))); - } - else if ( number < 1099511627776 ) - { - // < 1 TB - integer GB = number / 1073741824; - integer hunMB = (number - (GB * 1073741824)) / 107374183; - return( sto8string(sformat( "%1.%2 GB", GB,hunMB ))); - } - else - { - // >= 1 TB - integer TB = number / 1099511627776; - integer hunGB = (number - (TB * 1099511627776)) / 109951162778; - return( sto8string(sformat( "%1.%2 TB", TB,hunGB ))); - } - }; - - } Modified: trunk/storage/storage/src/modules/Storage.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Stora... ============================================================================== --- trunk/storage/storage/src/modules/Storage.ycp (original) +++ trunk/storage/storage/src/modules/Storage.ycp Fri Aug 1 10:57:04 2008 @@ -65,6 +65,7 @@ import "LibStorage::PartitionAddInfo"; import "LibStorage::DmPartCoInfo"; import "LibStorage::DmraidCoInfo"; + import "LibStorage::PartitionSlotInfo"; map<string,any> conv_ctype = $[ "def_sym" : `CT_UNKNOWN, @@ -315,6 +316,50 @@ } } + +global string ByteToHumanString(integer bytes) +{ + return LibStorage::StorageInterface::byteToHumanString(sint, bytes, false, 2, false); +} + + +global string KByteToHumanString(integer kbytes) +{ + return LibStorage::StorageInterface::byteToHumanString(sint, kbytes * 1024, false, 2, false); +} + + +global string ByteToHumanStringWithPrecision(integer bytes, integer precision, boolean omit_zeroes) +{ + return LibStorage::StorageInterface::byteToHumanString(sint, bytes, false, precision, omit_zeroes); +} + + +global string KByteToHumanStringWithPrecision(integer kbytes, integer precision, boolean omit_zeroes) +{ + return LibStorage::StorageInterface::byteToHumanString(sint, kbytes * 1024, false, precision, omit_zeroes); +} + + +global boolean HumanStringToByte(string str, integer& bytes) +{ + integer i = 0; bytes = i; // bnc #408829 and #408891 + boolean ret = LibStorage::StorageInterface::humanStringToByte(sint, str, false, bytes); + y2milestone("HumanStringToByte ret:%1 str:%2 bytes:%3", ret, str, bytes); + return ret; +} + + +global boolean HumanStringToKByte(string str, integer& kbytes) +{ + integer bytes = 0; // bnc #408829 + boolean ret = LibStorage::StorageInterface::humanStringToByte(sint, str, false, bytes); + kbytes = bytes / 1024; + y2milestone("HumanStringToKByte ret:%1 str:%2 kbytes:%3", ret, str, kbytes); + return ret; +} + + global define map<string,map> GetTargetMap(); /** * @@ -562,6 +607,12 @@ * * @param string device * @return map DiskPartition + * + * Examples: + * "/dev/sda" -> $[ "disk" : "/dev/sda", "nr" : "" ] + * "/dev/sda2" -> $[ "disk" : "/dev/sda", "nr" : 2 ] + * "/dev/system" -> $[ "disk" : "/dev/system", "nr" : "" ] + * "/dev/system/abuild" -> $[ "disk" : "/dev/system", "nr" : "abuild" ] */ global define map GetDiskPartition( string device ) ``{ @@ -885,6 +936,30 @@ return( ret ); }; + +global integer GetUnusedPartitionSlots(string device, list<map> &slots) +{ + list<any> swig_slots = []; + + integer ret = LibStorage::StorageInterface::getUnusedPartitionSlots(sint, device, swig_slots); + + slots = maplist(any swig_slot, swig_slots, { + return $[ + "region" : [ LibStorage::PartitionSlotInfo::swig_cylStart_get(swig_slot), + LibStorage::PartitionSlotInfo::swig_cylSize_get(swig_slot) ], + "primary_slot" : LibStorage::PartitionSlotInfo::swig_primarySlot_get(swig_slot), + "primary_possible" : LibStorage::PartitionSlotInfo::swig_primaryPossible_get(swig_slot), + "extended_slot" : LibStorage::PartitionSlotInfo::swig_extendedSlot_get(swig_slot), + "extended_possible" : LibStorage::PartitionSlotInfo::swig_extendedPossible_get(swig_slot), + "logical_Slot" : LibStorage::PartitionSlotInfo::swig_logicalSlot_get(swig_slot), + "logical_possible" : LibStorage::PartitionSlotInfo::swig_logicalPossible_get(swig_slot) + ]; + }); + + return ret; +} + + /** * Adds ... and returns the changed map * @@ -2412,6 +2487,20 @@ return( ret ); } + +global map<string, any> NextMd() +{ + y2milestone("NextMd"); + integer num = 0; + string dev = ""; + integer r = LibStorage::StorageInterface::nextFreeMd(sint, num, dev); + if( r<0 ) + y2error("NextMd ret %1", r); + map<string, any> ret = $[ "device" : dev, "nr" : num ]; + y2milestone( "NextMd sint ret:%1 map:%2", r, ret ); + return ret; +} + global integer MaxSizeLabelK( map disk ) { integer ret = 0; @@ -2832,6 +2921,18 @@ return( ret==0 ); } +global boolean CreateLvmVgWithDevs( string name, integer pesize, boolean lvm2, list<string> devs ) + { + y2milestone( "CreateLvmVgWithDevs name:%1 pesize:%2 lvm2:%3 devs:%4", name, pesize, lvm2, devs ); + integer ret = 0; + ret = LibStorage::StorageInterface::createLvmVg( sint, name, pesize/1024, + !lvm2, devs ); + if( ret<0 ) + y2error( "CreateLvmVgWithDevs sint ret:%1", ret ); + UpdateTargetMap(); + return( ret==0 ); + } + global boolean ExtendLvmVg( string name, string device ) { y2milestone( "ExtendLvmVg name:%1 device:%2", name, device ); @@ -3100,6 +3201,25 @@ return( ret==0 ); } +global boolean CreateMdWithDevs(integer nr, symbol type, list<string> devices) +{ + y2milestone( "CreateMdWithDevs nr:%1 type:%2 devices:%3", nr, type, devices ); + integer ret = 0; + + integer tmp = LibStorage::RAID_UNK(); + foreach(integer k, symbol v, conv_mdtype["m"]:$[], { + if (v == type) + tmp = k; + }); + + string rd = sformat("/dev/md%1", nr ); + ret = LibStorage::StorageInterface::createMd(sint, rd, tmp, devices); + if( ret<0 ) + y2error( "CreateMdWithDevs sint ret:%1", ret ); + UpdateTargetMap(); + return ret==0; +} + global boolean ExtendMd( integer nr, string dev ) { y2milestone( "ExtendMd nr:%1 dev:%2", nr, dev ); @@ -3150,6 +3270,19 @@ return( ret==0 ); } +global boolean ChangeMdParitySymbol( integer nr, symbol ptype ) +{ + y2milestone( "ChangeMdParitySymbol nr:%1 parity:%2", nr, ptype ); + integer ret = 0; + string rd = sformat("/dev/md%1", nr ); + integer tmp = fromSymbol(conv_mdparity, ptype); + ret = LibStorage::StorageInterface::changeMdParity(sint, rd, tmp); + if( ret<0 ) + y2error( "ChangeMdParitySymbol sint ret:%1", ret ); + UpdateTargetMapDev( rd ); + return( ret==0 ); +} + global boolean ChangeMdChunk( integer nr, integer chunk ) { y2milestone( "ChangeMdChunk nr:%1 chunk:%2", nr, chunk ); @@ -3173,6 +3306,22 @@ return( ret ); } +global integer ComputeMdSize(symbol md_type, list<string> devices, integer& sizeK) +{ + integer ret = 0; + + integer tmp = LibStorage::RAID_UNK(); + foreach(integer k, symbol v, conv_mdtype["m"]:$[], { + if (v == md_type) + tmp = k; + }); + + ret = LibStorage::StorageInterface::computeMdSize(sint, tmp, devices, sizeK); + if( ret!=0 ) + y2milestone( "ComputeMdSize sint ret:%1", ret ); + return ret; +} + global string CreateLoop( string file, boolean create, integer sizeK, string mp ) { @@ -3285,6 +3434,16 @@ return( ret==0 ); } + +global string DefaultDiskLabel(integer size_k) +{ + y2milestone("DefaultDiskLabel size_k:%1", size_k ); + string label = LibStorage::StorageInterface::defaultDiskLabelSize(sint, size_k); + y2milestone("DefaultDiskLabel label:%1", label); + return label; +} + + /** * Delete the partition table and disk label of device * @param string the disk to deleted the partition table from @@ -3305,6 +3464,18 @@ return( ret==0 ); } + +global boolean CreatePartitionTable(string disk, string label) +{ + y2milestone("CreatePartitionTable %1 label:%2", disk, label); + integer ret = LibStorage::StorageInterface::destroyPartitionTable(sint, disk, label); + if (ret < 0) + y2error("CreatePartitionTable sint ret:%1", ret); + UpdateTargetMap(); + return ret == 0; +} + + global symbol GetMountBy( string device ); /** @@ -3616,7 +3787,7 @@ disk = getDiskInfo( dev, disk ); integer s = disk["size_k"]:0 * 1024; disk["name"] = disk["dname"]:"" + - Partitions::ByteToHumanString( s ) + ", " + + Storage::ByteToHumanString( s ) + ", " + disk["device"]:"" + ", "; if( size( disk["vendor"]:"")>0 ) disk["name"] = disk["name"]:"" + disk["vendor"]:"" + "-"; @@ -6939,6 +7110,22 @@ } } + +global void SetDefaultMountBy(symbol mby) +{ + integer val = fromSymbol( conv_mountby, mby ); + LibStorage::StorageInterface::setDefaultMountBy(sint, val); +} + + +global symbol GetDefaultMountBy() +{ + integer val = LibStorage::StorageInterface::getDefaultMountBy(sint); + symbol ret = toSymbol(conv_mountby, val); + return ret; +} + + global symbol GetMountBy( string device ) { integer val = 0; Modified: trunk/storage/storage/src/storage_finish.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/storage_finis... ============================================================================== --- trunk/storage/storage/src/storage_finish.ycp (original) +++ trunk/storage/storage/src/storage_finish.ycp Fri Aug 1 10:57:04 2008 @@ -17,6 +17,7 @@ textdomain "storage"; import "Storage"; +import "StorageSettings"; import "Mode"; import "Installation"; import "Initrd"; @@ -76,6 +77,7 @@ SCR::Execute (.target.bash, "/sbin/vgscan"); } Storage::SaveUsedFs(); + StorageSettings::Save(); } else { Modified: trunk/storage/yast2-storage.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/yast2-storage.spec.in?rev... ============================================================================== --- trunk/storage/yast2-storage.spec.in (original) +++ trunk/storage/yast2-storage.spec.in Fri Aug 1 10:57:04 2008 @@ -4,10 +4,9 @@ @HEADER@ BuildRequires: blocxx-devel boost-devel gcc-c++ libxcrypt-devel openssl-devel sablot swig docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer sgml-skel update-desktop-files yast2 yast2-core-devel yast2-devtools yast2-testsuite yast2-perl-bindings Requires: parted yast2-storage-lib = %version yast2-perl-bindings mdadm lvm2 dmraid kpartx cryptsetup -# proc_meminfo.scr moved to yast2-2.15.23 -# Installation::installedVersion and Installation::updateVersion -# AutionstData -Requires: yast2 >= 2.16.8 +Requires: yast2-core >= 2.17.1 +Requires: yast2 >= 2.17.3 +Requires: yast2-libyui >= 2.17.5 %ifarch s390 s390x Requires: yast2-s390 %endif @@ -81,7 +80,6 @@ # disk %dir @desktopdir@ @desktopdir@/disk.desktop -@desktopdir@/lvm_config.desktop # scripts @ybindir@/check.boot -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org