Skip to content

Commit

Permalink
core: copy disk will set the correct allocation policy for the new co…
Browse files Browse the repository at this point in the history
…pied disk

while coping disk that has incremental  backup flag up and set to be preallocated
the new copied disk will change the allocation policy to thin provition.
now it will change allocation policy to be the same as it was set on the original disk

Bug-Url: https://bugzilla.redhat.com/2072423
Signed-off-by: Artiom Divak <adivak@redhat.com>
  • Loading branch information
ArtiomDivak committed May 29, 2022
1 parent 9979165 commit 1dd9286
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ private void createVolume() {
parameters.setParentCommand(getActionType());
parameters.setParentParameters(getParameters());
parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED);
parameters.setBackup(getDiskImage().getBackup());
runInternalAction(ActionType.CreateVolumeContainer, parameters);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.ovirt.engine.core.common.action.ActionType;
import org.ovirt.engine.core.common.action.CreateVolumeContainerCommandParameters;
import org.ovirt.engine.core.common.asynctasks.AsyncTaskType;
import org.ovirt.engine.core.common.businessentities.storage.DiskBackup;
import org.ovirt.engine.core.common.businessentities.storage.DiskContentType;
import org.ovirt.engine.core.common.businessentities.storage.DiskImage;
import org.ovirt.engine.core.common.businessentities.storage.VolumeFormat;
Expand Down Expand Up @@ -85,6 +86,10 @@ private VolumeType getType() {
return getParameters().getVolumeType();
}

if(getParameters().getBackup() == DiskBackup.Incremental) {
return getParameters().getVolumeType();
}

// For raw volume on file-based domain we cannot determine
// the type according to the format because since 4.3 engine support
// raw-preallocate file volume on a file-based storage domain
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.ovirt.engine.core.common.action;

import org.ovirt.engine.core.common.businessentities.storage.DiskBackup;
import org.ovirt.engine.core.common.businessentities.storage.VolumeFormat;
import org.ovirt.engine.core.common.businessentities.storage.VolumeType;
import org.ovirt.engine.core.compat.Guid;
Expand All @@ -13,6 +14,8 @@ public class CreateVolumeContainerCommandParameters extends StorageJobCommandPar
private Long initialSize;
private boolean legal = true;

private DiskBackup backup;

private Integer sequenceNumber;

public CreateVolumeContainerCommandParameters() {
Expand Down Expand Up @@ -100,4 +103,13 @@ public Integer getSequenceNumber() {
public void setSequenceNumber(Integer sequenceNumber) {
this.sequenceNumber = sequenceNumber;
}

public DiskBackup getBackup() {
return backup;
}

public void setBackup(DiskBackup backup) {
this.backup = backup;
}

}

0 comments on commit 1dd9286

Please sign in to comment.