Maor Lipchuk has uploaded a new change for review. Change subject: core: Make all commands to subjectEntity ......................................................................
core: Make all commands to subjectEntity Update all Cinder related commands to use subject entity as part of the COCO infrastructure. Change-Id: I55b1be7272121620477d7bd0c8f9ba47517654ac Bug-Url: https://bugzilla.redhat.com/1185826 Signed-off-by: Maor Lipchuk <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmCinderDisksCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java 8 files changed, 27 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/40676/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java index 350e6a9..38e5f49 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java @@ -37,6 +37,7 @@ import org.ovirt.engine.core.common.businessentities.StoragePool; import org.ovirt.engine.core.common.businessentities.StoragePoolIsoMapId; import org.ovirt.engine.core.common.businessentities.StorageServerConnections; +import org.ovirt.engine.core.common.businessentities.SubjectEntity; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VmDevice; @@ -500,7 +501,8 @@ Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.AddCinderDisk, buildAddCinderDiskParameters(), - cloneContextAndDetachFromParent()); + cloneContextAndDetachFromParent(), + new SubjectEntity(VdcObjectType.Storage, getParameters().getStorageDomainId())); try { setReturnValue(future.get()); setSucceeded(getReturnValue().getSucceeded()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java index fd898ce..f1c40da 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java @@ -26,8 +26,9 @@ import org.ovirt.engine.core.bll.quota.QuotaStorageDependent; import org.ovirt.engine.core.bll.quota.QuotaVdsDependent; import org.ovirt.engine.core.bll.snapshots.SnapshotsManager; -import org.ovirt.engine.core.bll.utils.IconUtils; +import org.ovirt.engine.core.bll.storage.CINDERStorageHelper; import org.ovirt.engine.core.bll.tasks.CommandCoordinatorUtil; +import org.ovirt.engine.core.bll.utils.IconUtils; import org.ovirt.engine.core.bll.utils.PermissionSubject; import org.ovirt.engine.core.bll.utils.VmDeviceUtils; import org.ovirt.engine.core.bll.validator.IconValidator; @@ -1132,10 +1133,12 @@ protected void addVmCinderDisks(List<CinderDisk> templateDisks) { List<CinderDisk> cinderDisks = ImagesHandler.filterDisksBasedOnCinder(templateDisks); + Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.CloneCinderDisks, buildCinderChildCommandParameters(cinderDisks, getVmSnapshotId()), - cloneContextAndDetachFromParent()); + cloneContextAndDetachFromParent(), + CINDERStorageHelper.getStorageEntitiesForCoco(cinderDisks)); try { Map<Guid, Guid> diskImageMap = future.get().getActionReturnValue(); srcDiskIdToTargetDiskIdMapping.putAll(diskImageMap); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java index f8469b0..e940cf8 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java @@ -25,6 +25,7 @@ import org.ovirt.engine.core.bll.quota.QuotaStorageDependent; import org.ovirt.engine.core.bll.quota.QuotaVdsDependent; import org.ovirt.engine.core.bll.snapshots.SnapshotsValidator; +import org.ovirt.engine.core.bll.storage.CINDERStorageHelper; import org.ovirt.engine.core.bll.tasks.CommandCoordinatorUtil; import org.ovirt.engine.core.bll.utils.PermissionSubject; import org.ovirt.engine.core.bll.utils.VmDeviceUtils; @@ -712,7 +713,8 @@ Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.CloneCinderDisks, buildCinderChildCommandParameters(cinderDisks, getVmSnapshotId()), - cloneContextAndDetachFromParent()); + cloneContextAndDetachFromParent(), + CINDERStorageHelper.getStorageEntitiesForCoco(cinderDisks)); try { VdcReturnValueBase vdcReturnValueBase = future.get(); if (vdcReturnValueBase.getSucceeded()) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmCinderDisksCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmCinderDisksCommand.java index ca01c38..fc4d91f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmCinderDisksCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmCinderDisksCommand.java @@ -10,10 +10,12 @@ import org.ovirt.engine.core.bll.context.CommandContext; import org.ovirt.engine.core.bll.tasks.CommandCoordinatorUtil; import org.ovirt.engine.core.bll.tasks.interfaces.CommandCallback; +import org.ovirt.engine.core.common.VdcObjectType; import org.ovirt.engine.core.common.action.RemoveAllVmCinderDisksParameters; import org.ovirt.engine.core.common.action.RemoveDiskParameters; import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdcReturnValueBase; +import org.ovirt.engine.core.common.businessentities.SubjectEntity; import org.ovirt.engine.core.common.businessentities.storage.CinderDisk; import org.ovirt.engine.core.common.businessentities.storage.DiskImage; import org.ovirt.engine.core.dal.dbbroker.DbFacade; @@ -54,7 +56,8 @@ Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveCinderDisk, buildChildCommandParameters(cinderDisk), - cloneContextAndDetachFromParent()); + cloneContextAndDetachFromParent(), + new SubjectEntity(VdcObjectType.Storage, cinderDisk.getStorageIds().get(0))); try { return future.get(); } catch (InterruptedException | ExecutionException e) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java index 5202e03..475e112 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java @@ -32,6 +32,7 @@ import org.ovirt.engine.core.common.asynctasks.EntityInfo; import org.ovirt.engine.core.common.businessentities.ActionGroup; import org.ovirt.engine.core.common.businessentities.StoragePool; +import org.ovirt.engine.core.common.businessentities.SubjectEntity; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VmDevice; @@ -308,7 +309,8 @@ Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveCinderDisk, new RemoveDiskParameters(getParameters().getDiskId()), - cloneContextAndDetachFromParent()); + cloneContextAndDetachFromParent(), + new SubjectEntity(VdcObjectType.Storage, getParameters().getStorageDomainId())); try { setReturnValue(future.get()); setSucceeded(getReturnValue().getSucceeded()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java index 7c68075..7d42941 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java @@ -20,6 +20,7 @@ import org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter; import org.ovirt.engine.core.bll.quota.QuotaStorageDependent; import org.ovirt.engine.core.bll.snapshots.SnapshotsValidator; +import org.ovirt.engine.core.bll.storage.CINDERStorageHelper; import org.ovirt.engine.core.bll.tasks.CommandCoordinatorUtil; import org.ovirt.engine.core.bll.tasks.TaskHandlerCommand; import org.ovirt.engine.core.bll.utils.PermissionSubject; @@ -360,7 +361,8 @@ Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveAllVmCinderDisks, withRootCommandInfo(param, getActionType()), - cloneContextAndDetachFromParent()); + cloneContextAndDetachFromParent(), + CINDERStorageHelper.getStorageEntitiesForCoco(cinderDisks)); try { failedRemoveCinderDisks = future.get().getActionReturnValue(); } catch (InterruptedException | ExecutionException e) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java index 98ca218..4a63b51 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java @@ -15,6 +15,7 @@ import org.ovirt.engine.core.bll.quota.QuotaConsumptionParameter; import org.ovirt.engine.core.bll.quota.QuotaStorageConsumptionParameter; import org.ovirt.engine.core.bll.quota.QuotaStorageDependent; +import org.ovirt.engine.core.bll.storage.CINDERStorageHelper; import org.ovirt.engine.core.bll.tasks.CommandCoordinatorUtil; import org.ovirt.engine.core.bll.validator.storage.DiskImagesValidator; import org.ovirt.engine.core.bll.validator.storage.StoragePoolValidator; @@ -246,7 +247,8 @@ Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand(VdcActionType.RemoveAllVmCinderDisks, withRootCommandInfo(removeParam, getActionType()), - cloneContextAndDetachFromParent()); + cloneContextAndDetachFromParent(), + CINDERStorageHelper.getStorageEntitiesForCoco(cinderDisks)); try { future.get().getActionReturnValue(); } catch (InterruptedException | ExecutionException e) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java index 7362003..3503bd4 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java @@ -38,6 +38,7 @@ import org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType; import org.ovirt.engine.core.common.businessentities.StorageDomain; import org.ovirt.engine.core.common.businessentities.StorageDomainStatic; +import org.ovirt.engine.core.common.businessentities.SubjectEntity; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VmDevice; @@ -555,7 +556,8 @@ Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.ExtendCinderDisk, buildExtendCinderDiskParameters(newCinderDisk), - cloneContextAndDetachFromParent()); + cloneContextAndDetachFromParent(), + new SubjectEntity(VdcObjectType.Storage, newCinderDisk.getStorageIds().get(0))); addCustomValue("NewSize", String.valueOf(getNewDiskSizeInGB())); try { setReturnValue(future.get()); -- To view, visit https://gerrit.ovirt.org/40676 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I55b1be7272121620477d7bd0c8f9ba47517654ac Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
