[yast-commit] r38224 - in /trunk/storage: libstorage/src/Disk.cc libstorage/src/Disk.h package/yast2-storage.changes
Author: fehr Date: Thu May 31 15:54:15 2007 New Revision: 38224 URL: http://svn.opensuse.org/viewcvs/yast?rev=38224&view=rev Log: automatically increase GPT before creating partitions (#236404) Modified: trunk/storage/libstorage/src/Disk.cc trunk/storage/libstorage/src/Disk.h trunk/storage/package/yast2-storage.changes Modified: trunk/storage/libstorage/src/Disk.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.cc?rev=38224&r1=38223&r2=38224&view=diff ============================================================================== --- trunk/storage/libstorage/src/Disk.cc (original) +++ trunk/storage/libstorage/src/Disk.cc Thu May 31 15:54:15 2007 @@ -21,7 +21,8 @@ #include "y2storage/AppUtil.h" #include "y2storage/SystemCmd.h" -#define PARTEDCMD "/usr/sbin/parted -s " // blank at end !! +#define PARTEDBIN "/usr/sbin/parted" +#define PARTEDCMD PARTEDBIN " -s " // blank at end !! using namespace std; using namespace storage; @@ -30,7 +31,7 @@ unsigned long long SizeK ) : Container(s,"",staticType()) { - init_disk = dmp_slave = iscsi = false; + init_disk = dmp_slave = iscsi = gpt_enlarge = false; nm = Name; undevDevice(nm); logfile_name = nm; @@ -52,7 +53,7 @@ y2milestone( "constructed disk %s nr %u sizeK:%llu", Name.c_str(), num, SizeK ); logfile_name = Name + decString(num); - init_disk = dmp_slave = iscsi = false; + init_disk = dmp_slave = iscsi = gpt_enlarge = false; ronly = true; size_k = SizeK; head = new_head = 16; @@ -71,7 +72,7 @@ Disk::Disk( Storage * const s, const string& fname ) : Container(s,"",staticType()) { - init_disk = dmp_slave = iscsi = false; + init_disk = dmp_slave = iscsi = gpt_enlarge = false; nm = fname.substr( fname.find_last_of( '/' )+1); if( nm.find("disk_")==0 ) nm.erase( 0, 5 ); @@ -417,7 +418,8 @@ byte_cyl = head * sector * 512; y2milestone( "byte_cyl:%lu", byte_cyl ); } - y2milestone( "Label:%s", dlabel.c_str() ); + gpt_enlarge = Cmd.select( "fix the GPT to use all" )>0; + y2milestone( "Label:%s gpt_enlarge:%d", dlabel.c_str(), gpt_enlarge ); if( dlabel!="loop" ) { setLabelData( dlabel ); @@ -1857,6 +1859,7 @@ getStorage()->waitForDevice(); redetectGeometry(); } + gpt_enlarge = false; y2milestone( "ret:%d", ret ); return( ret ); } @@ -2082,9 +2085,24 @@ return( ret ); } +void Disk::enlargeGpt() + { + y2mil( "gpt_enlarge:" << gpt_enlarge ); + if( gpt_enlarge ) + { + string cmd_line( "yes Fix | " PARTEDBIN ); + cmd_line += " ---pretend-input-tty "; + cmd_line += device(); + cmd_line += " print "; + SystemCmd cmd( cmd_line ); + gpt_enlarge = false; + } + } + static bool logicalCreated( const Partition& p ) { return( p.type()==LOGICAL && p.created() ); } + int Disk::doCreate( Volume* v ) { Partition * p = dynamic_cast<Partition *>(v); @@ -2109,6 +2127,10 @@ if( ret==0 ) detected_label = label; } + if( ret==0 && gpt_enlarge ) + { + enlargeGpt(); + } std::ostringstream cmd_line; if( ret==0 ) { @@ -2576,6 +2598,8 @@ s << " iSCSI"; if( d.dmp_slave ) s << " DmpSlave"; + if( d.gpt_enlarge ) + s << " GptEnlarge"; return( s ); } @@ -2670,7 +2694,7 @@ ext_possible==rhs.ext_possible && max_logical==rhs.max_logical && init_disk==rhs.init_disk && label==rhs.label && iscsi==rhs.iscsi && sysfs_dir==rhs.sysfs_dir && - dmp_slave==rhs.dmp_slave; + dmp_slave==rhs.dmp_slave && gpt_enlarge==rhs.gpt_enlarge; if( ret ) { ConstPartPair p = partPair(); @@ -2712,6 +2736,7 @@ logfile_name = rhs.logfile_name; sysfs_dir = rhs.sysfs_dir; dmp_slave = rhs.dmp_slave; + gpt_enlarge = rhs.gpt_enlarge; return( *this ); } Modified: trunk/storage/libstorage/src/Disk.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Disk.h?rev=38224&r1=38223&r2=38224&view=diff ============================================================================== --- trunk/storage/libstorage/src/Disk.h (original) +++ trunk/storage/libstorage/src/Disk.h Thu May 31 15:54:15 2007 @@ -187,6 +187,7 @@ unsigned long len, bool checkRelaxed ); void removePresentPartitions(); void removeFromMemory(); + void enlargeGpt(); static bool notDeleted( const Partition&d ) { return( !d.deleted() ); } static bool bootSpecial( const Partition&d ) { return( !d.deleted()&&(d.id()==0x41||d.id()==0x06) ); } @@ -225,6 +226,7 @@ bool init_disk; bool iscsi; bool dmp_slave; + bool gpt_enlarge; unsigned max_logical; unsigned long byte_cyl; unsigned long range; Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=38224&r1=38223&r2=38224&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Thu May 31 15:54:15 2007 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Thu May 31 15:53:00 CEST 2007 - fehr@suse.de + +- automatically increase GPT before creating partitions (#236404) + +------------------------------------------------------------------- Tue May 29 16:20:34 CEST 2007 - aschnell@suse.de - fixed crash during detection (caused by empty key-value-pair) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
fehr@svn.opensuse.org