Tal Nisan has uploaded a new change for review. Change subject: webadmin: Disallow host selection as SPM if data center is not up ......................................................................
webadmin: Disallow host selection as SPM if data center is not up Disable the Select as SPM button in case that the host's data center is not in Up status Bug-Url: https://bugzilla.redhat.com/1073860 Change-Id: I902e9f54d18a6c191034538306ef6e7ca37c677b Signed-off-by: Tal Nisan <[email protected]> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java 1 file changed, 17 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/48/28148/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java index b58752f..d0caffa 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java @@ -32,6 +32,7 @@ import org.ovirt.engine.core.common.businessentities.Provider; import org.ovirt.engine.core.common.businessentities.RoleType; import org.ovirt.engine.core.common.businessentities.StoragePool; +import org.ovirt.engine.core.common.businessentities.StoragePoolStatus; import org.ovirt.engine.core.common.businessentities.Tags; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSGroup; @@ -1959,7 +1960,7 @@ getNewCommand().setIsAvailable(isAvailable); getRemoveCommand().setIsAvailable(isAvailable); - getSelectAsSpmCommand().setIsExecutionAllowed(isSelectAsSpmCommandAllowed(items)); + setSelectAsSpmCommandAllowed(items); updateConfigureLocalStorageCommandAvailability(); @@ -2175,22 +2176,32 @@ } - private boolean isSelectAsSpmCommandAllowed(List<VDS> selectedItems) { + private void setSelectAsSpmCommandAllowed(List<VDS> selectedItems) { if (selectedItems.size() != 1) { - return false; + getSelectAsSpmCommand().setIsExecutionAllowed(false); + return; } VDS vds = selectedItems.get(0); if (vds.getStatus() != VDSStatus.Up || vds.getSpmStatus() != VdsSpmStatus.None) { - return false; + getSelectAsSpmCommand().setIsExecutionAllowed(false); + return; } if (vds.getVdsSpmPriority() == BusinessEntitiesDefinitions.HOST_MIN_SPM_PRIORITY) { - return false; + getSelectAsSpmCommand().setIsExecutionAllowed(false); + return; } - return true; + AsyncDataProvider.getDataCenterById(new AsyncQuery(this, + new INewAsyncCallback() { + @Override + public void onSuccess(Object target, Object returnValue) { + StoragePool storagePool = (StoragePool) returnValue; + getSelectAsSpmCommand().setIsExecutionAllowed(storagePool.getStatus() == StoragePoolStatus.Up); + } + }), vds.getStoragePoolId()); } // @Override -- To view, visit http://gerrit.ovirt.org/28148 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I902e9f54d18a6c191034538306ef6e7ca37c677b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tal Nisan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
