Retry mke2fs before giving up.
This commit is contained in:
parent
7c89bc87ce
commit
d6676b2245
@ -1,7 +1,7 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||||
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
FormatPartitionJob::FormatPartitionJob( Device* device, Partition* partition )
|
FormatPartitionJob::FormatPartitionJob( Device* device, Partition* partition )
|
||||||
: PartitionJob( partition )
|
: PartitionJob( partition )
|
||||||
@ -101,10 +102,27 @@ FormatPartitionJob::exec()
|
|||||||
}
|
}
|
||||||
|
|
||||||
FileSystem& fs = m_partition->fileSystem();
|
FileSystem& fs = m_partition->fileSystem();
|
||||||
if ( !fs.create( report, partitionPath ) )
|
|
||||||
|
bool ok = fs.create( report, partitionPath );
|
||||||
|
int retries = 0;
|
||||||
|
const int MAX_RETRIES = 10;
|
||||||
|
while ( !ok )
|
||||||
|
{
|
||||||
|
cDebug() << "Partition" << m_partition->partitionPath()
|
||||||
|
<< "might not be ready yet, retrying (" << ++retries
|
||||||
|
<< "/" << MAX_RETRIES << ") ...";
|
||||||
|
QThread::sleep( 2 /*seconds*/ );
|
||||||
|
ok = fs.create( report, partitionPath );
|
||||||
|
|
||||||
|
if ( retries == MAX_RETRIES )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !ok )
|
||||||
{
|
{
|
||||||
return Calamares::JobResult::error(
|
return Calamares::JobResult::error(
|
||||||
tr( "The installer failed to create file system on partition %1." ).arg( partitionPath ),
|
tr( "The installer failed to create file system on partition %1." )
|
||||||
|
.arg( partitionPath ),
|
||||||
report.toText()
|
report.toText()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user