Maor Lipchuk has uploaded a new change for review. Change subject: core: Use create all snapshot to use clone ......................................................................
core: Use create all snapshot to use clone Change-Id: Ifb8922e4eb057b8ba852246bec80bbbd392f95fe Bug-Url: https://bugzilla.redhat.com/?????? Signed-off-by: Maor Lipchuk <mlipc...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java 1 file changed, 28 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/40976/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java index f788931..100cf4d 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java @@ -6,6 +6,8 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; import org.ovirt.engine.core.bll.context.CommandContext; import org.ovirt.engine.core.bll.job.ExecutionHandler; @@ -19,6 +21,7 @@ import org.ovirt.engine.core.bll.quota.QuotaStorageDependent; import org.ovirt.engine.core.bll.snapshots.SnapshotsManager; import org.ovirt.engine.core.bll.snapshots.SnapshotsValidator; +import org.ovirt.engine.core.bll.tasks.CommandCoordinatorUtil; import org.ovirt.engine.core.bll.tasks.TaskHandlerCommand; import org.ovirt.engine.core.bll.validator.LiveSnapshotValidator; import org.ovirt.engine.core.bll.validator.VmValidator; @@ -30,6 +33,7 @@ import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.CreateAllSnapshotsFromVmParameters; import org.ovirt.engine.core.common.action.ImagesActionsParametersBase; +import org.ovirt.engine.core.common.action.ImagesContainterParametersBase; import org.ovirt.engine.core.common.action.LockProperties; import org.ovirt.engine.core.common.action.LockProperties.Scope; import org.ovirt.engine.core.common.action.RemoveMemoryVolumesParameters; @@ -46,6 +50,7 @@ import org.ovirt.engine.core.common.businessentities.storage.CinderDisk; import org.ovirt.engine.core.common.businessentities.storage.Disk; import org.ovirt.engine.core.common.businessentities.storage.DiskImage; +import org.ovirt.engine.core.common.businessentities.storage.DiskStorageType; import org.ovirt.engine.core.common.errors.VdcBLLException; import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.common.locks.LockingGroup; @@ -259,6 +264,29 @@ private void createSnapshotsForDisks() { for (DiskImage image : getDisksList()) { + if (image.getDiskStorageType() == DiskStorageType.CINDER) { + ImagesContainterParametersBase params = buildChildCommandParameters(disk); + Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( + VdcActionType.CloneSingleCinderDisk, + params, + cloneContextAndDetachFromParent()); + try { + VdcReturnValueBase vdcReturnValueBase = future.get(); + if (!vdcReturnValueBase.getSucceeded()) { + log.error("Error cloning Cinder disk '{}': {}", disk.getDiskAlias()); + getReturnValue().setFault(vdcReturnValueBase.getFault()); + isSucceeded = false; + break; + } + Guid imageId = vdcReturnValueBase.getActionReturnValue(); + diskImageMap.put(disk.getId(), imageId); + } catch (InterruptedException | ExecutionException e) { + log.error("Error cloning Cinder disk '{}': {}", disk.getDiskAlias(), e.getMessage()); + isSucceeded = false; + } + + + } VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction( VdcActionType.CreateSnapshot, buildCreateSnapshotParameters(image), -- To view, visit https://gerrit.ovirt.org/40976 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifb8922e4eb057b8ba852246bec80bbbd392f95fe Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches