[partition] Be chatty when deciding a partition isn't resizable
This commit is contained in:
parent
b798c27bc4
commit
14c72824f0
@ -80,26 +80,47 @@ bool
|
|||||||
canBeResized( Partition* candidate )
|
canBeResized( Partition* candidate )
|
||||||
{
|
{
|
||||||
if ( !candidate )
|
if ( !candidate )
|
||||||
|
{
|
||||||
|
cDebug() << "Partition* is NULL";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cDebug() << "Checking if" << candidate->partitionPath() << "can be resized.";
|
||||||
if ( !candidate->fileSystem().supportGrow() ||
|
if ( !candidate->fileSystem().supportGrow() ||
|
||||||
!candidate->fileSystem().supportShrink() )
|
!candidate->fileSystem().supportShrink() )
|
||||||
|
{
|
||||||
|
cDebug() << " .. filesystem" << candidate->fileSystem().name()
|
||||||
|
<< "does not support resize.";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ( KPMHelpers::isPartitionFreeSpace( candidate ) )
|
if ( KPMHelpers::isPartitionFreeSpace( candidate ) )
|
||||||
|
{
|
||||||
|
cDebug() << " .. partition is free space";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ( candidate->isMounted() )
|
if ( candidate->isMounted() )
|
||||||
|
{
|
||||||
|
cDebug() << " .. partition is mounted";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ( candidate->roles().has( PartitionRole::Primary ) )
|
if ( candidate->roles().has( PartitionRole::Primary ) )
|
||||||
{
|
{
|
||||||
PartitionTable* table = dynamic_cast< PartitionTable* >( candidate->parent() );
|
PartitionTable* table = dynamic_cast< PartitionTable* >( candidate->parent() );
|
||||||
if ( !table )
|
if ( !table )
|
||||||
|
{
|
||||||
|
cDebug() << " .. no partition table found";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ( table->numPrimaries() >= table->maxPrimaries() )
|
if ( table->numPrimaries() >= table->maxPrimaries() )
|
||||||
|
{
|
||||||
|
cDebug() << " .. partition table already has"
|
||||||
|
<< table->maxPrimaries() << "primary partitions.";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -136,11 +157,10 @@ bool
|
|||||||
canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
||||||
{
|
{
|
||||||
//FIXME: check for max partitions count on DOS MBR
|
//FIXME: check for max partitions count on DOS MBR
|
||||||
cDebug() << "checking if" << partitionPath << "can be resized.";
|
cDebug() << "Checking if" << partitionPath << "can be resized.";
|
||||||
QString partitionWithOs = partitionPath;
|
QString partitionWithOs = partitionPath;
|
||||||
if ( partitionWithOs.startsWith( "/dev/" ) )
|
if ( partitionWithOs.startsWith( "/dev/" ) )
|
||||||
{
|
{
|
||||||
cDebug() << partitionWithOs << "seems like a good path";
|
|
||||||
DeviceModel* dm = core->deviceModel();
|
DeviceModel* dm = core->deviceModel();
|
||||||
for ( int i = 0; i < dm->rowCount(); ++i )
|
for ( int i = 0; i < dm->rowCount(); ++i )
|
||||||
{
|
{
|
||||||
@ -148,10 +168,11 @@ canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
|||||||
Partition* candidate = KPMHelpers::findPartitionByPath( { dev }, partitionWithOs );
|
Partition* candidate = KPMHelpers::findPartitionByPath( { dev }, partitionWithOs );
|
||||||
if ( candidate )
|
if ( candidate )
|
||||||
{
|
{
|
||||||
cDebug() << "found Partition* for" << partitionWithOs;
|
cDebug() << " .. found Partition* for" << partitionWithOs;
|
||||||
return canBeResized( candidate );
|
return canBeResized( candidate );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cDebug() << " .. no Partition* found for" << partitionWithOs;
|
||||||
}
|
}
|
||||||
|
|
||||||
cDebug() << "Partition" << partitionWithOs << "CANNOT BE RESIZED FOR AUTOINSTALL.";
|
cDebug() << "Partition" << partitionWithOs << "CANNOT BE RESIZED FOR AUTOINSTALL.";
|
||||||
|
Loading…
Reference in New Issue
Block a user