Disable OperationStack merging of operations for luks partitions.

This commit is contained in:
Andrius Štikonas 2016-05-18 13:13:51 +01:00
parent 541e89a476
commit aec564f1a2
1 changed files with 11 additions and 6 deletions

View File

@ -68,15 +68,15 @@ OperationStack::~OperationStack()
<!-- 1 -->
<li>An existing operation created a Partition that is now being deleted: In this case, just remove
the corresponding NewOperation from the OperationStack.<br/>This does not work for
extended partitions.(#232092)</li>
extended partitions (#232092) and luks partitions.</li>
<!-- 2 -->
<li>An existing Operation created a Partition that is now being moved or resized. In this case,
remove the original NewOperation and create a new NewOperation with updated start and end
sectors. This new NewOperation is appended to the OperationStack.<br/>This does not work for
extended partitions.(#232092)</li>
extended partitions(#232092) and luks partitions.</li>
<!-- 3 -->
<li>An existing NewOperation created a Partition that is now being copied. We're not copying
but instead creating another new Partition in its place.</li>
but instead creating another new Partition in its place. This does not work for luks partitions.</li>
<!-- 4 -->
<li>The label for a new Partition's FileSystem is modified: Modify in NewOperation and forget it.</li>
<!-- 5 -->
@ -105,7 +105,9 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed
CheckOperation* pushedCheckOp = dynamic_cast<CheckOperation*>(pushedOp);
// -- 1 --
if (pushedDeleteOp && &newOp->newPartition() == &pushedDeleteOp->deletedPartition() && !pushedDeleteOp->deletedPartition().roles().has(PartitionRole::Extended)) {
if (pushedDeleteOp && &newOp->newPartition() == &pushedDeleteOp->deletedPartition() &&
!pushedDeleteOp->deletedPartition().roles().has(PartitionRole::Extended) &&
!pushedDeleteOp->deletedPartition().roles().has(PartitionRole::Luks)) {
Log() << i18nc("@info/plain", "Deleting a partition just created: Undoing the operation to create the partition.");
delete pushedOp;
@ -118,7 +120,9 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed
}
// -- 2 --
if (pushedResizeOp && &newOp->newPartition() == &pushedResizeOp->partition() && !pushedResizeOp->partition().roles().has(PartitionRole::Extended)) {
if (pushedResizeOp && &newOp->newPartition() == &pushedResizeOp->partition() &&
!pushedResizeOp->partition().roles().has(PartitionRole::Extended) &&
!pushedResizeOp->partition().roles().has(PartitionRole::Luks)) {
// NOTE: In theory it would be possible to merge resizing an extended as long as it has no children.
// But that still doesn't save us: If we're not merging a resize on an extended that has children,
// a resizeop is added to the stack. Next, the user deletes the child. Then he resizes the
@ -143,7 +147,8 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed
}
// -- 3 --
if (pushedCopyOp && &newOp->newPartition() == &pushedCopyOp->sourcePartition()) {
if (pushedCopyOp && &newOp->newPartition() == &pushedCopyOp->sourcePartition() &&
!pushedCopyOp->sourcePartition().roles().has(PartitionRole::Luks)) {
Log() << i18nc("@info/plain", "Copying a new partition: Creating a new partition instead.");
Partition* newPartition = new Partition(newOp->newPartition());