Alona Kaplan has uploaded a new change for review. Change subject: webadmin: Disable revomal of plugged vnic on a runnig vm ......................................................................
webadmin: Disable revomal of plugged vnic on a runnig vm On Networks->Virtual Machines the remove action should be disabled if the vm is running and the vnic is plugged. Also, it should be disabled in all the vm states that are not UP or DOWN. Virtual Machines->Network interfaces already works correctly. Also a little code fix- there is no need to check the HotPlugEnabled property when deciding if the user can remove the vnic. It is enough to make sure the vnic is unplugged. If HotPlug is not enabled the vnic is always plugged. Change-Id: I795096615e8ef5118cceb56155aa6806af736ebb Bug-Url: https://bugzilla.redhat.com/910021 Signed-off-by: Alona Kaplan <[email protected]> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/networks/NetworkVmListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmInterfaceListModel.java 2 files changed, 14 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/74/11974/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/networks/NetworkVmListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/networks/NetworkVmListModel.java index d999679..82662dc 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/networks/NetworkVmListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/networks/NetworkVmListModel.java @@ -5,11 +5,12 @@ import java.util.Comparator; import java.util.List; +import org.ovirt.engine.core.common.VdcActionUtils; +import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.businessentities.network.NetworkView; import org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface; -import org.ovirt.engine.core.common.queries.ConfigurationValues; import org.ovirt.engine.core.common.queries.GetVmsAndNetworkInterfacesByNetworkIdParameters; import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; import org.ovirt.engine.core.common.queries.VdcQueryType; @@ -20,7 +21,6 @@ import org.ovirt.engine.ui.frontend.INewAsyncCallback; import org.ovirt.engine.ui.uicommonweb.Linq; import org.ovirt.engine.ui.uicommonweb.UICommand; -import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; import org.ovirt.engine.ui.uicommonweb.models.SearchableListModel; import org.ovirt.engine.ui.uicommonweb.models.vms.RemoveVmInterfaceModel; import org.ovirt.engine.ui.uicompat.ConstantsManager; @@ -134,7 +134,17 @@ } private void updateActionAvailability() { - getRemoveCommand().setIsExecutionAllowed(getSelectedItems() != null && !getSelectedItems().isEmpty() + ArrayList<VM> vms = new ArrayList<VM>(); + List<PairQueryable<VmNetworkInterface, VM>> selectedItems = + getSelectedItems() != null ? getSelectedItems() : new ArrayList(); + for (PairQueryable<VmNetworkInterface, VM> item : selectedItems) + { + vms.add(item.getSecond()); + } + + getRemoveCommand().setIsExecutionAllowed(VdcActionUtils.CanExecute(vms, + VM.class, + VdcActionType.RemoveVmInterface) && getSelectedItems() != null && !getSelectedItems().isEmpty() && canRemoveVnics()); } @@ -147,14 +157,7 @@ for (PairQueryable<VmNetworkInterface, VM> pair : selectedItems) { - Boolean isActivateSupported = - (Boolean) AsyncDataProvider.GetConfigValuePreConverted(ConfigurationValues.HotPlugEnabled, - pair.getSecond().getVdsGroupCompatibilityVersion().toString()); - isActivateSupported = isActivateSupported != null ? isActivateSupported : false; - - // If the vm is up and the vnic is active- remove enabled just if hotplug is enabled on the cluster's - // version - if (!isActivateSupported && pair.getFirst().isPlugged() + if (pair.getFirst().isPlugged() && !VMStatus.Down.equals(pair.getSecond().getStatus())) { return false; 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 3e7bad2..c1e792d 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 @@ -230,10 +230,6 @@ return true; } - if (!isHotPlugSupported) { - return false; - } - ArrayList<VmNetworkInterface> nics = getSelectedItems() != null ? Linq.<VmNetworkInterface> Cast(getSelectedItems()) : new ArrayList<VmNetworkInterface>(); -- To view, visit http://gerrit.ovirt.org/11974 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I795096615e8ef5118cceb56155aa6806af736ebb Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alona Kaplan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
