[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
participants (1)
-
fehr@svn.opensuse.org