ofri masad has uploaded a new change for review. Change subject: webadmin: Fix vm pop-up host tab logic ......................................................................
webadmin: Fix vm pop-up host tab logic The logic of the host tab in the VM pop-up view was inconsistent. The EntityModel of the UnitVmModel migration support was changed to match the other models. UI was changed - instead on checkboxs which mutually exclude each other, a new list-box was added to select the migration mode. Change-Id: Ib4da1be4919913b7739f4139299d2c88958488d0 Bug-Url: https://bugzilla.redhat.com/905831 Signed-off-by: Ofri Masad <oma...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/pool/PoolNewPopupWidget.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java 13 files changed, 84 insertions(+), 191 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/06/12706/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java index baac7ef..7243a31 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java @@ -427,7 +427,7 @@ @DefaultStringValue("Run On:") String runOnVmPopup(); - @DefaultStringValue("Run/Migration Options:") + @DefaultStringValue("Migration Options:") String runMigrationOptionsVmPopup(); @DefaultStringValue("Priority for Run/Migration queue:") @@ -771,10 +771,6 @@ @DefaultStringValue("Down") String unlinkedNetworkInteface(); - - // Pool popup - @DefaultStringValue("Do not migrate VM") - String dontMigrageVmPoolPopup(); @DefaultStringValue("Number of VMs") String numOfVmsPoolPopup(); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java index 6c89a0f..cedd8b1 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.java @@ -4,6 +4,8 @@ import java.util.List; import java.util.Map.Entry; +import com.google.gwt.event.dom.client.ChangeEvent; +import com.google.gwt.event.dom.client.ChangeHandler; import org.ovirt.engine.core.common.businessentities.Disk; import org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType; import org.ovirt.engine.core.common.businessentities.DiskImage; @@ -292,19 +294,14 @@ protected DialogTab hostTab; @UiField(provided = true) - @Path(value = "runVMOnSpecificHost.entity") - @WithElementId("runVMOnSpecificHost") - public EntityModelCheckBoxEditor runVMOnSpecificHostEditor; - - @UiField(provided = true) @Path(value = "hostCpu.entity") @WithElementId("hostCpu") public EntityModelCheckBoxEditor hostCpuEditor; @UiField(provided = true) - @Path(value = "dontMigrateVM.entity") - @WithElementId("dontMigrateVM") - public EntityModelCheckBoxEditor dontMigrateVMEditor; + @Path(value = "migrationMode.selectedItem") + @WithElementId("migrationMode") + public ListModelListBoxEditor<Object> migrationModeEditor; @UiField(provided = true) @Ignore @@ -480,9 +477,7 @@ new MemorySizeRenderer(constants), new MemorySizeParser()); // TODO: How to align right without creating the widget manually? - runVMOnSpecificHostEditor = new EntityModelCheckBoxEditor(Align.RIGHT); hostCpuEditor = new EntityModelCheckBoxEditor(Align.RIGHT); - dontMigrateVMEditor = new EntityModelCheckBoxEditor(Align.RIGHT); isHighlyAvailableEditor = new EntityModelCheckBoxEditor(Align.RIGHT); isStatelessEditor = new EntityModelCheckBoxEditor(Align.RIGHT); isDeleteProtectedEditor = new EntityModelCheckBoxEditor(Align.RIGHT); @@ -652,6 +647,13 @@ } }); + migrationModeEditor = new ListModelListBoxEditor<Object>(new NullSafeRenderer<Object>() { + @Override + public String renderNullSafe(Object object) { + return ((EntityModel) object).getTitle(); + } + }); + // Resource Allocation provisioningThinEditor = new EntityModelRadioButtonEditor("provisioningGroup"); //$NON-NLS-1$ provisioningCloneEditor = new EntityModelRadioButtonEditor("provisioningGroup"); //$NON-NLS-1$ @@ -728,9 +730,7 @@ hostTab.setLabel(constants.hostVmPopup()); isAutoAssignEditor.setLabel(constants.anyHostInClusterVmPopup()); // specificHostEditor.setLabel("Specific"); - runVMOnSpecificHostEditor.setLabel(constants.runOnSelectedHostVmPopup()); hostCpuEditor.setLabel(constants.useHostCpu()); - dontMigrateVMEditor.setLabel(constants.allowMigrationOnlyAdminVmPopup()); cpuPinning.setLabel(constants.cpuPinningLabel()); cpuPinningLabel.setHTML(constants.cpuPinningLabelExplanation()); @@ -752,9 +752,7 @@ } private void applyStyles() { - runVMOnSpecificHostEditor.addContentWidgetStyleName(style.longCheckboxContent()); hostCpuEditor.addContentWidgetStyleName(style.longCheckboxContent()); - dontMigrateVMEditor.addContentWidgetStyleName(style.longCheckboxContent()); allowConsoleReconnectEditor.addContentWidgetStyleName(style.longCheckboxContent()); provisioningEditor.addContentWidgetStyleName(style.provisioningEditorContent()); provisioningThinEditor.addContentWidgetStyleName(style.provisioningRadioContent()); @@ -1102,9 +1100,8 @@ isAutoAssignEditor.setTabIndex(nextTabIndex++); specificHost.setTabIndex(nextTabIndex++); defaultHostEditor.setTabIndex(nextTabIndex++); - runVMOnSpecificHostEditor.setTabIndex(nextTabIndex++); + migrationModeEditor.setTabIndex(nextTabIndex++); hostCpuEditor.setTabIndex(nextTabIndex++); - dontMigrateVMEditor.setTabIndex(nextTabIndex++); cpuPinning.setTabIndex(nextTabIndex++); // ==High Availability Tab== diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml index 6aef823..0f7d091 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/AbstractVmPopupWidget.ui.xml @@ -199,6 +199,10 @@ .increaseVmsInPoolVms { float: left; } + + .migrationSelect { + margin-right: 174px; + } </ui:style> @@ -332,9 +336,8 @@ </g:VerticalPanel> <g:Label addStyleNames="{style.sectionLabel}" text="{constants.runMigrationOptionsVmPopup}" /> <g:VerticalPanel width="100%" addStyleNames="{style.hostRunMigrationOptions}"> - <e:EntityModelCheckBoxEditor ui:field="runVMOnSpecificHostEditor" addStyleNames="{style.checkbox}" /> + <e:ListModelListBoxEditor ui:field="migrationModeEditor" addStyleNames="{style.migrationSelect}"/> <e:EntityModelCheckBoxEditor ui:field="hostCpuEditor" addStyleNames="{style.checkbox}" /> - <e:EntityModelCheckBoxEditor ui:field="dontMigrateVMEditor" addStyleNames="{style.checkboxWithLongLabel}" /> </g:VerticalPanel> <e:EntityModelTextBoxEditor ui:field="cpuPinning" addStyleNames="{style.cpuPinningStyle}"/> <g:HTML ui:field="cpuPinningLabel" addStyleNames="{style.explanationLabel},generalDialogComment" /> diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/pool/PoolNewPopupWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/pool/PoolNewPopupWidget.java index b98c488..078feae 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/pool/PoolNewPopupWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/pool/PoolNewPopupWidget.java @@ -36,13 +36,6 @@ } @Override - protected void localize(CommonApplicationConstants constants) { - super.localize(constants); - - dontMigrateVMEditor.setLabel(constants.dontMigrageVmPoolPopup()); - } - - @Override public void edit(final UnitVmModel object) { super.edit(object); initTabAvailabilityListeners(object); 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 f955970..db7e5b6 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 @@ -467,15 +467,7 @@ default_host = defaultHost.getId(); } - MigrationSupport migrationSupport = MigrationSupport.MIGRATABLE; - if ((Boolean) model.getRunVMOnSpecificHost().getEntity()) - { - migrationSupport = MigrationSupport.PINNED_TO_HOST; - } - else if ((Boolean) model.getDontMigrateVM().getEntity()) - { - migrationSupport = MigrationSupport.IMPLICITLY_NON_MIGRATABLE; - } + MigrationSupport migrationSupport = (MigrationSupport) ((EntityModel)(model.getMigrationMode().getSelectedItem())).getEntity(); VM desktop = new VM(); desktop.setVmtGuid(((VmTemplate) model.getTemplate().getSelectedItem()).getId()); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java index e6053ab..d20ef0a 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java @@ -548,15 +548,8 @@ template.setDedicatedVmForVds(defaultHost.getId()); } - template.setMigrationSupport(MigrationSupport.MIGRATABLE); - if ((Boolean) model.getRunVMOnSpecificHost().getEntity()) - { - template.setMigrationSupport(MigrationSupport.PINNED_TO_HOST); - } - else if ((Boolean) model.getDontMigrateVM().getEntity()) - { - template.setMigrationSupport(MigrationSupport.IMPLICITLY_NON_MIGRATABLE); - } + template.setMigrationSupport((MigrationSupport) ((EntityModel)(model.getMigrationMode().getSelectedItem())).getEntity()); + model.StartProgress(null); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java index 9759ea9..faf497a 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java @@ -1379,17 +1379,7 @@ gettempVm().setDedicatedVmForVds(defaultHost.getId()); } - gettempVm().setMigrationSupport(MigrationSupport.MIGRATABLE); - if ((Boolean) model.getRunVMOnSpecificHost().getEntity()) - { - gettempVm().setMigrationSupport(MigrationSupport.PINNED_TO_HOST); - gettempVm().setUseHostCpuFlags((Boolean)model.getHostCpu().getEntity()); - } - else if ((Boolean) model.getDontMigrateVM().getEntity()) - { - gettempVm().setMigrationSupport(MigrationSupport.IMPLICITLY_NON_MIGRATABLE); - gettempVm().setUseHostCpuFlags((Boolean)model.getHostCpu().getEntity()); - } + gettempVm().setMigrationSupport((MigrationSupport) ((EntityModel)(model.getMigrationMode().getSelectedItem())).getEntity()); if (model.getIsNew()) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java index 8afb12b..669457f 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/TemplateVmModelBehavior.java @@ -53,15 +53,7 @@ template.getstorage_pool_id().getValue()); } - switch (template.getMigrationSupport()) - { - case PINNED_TO_HOST: - getModel().getRunVMOnSpecificHost().setEntity(true); - break; - case IMPLICITLY_NON_MIGRATABLE: - getModel().getDontMigrateVM().setEntity(true); - break; - } + getModel().setMigrationMode(template.getMigrationSupport()); } @Override diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java index 060bd0f..d5cdc67 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java @@ -11,6 +11,7 @@ import org.ovirt.engine.core.common.businessentities.BootSequence; import org.ovirt.engine.core.common.businessentities.DisplayType; +import org.ovirt.engine.core.common.businessentities.MigrationSupport; import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum; import org.ovirt.engine.core.common.businessentities.UsbPolicy; import org.ovirt.engine.core.common.businessentities.VDS; @@ -47,6 +48,7 @@ import org.ovirt.engine.ui.uicommonweb.validation.PoolNameValidation; import org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation; import org.ovirt.engine.ui.uicommonweb.validation.ValidationResult; +import org.ovirt.engine.ui.uicompat.Constants; import org.ovirt.engine.ui.uicompat.ConstantsManager; import org.ovirt.engine.ui.uicompat.Event; import org.ovirt.engine.ui.uicompat.EventArgs; @@ -119,9 +121,8 @@ // ==Host Tab== getIsAutoAssign().setIsChangable(false); getDefaultHost().setIsChangable(false); - getRunVMOnSpecificHost().setIsChangable(false); getHostCpu().setIsChangable(false); - getDontMigrateVM().setIsChangable(false); + getMigrationMode().setIsChangable(false); getCpuPinning().setIsChangable(false); // ==Resource Allocation Tab== @@ -825,18 +826,6 @@ privateIsAutoAssign = value; } - private NotChangableForVmInPoolEntityModel privateRunVMOnSpecificHost; - - public EntityModel getRunVMOnSpecificHost() - { - return privateRunVMOnSpecificHost; - } - - public void setRunVMOnSpecificHost(NotChangableForVmInPoolEntityModel value) - { - privateRunVMOnSpecificHost = value; - } - private NotChangableForVmInPoolEntityModel hostCpu; public EntityModel getHostCpu() { @@ -847,16 +836,16 @@ this.hostCpu = hostCpu; } - private NotChangableForVmInPoolEntityModel privateDontMigrateVM; + private NotChangableForVmInPoolListModel migrationMode; - public EntityModel getDontMigrateVM() + public ListModel getMigrationMode() { - return privateDontMigrateVM; + return migrationMode; } - public void setDontMigrateVM(NotChangableForVmInPoolEntityModel value) + public void setMigrationMode(NotChangableForVmInPoolListModel value) { - privateDontMigrateVM = value; + migrationMode = value; } private NotChangableForVmInPoolEntityModel privateIsTemplatePublic; @@ -1080,7 +1069,6 @@ getCdAttached().setEntity(false); setIsHighlyAvailable(new NotChangableForVmInPoolEntityModel()); - setDontMigrateVM(new NotChangableForVmInPoolEntityModel()); setIsTemplatePublic(new NotChangableForVmInPoolEntityModel()); setKernel_parameters(new NotChangableForVmInPoolEntityModel()); setKernel_path(new NotChangableForVmInPoolEntityModel()); @@ -1130,14 +1118,11 @@ setCoresPerSocket(new NotChangableForVmInPoolListModel()); getCoresPerSocket().getSelectedItemChangedEvent().addListener(this); - setRunVMOnSpecificHost(new NotChangableForVmInPoolEntityModel()); - getRunVMOnSpecificHost().getEntityChangedEvent().addListener(this); + setMigrationMode(new NotChangableForVmInPoolListModel()); + getMigrationMode().getSelectedItemChangedEvent().addListener(this); setHostCpu(new NotChangableForVmInPoolEntityModel()); getHostCpu().getEntityChangedEvent().addListener(this); - - setDontMigrateVM(new NotChangableForVmInPoolEntityModel()); - getDontMigrateVM().getEntityChangedEvent().addListener(this); setIsAutoAssign(new NotChangableForVmInPoolEntityModel()); getIsAutoAssign().getEntityChangedEvent().addListener(this); @@ -1209,15 +1194,11 @@ getIsStateless().setEntity(false); getIsSmartcardEnabled().setEntity(false); getIsHighlyAvailable().setEntity(false); - getDontMigrateVM().setEntity(false); getIsAutoAssign().setEntity(true); getIsTemplatePublic().setEntity(true); - getRunVMOnSpecificHost().setEntity(false); - getRunVMOnSpecificHost().setIsChangable(false); - getHostCpu().setEntity(false); - getRunVMOnSpecificHost().setIsChangable(false); + getMigrationMode().setIsChangable(true); getCdImage().setIsChangable(false); @@ -1228,6 +1209,7 @@ InitAllowConsoleReconnect(); InitMinimalVmMemSize(); InitMaximalVmMemSize32OS(); + initMigrationMode(); behavior.Initialize(SystemTreeSelectedItem); } @@ -1292,6 +1274,10 @@ { CoresPerSocket_EntityChanged(sender, args); } + else if (sender == getMigrationMode()) + { + MigrationMode_EntityChanged(sender, args); + } } else if (ev.matchesDefinition(EntityModel.EntityChangedEventDefinition)) { @@ -1302,18 +1288,6 @@ else if (sender == getTotalCPUCores()) { TotalCPUCores_EntityChanged(sender, args); - } - else if (sender == getRunVMOnSpecificHost()) - { - RunVMOnSpecificHost_EntityChanged(sender, args); - } - else if (sender == getDontMigrateVM()) - { - DontMigrateVM_EntityChanged(sender, args); - } - else if (sender == getIsAutoAssign()) - { - IsAutoAssign_EntityChanged(sender, args); } else if (sender == getHostCpu()) { @@ -1553,6 +1527,18 @@ getFirstBootDevice().setSelectedItem(hardDiskOption); } + private void initMigrationMode() { + ArrayList<EntityModel> migrationModes = new ArrayList<EntityModel>(); + Constants constants = ConstantsManager.getInstance().getConstants(); + + migrationModes.add(new EntityModel(constants.autoAndManMigration(), MigrationSupport.MIGRATABLE)); + migrationModes.add(new EntityModel(constants.manualMigrationOnly(), MigrationSupport.IMPLICITLY_NON_MIGRATABLE)); + migrationModes.add(new EntityModel(constants.noMigration(), MigrationSupport.PINNED_TO_HOST)); + getMigrationMode().setItems(migrationModes); + + getDisplayProtocol().getSelectedItemChangedEvent().addListener(this); + } + private void DataCenter_SelectedItemChanged(Object sender, EventArgs args) { behavior.DataCenter_SelectedItemChanged(); @@ -1692,46 +1678,15 @@ entityModel.setIsChangable(false); } - private void RunVMOnSpecificHost_EntityChanged(Object sender, EventArgs args) + private void MigrationMode_EntityChanged(Object sender, EventArgs args) { - if ((Boolean) getRunVMOnSpecificHost().getEntity() == true) - { - clearAndDisable(getDontMigrateVM()); + if (MigrationSupport.PINNED_TO_HOST == ((EntityModel)(getMigrationMode().getSelectedItem())).getEntity()) { getHostCpu().setIsChangable(true); + } else { + getHostCpu().setEntity(false); + getHostCpu().setIsChangable(false); } - else - { - clearAndDisable(getHostCpu()); - getDontMigrateVM().setIsChangable(true); - } - behavior.updateCpuPinningVisibility(); - } - private void DontMigrateVM_EntityChanged(Object sender, EventArgs args) - { - if((Boolean) getDontMigrateVM().getEntity() == true ) { - clearAndDisable(getRunVMOnSpecificHost()); - getHostCpu().setIsChangable(true); - } - else - { - clearAndDisable(getHostCpu()); - getRunVMOnSpecificHost().setIsChangable(true); - } - behavior.updateCpuPinningVisibility(); - } - - private void IsAutoAssign_EntityChanged(Object sender, EventArgs args) - { - if ((Boolean) getIsAutoAssign().getEntity() == true) - { - clearAndDisable(getRunVMOnSpecificHost()); - clearAndDisable(getHostCpu()); - } - else - { - getRunVMOnSpecificHost().setIsChangable(true); - } behavior.updateCpuPinningVisibility(); } @@ -1814,6 +1769,15 @@ } } + public void setMigrationMode(MigrationSupport value) { + for (Object migrationModeEntityModel : getMigrationMode().getItems()) { + if (((EntityModel)migrationModeEntityModel).getEntity() == value) { + getMigrationMode().setSelectedItem(migrationModeEntityModel); + break; + } + } + } + public void SetDataCenter(UnitVmModel model, ArrayList<storage_pool> list) { if (model.getBehavior().getSystemTreeSelectedItem() != null diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java index 475b1e2..808d0f6 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java @@ -2437,21 +2437,10 @@ getcurrentVm().setDedicatedVmForVds(defaultHost.getId()); } - getcurrentVm().setMigrationSupport(MigrationSupport.MIGRATABLE); - if ((Boolean) model.getRunVMOnSpecificHost().getEntity()) - { - getcurrentVm().setMigrationSupport(MigrationSupport.PINNED_TO_HOST); - getcurrentVm().setUseHostCpuFlags((Boolean) model.getHostCpu().getEntity()); - } - else if ((Boolean) model.getDontMigrateVM().getEntity()) - { - getcurrentVm().setMigrationSupport(MigrationSupport.IMPLICITLY_NON_MIGRATABLE); - getcurrentVm().setUseHostCpuFlags((Boolean) model.getHostCpu().getEntity()); - } - else - { - getcurrentVm().setUseHostCpuFlags(Boolean.FALSE); - } + getcurrentVm().setMigrationSupport((MigrationSupport) ((EntityModel)(model.getMigrationMode().getSelectedItem())).getEntity()); + + getcurrentVm().setUseHostCpuFlags((Boolean) model.getHostCpu().getEntity()); + if (model.getIsNew()) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java index 80a02b9..9faf221 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java @@ -732,7 +732,7 @@ if (getModel().getCluster().getSelectedItem() != null) { VDSGroup cluster = (VDSGroup) getModel().getCluster().getSelectedItem(); String compatibilityVersion = cluster.getcompatibility_version().toString(); - boolean hasCpuPinning = true; + boolean hasCpuPinning = Boolean.TRUE.equals(getModel().getHostCpu().getEntity()); if (Boolean.FALSE.equals(AsyncDataProvider.GetConfigValuePreConverted(ConfigurationValues.CpuPinningEnabled, compatibilityVersion))) { @@ -752,13 +752,7 @@ } private boolean isVmMigratable() { - if (Boolean.TRUE.equals(getModel().getRunVMOnSpecificHost().getEntity()) || - (Boolean.FALSE.equals(getModel().getIsAutoAssign().getEntity()) - && Boolean.TRUE.equals(getModel().getDontMigrateVM().getEntity()) - && Boolean.TRUE.equals(getModel().getHostCpu().getEntity()))) { - return false; - } - return true; + return ((EntityModel)getModel().getMigrationMode().getSelectedItem()).getEntity() != MigrationSupport.PINNED_TO_HOST; } public void numOfSocketChanged() { @@ -938,16 +932,6 @@ } protected void updateHostPinning(MigrationSupport migrationSupport) { - getModel().getRunVMOnSpecificHost().setEntity(false); - getModel().getDontMigrateVM().setEntity(false); - switch (migrationSupport) - { - case PINNED_TO_HOST: - getModel().getRunVMOnSpecificHost().setEntity(true); - break; - case IMPLICITLY_NON_MIGRATABLE: - getModel().getDontMigrateVM().setEntity(true); - break; - } + getModel().setMigrationMode(migrationSupport); } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java index 36d10a8..06e0030 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java @@ -597,17 +597,8 @@ getcurrentVm().setDedicatedVmForVds( (Boolean) model.getIsAutoAssign().getEntity() ? null : defaultHost.getId()); - getcurrentVm().setMigrationSupport(MigrationSupport.MIGRATABLE); - if ((Boolean) model.getRunVMOnSpecificHost().getEntity()) - { - getcurrentVm().setMigrationSupport(MigrationSupport.PINNED_TO_HOST); - getcurrentVm().setUseHostCpuFlags((Boolean)model.getHostCpu().getEntity()); - } - else if ((Boolean) model.getDontMigrateVM().getEntity()) - { - getcurrentVm().setMigrationSupport(MigrationSupport.IMPLICITLY_NON_MIGRATABLE); - getcurrentVm().setUseHostCpuFlags((Boolean)model.getHostCpu().getEntity()); - } + getcurrentVm().setMigrationSupport((MigrationSupport) ((EntityModel)(model.getMigrationMode().getSelectedItem())).getEntity()); + getcurrentVm().setUseHostCpuFlags((Boolean)model.getHostCpu().getEntity()); getcurrentVm().setDiskMap(behavior.getVm().getDiskMap()); HashMap<Guid, DiskImage> imageToDestinationDomainMap = diff --git a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java index 14094f0..f665a9e 100644 --- a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java +++ b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java @@ -1766,4 +1766,13 @@ @DefaultStringValue("There can be only one bootable disk defined") String onlyOneBootableDisk(); + + @DefaultStringValue("Allow Manual and Automatic migration") + String autoAndManMigration(); + + @DefaultStringValue("Allow Manual migration only") + String manualMigrationOnly(); + + @DefaultStringValue("Do not allow migration") + String noMigration(); } -- To view, visit http://gerrit.ovirt.org/12706 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib4da1be4919913b7739f4139299d2c88958488d0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: ofri masad <oma...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches