Gustavo Frederico Temple Pedrosa has uploaded a new change for review. Change subject: webadmin: Vnic hotplug validation - Patch 2 of 2 ......................................................................
webadmin: Vnic hotplug validation - Patch 2 of 2 * This change adds an validation supports hotplug nic in the frontend. * Was added a validation to prevent an user to do an nic hotplug in an VM with status different of down. Change-Id: I2434386f98c31a8d0fe44011ecadecb732ded19a Signed-off-by: Gustavo Pedrosa <gustavo.pedr...@eldorado.org.br> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseEditVmInterfaceModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/EditTemplateInterfaceModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/EditVmInterfaceModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideVmInterfaceModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateInterfaceModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGuideModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java 9 files changed, 25 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/89/19189/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseEditVmInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseEditVmInterfaceModel.java index 09aab0e..32efb41 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseEditVmInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/BaseEditVmInterfaceModel.java @@ -6,6 +6,7 @@ import org.ovirt.engine.core.common.action.AddVmInterfaceParameters; import org.ovirt.engine.core.common.action.VdcActionParametersBase; import org.ovirt.engine.core.common.action.VdcActionType; +import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VmBase; import org.ovirt.engine.core.common.businessentities.network.VmInterfaceType; import org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface; @@ -21,15 +22,17 @@ public abstract class BaseEditVmInterfaceModel extends VmInterfaceModel { VmNetworkInterface nic; + VMStatus vmStatus; protected BaseEditVmInterfaceModel(VmBase vm, - Guid dcId, + VMStatus vmStatus, Guid dcId, Version clusterCompatibilityVersion, ArrayList<VmNetworkInterface> vmNicList, VmNetworkInterface nic, EntityModel sourceModel) { super(vm, dcId, clusterCompatibilityVersion, vmNicList, sourceModel, new EditProfileBehavior()); this.nic = nic; + this.vmStatus = vmStatus; setTitle(ConstantsManager.getInstance().getConstants().editNetworkInterfaceTitle()); setHashName("edit_network_interface_vms"); //$NON-NLS-1$ } @@ -69,7 +72,7 @@ .getMessages() .hotPlugNotSupported(getClusterCompatibilityVersion().toString())); } - getPlugged().setIsChangable(hotPlugSupported); + getPlugged().setIsChangable(hotPlugSupported || vmStatus.equals(VMStatus.Down)); initCommands(); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/EditTemplateInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/EditTemplateInterfaceModel.java index 8fe7fd3..ddd65bb 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/EditTemplateInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/EditTemplateInterfaceModel.java @@ -5,6 +5,7 @@ import org.ovirt.engine.core.common.action.AddVmTemplateInterfaceParameters; import org.ovirt.engine.core.common.action.VdcActionParametersBase; import org.ovirt.engine.core.common.action.VdcActionType; +import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VmBase; import org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface; import org.ovirt.engine.core.compat.Guid; @@ -32,7 +33,7 @@ ArrayList<VmNetworkInterface> vmNicList, VmNetworkInterface nic, EntityModel sourceModel) { - super(vm, dcId, clusterCompatibilityVersion, vmNicList, nic, sourceModel); + super(vm, VMStatus.Down, dcId, clusterCompatibilityVersion, vmNicList, nic, sourceModel); setTitle(ConstantsManager.getInstance().getConstants().editNetworkInterfaceTitle()); setHashName("edit_network_interface_tmps"); //$NON-NLS-1$ } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/EditVmInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/EditVmInterfaceModel.java index c6f4110..4b62253 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/EditVmInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/EditVmInterfaceModel.java @@ -33,7 +33,7 @@ ArrayList<VmNetworkInterface> vmNicList, VmNetworkInterface nic, EntityModel sourceModel) { - super(vmStatic, vm.getStoragePoolId(), clusterCompatibilityVersion, vmNicList, nic, sourceModel); + super(vmStatic, vm.getStatus(), vm.getStoragePoolId(), clusterCompatibilityVersion, vmNicList, nic, sourceModel); this.vm = vm; } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideVmInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideVmInterfaceModel.java index d3326c3..f669d08 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideVmInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewGuideVmInterfaceModel.java @@ -2,6 +2,7 @@ import java.util.ArrayList; +import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VmBase; import org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface; import org.ovirt.engine.core.compat.Guid; @@ -26,7 +27,7 @@ Version clusterCompatibilityVersion, ArrayList<VmNetworkInterface> vmNicList, EntityModel sourceModel) { - super(vm, dcId, clusterCompatibilityVersion, vmNicList, sourceModel); + super(vm, VMStatus.Down, dcId, clusterCompatibilityVersion, vmNicList, sourceModel); setTitle(ConstantsManager.getInstance().getConstants().newNetworkInterfaceTitle()); setHashName("new_network_interface_vms_guide"); //$NON-NLS-1$ } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateInterfaceModel.java index f940a19..75cb07a 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateInterfaceModel.java @@ -5,6 +5,7 @@ import org.ovirt.engine.core.common.action.AddVmTemplateInterfaceParameters; import org.ovirt.engine.core.common.action.VdcActionParametersBase; import org.ovirt.engine.core.common.action.VdcActionType; +import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VmBase; import org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface; import org.ovirt.engine.core.compat.Guid; @@ -30,7 +31,7 @@ Version clusterCompatibilityVersion, ArrayList<VmNetworkInterface> vmNicList, EntityModel sourceModel) { - super(vm, dcId, clusterCompatibilityVersion, vmNicList, sourceModel); + super(vm, VMStatus.Down, dcId, clusterCompatibilityVersion, vmNicList, sourceModel); setTitle(ConstantsManager.getInstance().getConstants().newNetworkInterfaceTitle()); setHashName("new_network_interface_tmps"); //$NON-NLS-1$ } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java index b320bb3..9d565fe 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmInterfaceModel.java @@ -5,6 +5,7 @@ import org.ovirt.engine.core.common.action.AddVmInterfaceParameters; import org.ovirt.engine.core.common.action.VdcActionParametersBase; import org.ovirt.engine.core.common.action.VdcActionType; +import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.VmBase; import org.ovirt.engine.core.common.businessentities.network.VmInterfaceType; import org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface; @@ -18,22 +19,25 @@ public class NewVmInterfaceModel extends VmInterfaceModel { + private final VMStatus vmStatus; + public static NewVmInterfaceModel createInstance(VmBase vm, - Guid dcId, + VMStatus vmStatus, Guid dcId, Version clusterCompatibilityVersion, ArrayList<VmNetworkInterface> vmNicList, EntityModel sourceModel) { - NewVmInterfaceModel instance = new NewVmInterfaceModel(vm, dcId, clusterCompatibilityVersion, vmNicList, sourceModel); + NewVmInterfaceModel instance = new NewVmInterfaceModel(vm, vmStatus, dcId, clusterCompatibilityVersion, vmNicList, sourceModel); instance.init(); return instance; } protected NewVmInterfaceModel(VmBase vm, - Guid dcId, + VMStatus vmStatus, Guid dcId, Version clusterCompatibilityVersion, ArrayList<VmNetworkInterface> vmNicList, EntityModel sourceModel) { super(vm, dcId, clusterCompatibilityVersion, vmNicList, sourceModel, new NewProfileBehavior()); + this.vmStatus = vmStatus; setTitle(ConstantsManager.getInstance().getConstants().newNetworkInterfaceTitle()); setHashName("new_network_interface_vms"); //$NON-NLS-1$ } @@ -61,8 +65,8 @@ .getMessages() .hotPlugNotSupported(getClusterCompatibilityVersion().toString())); } - getPlugged().setIsChangable(hotPlugSupported); - getPlugged().setEntity(true); + getPlugged().setIsChangable(hotPlugSupported || vmStatus.equals(VMStatus.Down)); + getPlugged().setEntity(hotPlugSupported || vmStatus.equals(VMStatus.Down)); initLinked(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGuideModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGuideModel.java index 25b8ccb..65fca12 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGuideModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmGuideModel.java @@ -147,7 +147,7 @@ } VmInterfaceModel model = - NewVmInterfaceModel.createInstance(getEntity().getStaticData(), getEntity().getStoragePoolId(), + NewVmInterfaceModel.createInstance(getEntity().getStaticData(), getEntity().getStatus(), getEntity().getStoragePoolId(), getEntity().getVdsGroupCompatibilityVersion(), nics, this); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java index 39549a5..5a87336 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java @@ -139,7 +139,7 @@ } VmInterfaceModel model = - NewVmInterfaceModel.createInstance(getEntity().getStaticData(), getEntity().getStoragePoolId(), + NewVmInterfaceModel.createInstance(getEntity().getStaticData(), getEntity().getStatus(), getEntity().getStoragePoolId(), getEntity().getVdsGroupCompatibilityVersion(), (ArrayList<VmNetworkInterface>) getItems(), this); setWindow(model); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java index a653aab..62ae9a9 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceModel.java @@ -84,8 +84,8 @@ this.clusterCompatibilityVersion = clusterCompatibilityVersion; hotPlugSupported = - (Boolean) AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.HotPlugEnabled, - clusterCompatibilityVersion.toString()); + (Boolean) AsyncDataProvider.getNicHotplugSupport(vm.getOsId(), + clusterCompatibilityVersion); hotUpdateSupported = (Boolean) AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.NetworkLinkingSupported, -- To view, visit http://gerrit.ovirt.org/19189 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2434386f98c31a8d0fe44011ecadecb732ded19a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gustavo Frederico Temple Pedrosa <gustavo.pedr...@eldorado.org.br> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches