Commit ee49c05d authored by Andrius Štikonas's avatar Andrius Štikonas

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

parent ca0def38
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment