Frank Kobzik has uploaded a new change for review. Change subject: core: fix graphics types when creating pool ......................................................................
core: fix graphics types when creating pool This patch fixes the problem when creating vm pool via UI. Previously, graphics types of created pool weren't reset in the ui code which caused possible inheriting of graphics device from a template. Fixed by adding reseting of graphics devices to ui logic. Change-Id: I95a6208490709d263ab1bd6e4d5eb9cc6ecb769f Signed-off-by: Frantisek Kobzik <[email protected]> Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1177231 --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmAndAttachToPoolCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmPoolWithVmsParameters.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java 4 files changed, 10 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/18/36618/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmAndAttachToPoolCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmAndAttachToPoolCommand.java index 37df999..a64f391 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmAndAttachToPoolCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmAndAttachToPoolCommand.java @@ -56,6 +56,7 @@ private AddVmParameters buildAddVmParameters(VdcActionType action) { AddVmParameters parameters = new AddVmParameters(getParameters().getVmStaticData()); parameters.setDiskOperatorAuthzPrincipalDbId(getParameters().getDiskOperatorAuthzPrincipalDbId()); + parameters.getGraphicsDevices().putAll(getParameters().getGraphicsDevices()); if (action == VdcActionType.AddVmFromScratch) { parameters.setDiskInfoList(getParameters().getDiskInfoList()); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java index a1d1997..c4ed835 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommonVmPoolWithVmsCommand.java @@ -23,7 +23,6 @@ import org.ovirt.engine.core.common.action.VdcReturnValueBase; import org.ovirt.engine.core.common.businessentities.ArchitectureType; import org.ovirt.engine.core.common.businessentities.DiskImage; -import org.ovirt.engine.core.common.businessentities.GraphicsDevice; import org.ovirt.engine.core.common.businessentities.StorageDomain; import org.ovirt.engine.core.common.businessentities.StorageDomainType; import org.ovirt.engine.core.common.businessentities.VmBase; @@ -195,9 +194,7 @@ parameters.setRngDevice(rngDevice); } - for (GraphicsDevice graphicsDevice : getParameters().getGraphicsDevices()) { - parameters.getGraphicsDevices().put(graphicsDevice.getGraphicsType(), graphicsDevice); - } + parameters.getGraphicsDevices().putAll(getParameters().getGraphicsDevices()); return parameters; } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmPoolWithVmsParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmPoolWithVmsParameters.java index 2ee6dfd..20f8f6b 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmPoolWithVmsParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVmPoolWithVmsParameters.java @@ -1,6 +1,5 @@ package org.ovirt.engine.core.common.action; -import java.util.Collection; import java.util.HashMap; import java.util.Map; import javax.validation.Valid; @@ -107,11 +106,8 @@ this.balloonEnabled = isBallonEnabled; } - public Collection<GraphicsDevice> getGraphicsDevices() { - return graphicsDevices.values(); + public Map<GraphicsType, GraphicsDevice> getGraphicsDevices() { + return graphicsDevices; } - public void addGraphicsDevice(GraphicsDevice graphicsDevice) { - graphicsDevices.put(graphicsDevice.getGraphicsType(), graphicsDevice); - } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java index 43afffb..b4a6aaf 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java @@ -524,9 +524,12 @@ return; } - for (GraphicsType graphicsType : model.getGraphicsType().getSelectedItem().getBackingGraphicsType()) { - GraphicsDevice d = new GraphicsDevice(graphicsType.getCorrespondingDeviceType()); - params.addGraphicsDevice(d); + for (GraphicsType graphicsType : GraphicsType.values()) { + params.getGraphicsDevices().put(graphicsType, null); // reset + if (model.getGraphicsType().getSelectedItem().getBackingGraphicsType().contains(graphicsType)) { + GraphicsDevice d = new GraphicsDevice(graphicsType.getCorrespondingDeviceType()); + params.getGraphicsDevices().put(d.getGraphicsType(), d); + } } } -- To view, visit http://gerrit.ovirt.org/36618 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I95a6208490709d263ab1bd6e4d5eb9cc6ecb769f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Frank Kobzik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
