Author: fehr Date: Thu Jul 28 12:31:50 2011 New Revision: 65064 URL: http://svn.opensuse.org/viewcvs/yast?rev=65064&view=rev Log: - fix proposal to change disklabel to gpt when EFI is required (bnc#707472) - version 2.17.108 Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Disk.cc branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/auto_part_create.ycp branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/custom_part_helptexts.ycp branches/SuSE-Code-11-SP2-Branch/storage/storage/src/inst_target_part.ycp branches/SuSE-Code-11-SP2-Branch/storage/storage/src/inst_target_selection.ycp branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/Storage.ycp branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/StorageProposal.ycp Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Disk.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Disk.cc?rev=65064&r1=65063&r2=65064&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Disk.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/Disk.cc Thu Jul 28 12:31:50 2011 @@ -1534,7 +1534,6 @@ Container::getCommitActions( l ); if( del_ptable ) { - l.remove_if(stage_is(DECREASE)); l.push_front(commitAction(DECREASE, staticType(), setDiskLabelText(false), this, true)); } } @@ -1586,6 +1585,7 @@ else { del_ptable = false; + detected_label = label; removeFromMemory(); } if( ret==0 ) @@ -1860,8 +1860,6 @@ if( detected_label != label ) { ret = doCreateLabel(); - if( ret==0 ) - detected_label = label; } if( ret==0 && gpt_enlarge ) { @@ -2411,6 +2409,8 @@ info.sectorSize = sectorSize(); info.cylSize = geometry.cylinderSize(); info.disklabel = labelName(); + if( label!=detected_label ) + info.orig_disklabel = detected_label; info.maxPrimary = maxPrimary(); info.extendedPossible = extendedPossible(); info.maxLogical = maxLogical(); Modified: branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h?rev=65064&r1=65063&r2=65064&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/libstorage/src/StorageInterface.h Thu Jul 28 12:31:50 2011 @@ -301,6 +301,7 @@ unsigned long sectors; unsigned int sectorSize; string disklabel; + string orig_disklabel; unsigned maxPrimary; bool extendedPossible; unsigned maxLogical; Modified: branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes?rev=65064&r1=65063&r2=65064&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/package/yast2-storage.changes Thu Jul 28 12:31:50 2011 @@ -2,6 +2,9 @@ Thu Jul 28 12:25:40 CEST 2011 - fehr@suse.de - remove subvol=@ from /etc/fstab to work around bnc#703204 +- fix proposal to change disklabel to gpt when EFI is + required (bnc#707472) +- version 2.17.108 ------------------------------------------------------------------- Tue Jul 26 12:21:56 CEST 2011 - aschnell@suse.de Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/auto_part_create.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/auto_part_create.ycp?rev=65064&r1=65063&r2=65064&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/auto_part_create.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/auto_part_create.ycp Thu Jul 28 12:31:50 2011 @@ -31,6 +31,11 @@ string vm = StorageProposal::GetProposalVM(); y2milestone( "create_partitions flex %1 vm %2", has_flex, vm ); disk["partitions"] = partitions; + if( StorageProposal::NeedNewDisklabel(disk) ) + { + tgmap[disk["device"]:"","disklabel"] = "gpt"; + tgmap[disk["device"]:"","del_ptable"] = true; + } map keep = find( map p, partitions, ``(!p["delete"]:false&&p["type"]:`unknown!=`free)); if( size(vm)==0 ) Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/custom_part_helptexts.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/custom_part_helptexts.ycp?rev=65064&r1=65063&r2=65064&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/custom_part_helptexts.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/include/custom_part_helptexts.ycp Thu Jul 28 12:31:50 2011 @@ -135,4 +135,13 @@ If you need to use this disk for installation, you should destroy the disk label in the expert partitioner.") ); } + +define string ia64_gpt_fix_text() + { + return( _("Warning: Your system states that is reqires an EFI +boot setup. Since the selected disk does not contain a +GPT disk label we create a GPT label on this disk. + +You need to mark all partitions on this disk for removal.") ); + } } Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/inst_target_part.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/inst_target_part.ycp?rev=65064&r1=65063&r2=65064&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/inst_target_part.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/inst_target_part.ycp Thu Jul 28 12:31:50 2011 @@ -247,7 +247,8 @@ } else if( ret == `next ) { - if( win_partition != $[] ) + ok = true; + if( ok && win_partition != $[] ) { if( UI::QueryWidget( `id(`resize), `Value) == true) { @@ -354,6 +355,7 @@ // now loop through partitions and check // if the partition is selected + boolean all_del = true; partitions = maplist( map p, partitions, ``{ y2milestone( "p:%1", p ); @@ -382,21 +384,31 @@ y2milestone ("Trailing `free partition marked for deletion"); } p["delete"] = selection; + if( all_del && (!selection && p["type"]:`dummy!=`free)) + all_del = false; } return( p ); }); - partitions = StorageProposal::try_remove_sole_extended( partitions ); - y2milestone ("partitions '%1'", partitions); - - ok = create_partitions( targetMap, target, partitions ); - if( !ok ) + if( !all_del && StorageProposal::NeedNewDisklabel(target) ) + { + Popup::Error( ia64_gpt_fix_text() ); + ok = false; + } + if( ok ) { - string reason = _("Too few partitions are marked for removal -or the disk is too small. + partitions = StorageProposal::try_remove_sole_extended( partitions ); + y2milestone ("partitions '%1'", partitions); + + ok = create_partitions( targetMap, target, partitions ); + if( !ok ) + { + string reason = _("Too few partitions are marked for removal or +the disk is too small. To install Linux, select more partitions to remove or select a larger disk."); - display_error_box (reason); + display_error_box (reason); + } } } } // while (true) Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/inst_target_selection.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/inst_target_selection.ycp?rev=65064&r1=65063&r2=65064&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/inst_target_selection.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/inst_target_selection.ycp Thu Jul 28 12:31:50 2011 @@ -230,11 +230,6 @@ Popup::Error( Partitions::RdonlyText( (string)option, true )); sym = `again; } - else if( (Partitions::EfiBoot() || Arch::ia64()) && targetMap[(string)option,"label"]:"gpt"!="gpt" ) - { - Popup::Error( ia64_gpt_text() ); - sym = `again; - } else { Storage::SetPartMode( "USE_DISK" ); Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/Storage.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/Storage.ycp?rev=65064&r1=65063&r2=65064&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/Storage.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/Storage.ycp Thu Jul 28 12:31:50 2011 @@ -1220,6 +1220,9 @@ d["cyl_count"] = LibStorage::DiskInfo::swig_cyl_get(dinfo); d["sector_size"] = LibStorage::DiskInfo::swig_sectorSize_get(dinfo); d["label"] = LibStorage::DiskInfo::swig_disklabel_get(dinfo); + string tmp = LibStorage::DiskInfo::swig_orig_disklabel_get(dinfo); + if( size(tmp)>0 ) + d["orig_label"] = tmp; d["max_logical"] = LibStorage::DiskInfo::swig_maxLogical_get(dinfo); d["max_primary"] = LibStorage::DiskInfo::swig_maxPrimary_get(dinfo); @@ -1738,7 +1741,7 @@ map toDiskMap( map disk, map cinfo ) { - list<string> l = [ "size_k", "cyl_size", "cyl_count", "sector_size", "label", "name", "device", + list<string> l = [ "size_k", "cyl_size", "cyl_count", "sector_size", "label", "orig_label", "name", "device", "max_logical", "max_primary", "type", "readonly", "transport", "iscsi", "used_by", "used_by_type", "used_by_device", "partitions", "dasdfmt", "udev_id", "udev_path" ]; Modified: branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/StorageProposal.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/StorageProposal.ycp?rev=65064&r1=65063&r2=65064&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/StorageProposal.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/storage/storage/src/modules/StorageProposal.ycp Thu Jul 28 12:31:50 2011 @@ -333,6 +333,19 @@ return no_propose_disks; } +global boolean NeedNewDisklabel( map entry ) + { + boolean ret = Partitions::EfiBoot(); + if( ret ) + { + string lab = entry["orig_label"]:""; + if( size(lab)==0 ) + lab = entry["label"]:"gpt"; + ret = lab!="gpt"; + } + y2milestone( "NeedNewDisklabel dev:%1 ret:%2", entry["device"]:"", ret ); + return( ret ); + } boolean ignore_disk(string dev, map entry, boolean soft) { @@ -342,6 +355,10 @@ { ret = true; } + if( !ret && soft && NeedNewDisklabel(entry) ) + { + ret = true; + } if( !ret && soft && Arch::board_iseries () && search( dev, "/dev/sd" )==0 ) { ret = true; @@ -2800,6 +2817,7 @@ { list linux_pid = [ Partitions::fsid_native, Partitions::fsid_swap, Partitions::fsid_lvm, Partitions::fsid_raid ]; + list<string> remk = ["del_ptable", "disklabel"]; foreach( string s, ddev, ``{ tg[s,"partitions"] = @@ -2817,6 +2835,11 @@ p["linux"] = false; return( p ); }); + foreach( string k, remk, + ``{ + if( haskey( tg[s]:$[], k )) + tg[s] = remove( tg[s]:$[], k ); + }); }); return( tg ); } @@ -2994,7 +3017,6 @@ map opts = GetControlCfg(); list<string> ddev = get_disk_try_list( target, true ); string sol_disk = ""; - list modes = [ `free, `reuse, `remove, `resize, `desparate ]; map<string,boolean> valid = $[]; map<string,list> size_mb = listmap( string s, ddev, ``($[s:[]])); map solution = listmap( string s, ddev, ``($[s:[]])); @@ -3014,11 +3036,17 @@ ``{ target[s,"partitions"] = remove_p_settings( target[s,"partitions"]:[], [] ); + if( NeedNewDisklabel(target[s]:$[]) ) + { + target[s,"disklabel"] = "gpt"; + target[s,"del_ptable"] = true; + } target[s,"partitions"] = maplist( map p, target[s,"partitions"]:[], ``{ - if( !contains( Partitions::do_not_delete, - p["fsid"]:0 ) && + if( (NeedNewDisklabel(target[s]:$[]) || + !contains( Partitions::do_not_delete, + p["fsid"]:0 )) && Storage::CanDelete( p, target[s]:$[], false)) { if( usable_for_win_resize(p,false) ) @@ -3742,7 +3770,6 @@ } list<string> ddev = get_disk_try_list( target, true ); string sol_disk = ""; - list modes = [ `free, `remove, `resize, `desparate ]; map<string,boolean> valid = $[]; map<string,integer> size_mb = listmap( string s, ddev, ``($[s:0])); map<string,boolean> keep_vg = $[]; @@ -3763,11 +3790,17 @@ ``{ target[s,"partitions"] = remove_p_settings( target[s,"partitions"]:[], [] ); + if( NeedNewDisklabel(target[s]:$[]) ) + { + target[s,"disklabel"] = "gpt"; + target[s,"del_ptable"] = true; + } target[s,"partitions"] = maplist( map p, target[s,"partitions"]:[], ``{ - if( !contains( Partitions::do_not_delete, - p["fsid"]:0 ) && + if( (NeedNewDisklabel(target[s]:$[]) || + !contains( Partitions::do_not_delete, + p["fsid"]:0 )) && Storage::CanDelete( p, target[s]:$[], false)) { if( usable_for_win_resize(p,false) ) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org