[partition] Improve check canBeResized
- Report the globalSettings name properly (with "GiB") - Bail out on bad conversion early.
This commit is contained in:
parent
830e67fae2
commit
3548792d1b
@ -148,20 +148,23 @@ canBeResized( Partition* candidate )
|
||||
->globalStorage()
|
||||
->value( "requiredStorageGiB" )
|
||||
.toDouble( &ok );
|
||||
if ( !ok )
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// We require a little more for partitioning overhead and swap file
|
||||
double advisedStorageGB = requiredStorageGB + 0.5 + 2.0;
|
||||
qint64 availableStorageB = candidate->available();
|
||||
|
||||
qint64 advisedStorageB = CalamaresUtils::GiBtoBytes( advisedStorageGB );
|
||||
|
||||
if ( ok &&
|
||||
availableStorageB > advisedStorageB )
|
||||
if ( availableStorageB > advisedStorageB )
|
||||
{
|
||||
cDebug() << "Partition" << convenienceName( candidate ) << "authorized for resize + autopartition install.";
|
||||
|
||||
return true;
|
||||
}
|
||||
else if ( ok )
|
||||
else
|
||||
{
|
||||
Logger::CDebug deb;
|
||||
deb << Logger::SubEntry << "NO, insufficient storage";
|
||||
@ -173,11 +176,6 @@ canBeResized( Partition* candidate )
|
||||
<< "sectorsUsed:" << candidate->sectorsUsed() << "fsType:" << candidate->fileSystem().name();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "NO, requiredStorageGB is not set correctly.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user