commit
7f968e0c83
4
CHANGES
4
CHANGES
@ -21,6 +21,10 @@ This release contains contributions from (alphabetically by first name):
|
|||||||
|
|
||||||
## Modules ##
|
## Modules ##
|
||||||
|
|
||||||
|
- *partition* Now has its own setting for *requiredStorage*, duplicating
|
||||||
|
the same setting in the *welcome* module. This is useful for
|
||||||
|
configurations where no *welcome* module is used, but a minimum
|
||||||
|
size must be checked anyway. #1169
|
||||||
|
|
||||||
|
|
||||||
# 3.2.9 (2019-06-03) #
|
# 3.2.9 (2019-06-03) #
|
||||||
|
@ -78,6 +78,11 @@ constexpr int BytesToMiB( qint64 b )
|
|||||||
return int( b / 1024 / 1024 );
|
return int( b / 1024 / 1024 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr int BytesToGiB( qint64 b )
|
||||||
|
{
|
||||||
|
return int( b / 1024 / 1024 / 1024 );
|
||||||
|
}
|
||||||
|
|
||||||
constexpr qint64 alignBytesToBlockSize( qint64 bytes, qint64 blocksize )
|
constexpr qint64 alignBytesToBlockSize( qint64 bytes, qint64 blocksize )
|
||||||
{
|
{
|
||||||
qint64 blocks = bytes / blocksize;
|
qint64 blocks = bytes / blocksize;
|
||||||
|
@ -62,37 +62,55 @@ convenienceName( const Partition* const candidate )
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @brief Get the globalStorage setting for required space. */
|
||||||
|
static double
|
||||||
|
getRequiredStorageGiB( bool& ok )
|
||||||
|
{
|
||||||
|
return Calamares::JobQueue::instance()->globalStorage()->value( "requiredStorageGiB" ).toDouble( &ok );
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
canBeReplaced( Partition* candidate )
|
canBeReplaced( Partition* candidate )
|
||||||
{
|
{
|
||||||
if ( !candidate )
|
if ( !candidate )
|
||||||
|
{
|
||||||
|
cDebug() << "Partition* is NULL";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cDebug() << "Checking if" << convenienceName( candidate ) << "can be replaced.";
|
||||||
if ( candidate->isMounted() )
|
if ( candidate->isMounted() )
|
||||||
|
{
|
||||||
|
cDebug() << Logger::SubEntry << "NO, it is mounted.";
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
double requiredStorageGB = Calamares::JobQueue::instance()
|
double requiredStorageGiB = getRequiredStorageGiB( ok );
|
||||||
->globalStorage()
|
if ( !ok )
|
||||||
->value( "requiredStorageGiB" )
|
{
|
||||||
.toDouble( &ok );
|
cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
qint64 availableStorageB = candidate->capacity();
|
qint64 availableStorageB = candidate->capacity();
|
||||||
qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024;
|
qint64 requiredStorageB = CalamaresUtils::GiBtoBytes( requiredStorageGiB + 0.5 );
|
||||||
cDebug() << "Required storage B:" << requiredStorageB
|
|
||||||
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
|
|
||||||
cDebug() << "Storage capacity B:" << availableStorageB
|
|
||||||
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
|
|
||||||
<< "for" << convenienceName( candidate ) << " length:" << candidate->length();
|
|
||||||
|
|
||||||
if ( ok &&
|
if ( availableStorageB > requiredStorageB )
|
||||||
availableStorageB > requiredStorageB )
|
|
||||||
{
|
{
|
||||||
cDebug() << "Partition" << convenienceName( candidate ) << "authorized for replace install.";
|
cDebug() << "Partition" << convenienceName( candidate ) << "authorized for replace install.";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
else
|
||||||
|
{
|
||||||
|
Logger::CDebug deb;
|
||||||
|
deb << Logger::SubEntry << "NO, insufficient storage";
|
||||||
|
deb << Logger::Continuation << "Required storage B:" << requiredStorageB
|
||||||
|
<< QString( "(%1GiB)" ).arg( requiredStorageGiB );
|
||||||
|
deb << Logger::Continuation << "Available storage B:" << availableStorageB
|
||||||
|
<< QString( "(%1GiB)" ).arg( CalamaresUtils::BytesToGiB( availableStorageB ) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -144,40 +162,35 @@ canBeResized( Partition* candidate )
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
double requiredStorageGB = Calamares::JobQueue::instance()
|
double requiredStorageGiB = getRequiredStorageGiB( ok );
|
||||||
->globalStorage()
|
if ( !ok )
|
||||||
->value( "requiredStorageGiB" )
|
{
|
||||||
.toDouble( &ok );
|
cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// We require a little more for partitioning overhead and swap file
|
// We require a little more for partitioning overhead and swap file
|
||||||
double advisedStorageGB = requiredStorageGB + 0.5 + 2.0;
|
double advisedStorageGiB = requiredStorageGiB + 0.5 + 2.0;
|
||||||
qint64 availableStorageB = candidate->available();
|
qint64 availableStorageB = candidate->available();
|
||||||
|
qint64 advisedStorageB = CalamaresUtils::GiBtoBytes( advisedStorageGiB );
|
||||||
|
|
||||||
qint64 advisedStorageB = CalamaresUtils::GiBtoBytes( advisedStorageGB );
|
if ( availableStorageB > advisedStorageB )
|
||||||
|
|
||||||
if ( ok &&
|
|
||||||
availableStorageB > advisedStorageB )
|
|
||||||
{
|
{
|
||||||
cDebug() << "Partition" << convenienceName( candidate ) << "authorized for resize + autopartition install.";
|
cDebug() << "Partition" << convenienceName( candidate ) << "authorized for resize + autopartition install.";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ( ok )
|
else
|
||||||
{
|
{
|
||||||
Logger::CDebug deb;
|
Logger::CDebug deb;
|
||||||
deb << Logger::SubEntry << "NO, insufficient storage";
|
deb << Logger::SubEntry << "NO, insufficient storage";
|
||||||
deb << Logger::Continuation << "Required storage B:" << advisedStorageB
|
deb << Logger::Continuation << "Required storage B:" << advisedStorageB
|
||||||
<< QString( "(%1GB)" ).arg( advisedStorageGB );
|
<< QString( "(%1GiB)" ).arg( advisedStorageGiB );
|
||||||
deb << Logger::Continuation << "Available storage B:" << availableStorageB
|
deb << Logger::Continuation << "Available storage B:" << availableStorageB
|
||||||
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
|
<< QString( "(%1GiB)" ).arg( CalamaresUtils::BytesToGiB( availableStorageB ) )
|
||||||
<< "for" << convenienceName( candidate ) << "length:" << candidate->length()
|
<< "for" << convenienceName( candidate ) << "length:" << candidate->length()
|
||||||
<< "sectorsUsed:" << candidate->sectorsUsed() << "fsType:" << candidate->fileSystem().name();
|
<< "sectorsUsed:" << candidate->sectorsUsed() << "fsType:" << candidate->fileSystem().name();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
cDebug() << Logger::SubEntry << "NO, requiredStorageGB is not set correctly.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
|
|||||||
, m_widget( new QStackedWidget() )
|
, m_widget( new QStackedWidget() )
|
||||||
, m_choicePage( nullptr )
|
, m_choicePage( nullptr )
|
||||||
, m_manualPartitionPage( nullptr )
|
, m_manualPartitionPage( nullptr )
|
||||||
|
, m_requiredStorageGiB( 0.0 )
|
||||||
{
|
{
|
||||||
m_widget->setContentsMargins( 0, 0, 0, 0 );
|
m_widget->setContentsMargins( 0, 0, 0, 0 );
|
||||||
|
|
||||||
@ -371,6 +372,14 @@ PartitionViewStep::isAtEnd() const
|
|||||||
void
|
void
|
||||||
PartitionViewStep::onActivate()
|
PartitionViewStep::onActivate()
|
||||||
{
|
{
|
||||||
|
// If there's no setting (e.g. from the welcome page) for required storage
|
||||||
|
// then use ours, if it was set.
|
||||||
|
auto* gs = Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr;
|
||||||
|
if ( m_requiredStorageGiB >= 0.0 && gs && !gs->contains( "requiredStorageGiB" ) )
|
||||||
|
{
|
||||||
|
gs->insert( "requiredStorageGiB", m_requiredStorageGiB );
|
||||||
|
}
|
||||||
|
|
||||||
// if we're coming back to PVS from the next VS
|
// if we're coming back to PVS from the next VS
|
||||||
if ( m_widget->currentWidget() == m_choicePage &&
|
if ( m_widget->currentWidget() == m_choicePage &&
|
||||||
m_choicePage->currentChoice() == ChoicePage::Alongside )
|
m_choicePage->currentChoice() == ChoicePage::Alongside )
|
||||||
@ -564,6 +573,9 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
|
|
||||||
m_swapChoices = choices;
|
m_swapChoices = choices;
|
||||||
|
|
||||||
|
// Settings that overlap with the Welcome module
|
||||||
|
m_requiredStorageGiB = CalamaresUtils::getDouble( configurationMap, "requiredStorage", -1.0 );
|
||||||
|
|
||||||
// These gs settings seem to be unused (in upstream Calamares) outside of
|
// These gs settings seem to be unused (in upstream Calamares) outside of
|
||||||
// the partition module itself.
|
// the partition module itself.
|
||||||
gs->insert( "ensureSuspendToDisk", ensureSuspendToDisk );
|
gs->insert( "ensureSuspendToDisk", ensureSuspendToDisk );
|
||||||
|
@ -86,6 +86,8 @@ private:
|
|||||||
QFutureWatcher<void>* m_future;
|
QFutureWatcher<void>* m_future;
|
||||||
|
|
||||||
QSet< PartitionActions::Choices::SwapChoice > m_swapChoices;
|
QSet< PartitionActions::Choices::SwapChoice > m_swapChoices;
|
||||||
|
|
||||||
|
qreal m_requiredStorageGiB; // May duplicate setting in the welcome module
|
||||||
};
|
};
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( PartitionViewStepFactory )
|
CALAMARES_PLUGIN_FACTORY_DECLARATION( PartitionViewStepFactory )
|
||||||
|
@ -120,3 +120,15 @@ defaultFileSystemType: "ext4"
|
|||||||
# % of the available drive space if a '%' is appended to the value
|
# % of the available drive space if a '%' is appended to the value
|
||||||
# - minSize: minimum partition size (optional parameter)
|
# - minSize: minimum partition size (optional parameter)
|
||||||
# - maxSize: maximum partition size (optional parameter)
|
# - maxSize: maximum partition size (optional parameter)
|
||||||
|
|
||||||
|
# Checking for available storage
|
||||||
|
#
|
||||||
|
# This overlaps with the setting of the same name in the welcome module's
|
||||||
|
# requirements section. If nothing is set by the welcome module, this
|
||||||
|
# value is used instead. It is still a problem if there is no required
|
||||||
|
# size set at all, and the replace and resize options will not be offered
|
||||||
|
# if no required size is set.
|
||||||
|
#
|
||||||
|
# The value is in Gibibytes (GiB).
|
||||||
|
#
|
||||||
|
# requiredStorage: 3.5
|
||||||
|
Loading…
Reference in New Issue
Block a user