Remove ResizeVolumeGroup operation from operation stack if it has no jobs.

This commit is contained in:
Andrius Štikonas 2016-11-07 18:56:26 +00:00
parent ca0def38f7
commit ee49c05d60
2 changed files with 18 additions and 0 deletions

View File

@ -31,6 +31,7 @@
#include "ops/setpartflagsoperation.h"
#include "ops/setfilesystemlabeloperation.h"
#include "ops/createpartitiontableoperation.h"
#include "ops/resizevolumegroupoperation.h"
#include "ops/checkoperation.h"
#include "jobs/setfilesystemlabeljob.h"
@ -395,6 +396,19 @@ bool OperationStack::mergeCreatePartitionTableOperation(Operation*& currentOp, O
return false;
}
bool OperationStack::mergeResizeVolumeGroupResizeOperation(Operation*& pushedOp)
{
ResizeVolumeGroupOperation* pushedResizeVolumeGroupOp = dynamic_cast<ResizeVolumeGroupOperation*>(pushedOp);
if (pushedResizeVolumeGroupOp && pushedResizeVolumeGroupOp->jobs().count() == 0) {
Log() << xi18nc("@info:status", "Resizing Volume Group, nothing to do.");
return true;
}
return false;
}
/** Pushes a new Operation on the OperationStack.
This method will call all methods that try to merge the new Operation with the
@ -408,6 +422,9 @@ void OperationStack::push(Operation* o)
{
Q_ASSERT(o);
if (mergeResizeVolumeGroupResizeOperation(o))
return;
for (auto currentOp = operations().rbegin(); currentOp != operations().rend(); ++currentOp) {
if (mergeNewOperation(*currentOp, o))
break;

View File

@ -98,6 +98,7 @@ protected:
bool mergePartFlagsOperation(Operation*& currentOp, Operation*& pushedOp);
bool mergePartLabelOperation(Operation*& currentOp, Operation*& pushedOp);
bool mergeCreatePartitionTableOperation(Operation*& currentOp, Operation*& pushedOp);
bool mergeResizeVolumeGroupResizeOperation(Operation*& pushedOp);
private:
Operations m_Operations;