Francesco Romani has uploaded a new change for review.

Change subject: frontend: add support to control spice file transfer
......................................................................

frontend: add support to control spice file transfer

spice has agent based file transfer support.
This patch adds support on the frontend to control this feature
and allow to disable whenever it is needed.

Change-Id: I99f9f2f878171746c613598d80fdc9fdd3208ed2
Bug-Url: https://bugzilla.redhat.com/1082479
Signed-off-by: Francesco Romani <[email protected]>
---
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/vm/VmRunOncePopupWidget.java
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
M 
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
13 files changed, 49 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/44/26244/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 b45d863..ed816a2 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
@@ -1720,4 +1720,7 @@
 
     @DefaultStringValue("Connect")
     String connect();
+
+    @DefaultStringValue("Enable SPICE file transfer")
+    String spiceFileXferEnabled();
 }
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 9ce8f6c..d1cc111 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
@@ -653,6 +653,11 @@
     @WithElementId("kernelParameters")
     public StringEntityModelTextBoxEditor kernel_parametersEditor;
 
+    @UiField(provided = true)
+    @Path("spiceFileXferEnabled.entity")
+    @WithElementId("spiceFileXferEnabled")
+    public EntityModelCheckBoxEditor spiceFileXferEnabledEditor;
+
     @UiField
     @Ignore
     Label nativeUsbWarningMessage;
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 4b147dc..51bfbf8 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
@@ -511,6 +511,7 @@
 
                         <w:EntityModelWidgetWithInfo 
ui:field="spiceProxyEnabledCheckboxWithInfoIcon" />
                         <ge:StringEntityModelTextBoxEditor 
ui:field="spiceProxyEditor"/>
+                        <ge:EntityModelCheckBoxEditor 
ui:field="spiceFileXferEnabledEditor" label="{constants.spiceFileXferEnabled}" 
addStyleNames="{style.checkbox}" />
                                        </g:FlowPanel>
                                </t:content>
                        </t:DialogTab>
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java
index 6971852..3a06459 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.java
@@ -209,6 +209,11 @@
     @WithElementId("displayConsoleSpice")
     EntityModelRadioButtonEditor displayConsoleSpiceEditor;
 
+    @UiField(provided = true)
+    @Path("spiceFileXferEnabled.entity")
+    @WithElementId("spiceFileXferEnabled")
+    public EntityModelCheckBoxEditor spiceFileXferEnabledEditor;
+
     @UiField
     @WithElementId
     ButtonBase bootSequenceUpButton;
@@ -317,6 +322,7 @@
         runAsStatelessEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
         runAndPauseEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
         useAlternateCredentialsEditor = new 
EntityModelCheckBoxEditor(Align.RIGHT);
+        spiceFileXferEnabledEditor = new 
EntityModelCheckBoxEditor(Align.RIGHT);
     }
 
     void initListBoxEditors() {
diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml
index a5b10b2..863d8ba 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/uicommon/popup/vm/VmRunOncePopupWidget.ui.xml
@@ -228,6 +228,7 @@
                                <ge:EntityModelRadioButtonEditor 
ui:field="displayConsoleVncEditor" />
                                <e:ListModelListBoxEditor 
ui:field="vncKeyboardLayoutEditor" />
                                <ge:EntityModelRadioButtonEditor 
ui:field="displayConsoleSpiceEditor" />
+                <ge:EntityModelCheckBoxEditor 
ui:field="spiceFileXferEnabledEditor"" />
                        </g:VerticalPanel>
                </g:DisclosurePanel>
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java
index 640c294..d6235af 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java
@@ -35,5 +35,6 @@
         
vm.setDefaultDisplayType(model.getDisplayProtocol().getSelectedItem().getEntity());
         
vm.setSerialNumberPolicy(model.getSerialNumberPolicy().getSelectedSerialNumberPolicy());
         
vm.setCustomSerialNumber(model.getSerialNumberPolicy().getCustomSerialNumber().getEntity());
+        
vm.setSpiceFileXferEnabled(model.getSpiceFileXferToggleEnabled().getEntity());
     }
 }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
index c6e513a..e7f9d7d 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
@@ -3761,6 +3761,10 @@
         return (Boolean) 
getConfigValuePreConverted(ConfigurationValues.SerialNumberPolicySupported, 
version);
     }
 
+    public static boolean isSpiceFileXferToggleSupported(String version) {
+        return (Boolean) 
getConfigValuePreConverted(ConfigurationValues.SpiceFileXferToggleSupported, 
version);
+    }
+
     public static List<IStorageModel> getDataStorageModels() {
         ArrayList<IStorageModel> models = new ArrayList<IStorageModel>();
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java
index 8f671be..26fb0a6 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java
@@ -296,6 +296,8 @@
             }), vm.getRunOnVds());
         }
 
+        
getModel().getSpiceFileXferToggleEnabled().setEntity(vm.isSpiceFileXferEnabled());
+
         BuilderExecutor.build(vm.getStaticData(), getModel(), new 
SerialNumberPolicyVmBaseToUnitBuilder());
     }
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java
index 6f97d51..ae00413 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewTemplateVmModelBehavior.java
@@ -345,6 +345,8 @@
 
         initPriority(this.vm.getPriority());
 
+        
getModel().getSpiceFileXferToggleEnabled().setEntity(vm.isSpiceFileXferEnabled());
+
         BuilderExecutor.build(vm.getStaticData(), getModel(), new 
SerialNumberPolicyVmBaseToUnitBuilder());
     }
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java
index fb38877..29dd3db 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java
@@ -186,6 +186,8 @@
             getModel().getVmInitModel().init(template);
             getModel().getVmInitEnabled().setEntity(template.getVmInit() != 
null);
 
+            
getModel().getSpiceFileXferToggleEnabled().setEntity(template.isSpiceFileXferEnabled());
+
             BuilderExecutor.build(template, getModel(), new 
SerialNumberPolicyVmBaseToUnitBuilder());
         }
     }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
index 8d54fbe..da20843 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
@@ -201,6 +201,8 @@
             getModel().getVmInitModel().init(vmBase);
             getModel().getVmInitEnabled().setEntity(vmBase.getVmInit() != 
null);
 
+            
getModel().getSpiceFileXferToggleEnabled().setEntity(vmBase.isSpiceFileXferEnabled());
+
             BuilderExecutor.build(vmBase, getModel(), new 
SerialNumberPolicyVmBaseToUnitBuilder());
         }
     }
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 ca6175f..2947ea1 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
@@ -83,9 +83,7 @@
 
     private EntityModel<Boolean> spiceProxyEnabled;
 
-    public EntityModel<Boolean> getSpiceProxyEnabled() {
-        return spiceProxyEnabled;
-    }
+    public EntityModel<Boolean> getSpiceProxyEnabled() { return 
spiceProxyEnabled;  }
 
     public void setSpiceProxyEnabled(EntityModel<Boolean> spiceProxyEnabled) {
         this.spiceProxyEnabled = spiceProxyEnabled;
@@ -1264,6 +1262,16 @@
         this.serialNumberPolicy = value;
     }
 
+    private EntityModel<Boolean> spiceFileXferToggleEnabled;
+
+    public EntityModel<Boolean> getSpiceFileXferToggleEnabled() {
+        return spiceFileXferToggleEnabled;
+    }
+
+    public void setSpiceFileXferToggleEnabled(EntityModel<Boolean> 
spiceFileXferToggleEnabled) {
+        this.spiceFileXferToggleEnabled = spiceFileXferToggleEnabled;
+    }
+
     public UnitVmModel(VmModelBehaviorBase behavior) {
         Frontend.getInstance().getQueryStartedEvent().addListener(this);
         Frontend.getInstance().getQueryCompleteEvent().addListener(this);
@@ -1350,6 +1358,7 @@
         setDisplayProtocol(new 
NotChangableForVmInPoolListModel<EntityModel<DisplayType>>());
         setSecondBootDevice(new 
NotChangableForVmInPoolListModel<EntityModel<BootSequence>>());
         setPriority(new 
NotChangableForVmInPoolListModel<EntityModel<Integer>>());
+        setSpiceFileXferToggleEnabled(new 
NotChangableForVmInPoolEntityModel<Boolean>());
         setVmInitEnabled(new EntityModel(false));
         setCloudInitEnabled(new EntityModel());
         setSysprepEnabled(new EntityModel<Boolean>());
@@ -1957,6 +1966,12 @@
         
Version.v3_3.compareTo(getSelectedCluster().getcompatibility_version()) <= 0;
 
         getBehavior().enableSinglePCI(isLinux && isQxl && 
clusterSupportsSinglePci);
+
+        boolean spiceFileXferToggle = getSelectedCluster() != null &&
+                
AsyncDataProvider.isSpiceFileXferToggleSupported(getSelectedCluster().getcompatibility_version().toString());
+
+        getSpiceFileXferToggleEnabled().setIsChangable(spiceFileXferToggle);
+        getSpiceFileXferToggleEnabled().setIsAvailable(spiceFileXferToggle);
     }
 
     private void template_SelectedItemChanged(Object sender, EventArgs args)
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
 
b/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
index 0dca2cb..fbf7213 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
@@ -113,6 +113,7 @@
         when(model.getIsAutoAssign().getEntity()).thenReturn(false);
         
when(model.getMigrationMode().getSelectedItem()).thenReturn(MIGRATION_SUPPORT);
         
when(model.getSelectedMigrationDowntime()).thenReturn(MIGRATION_DOWNTIME);
+        
when(model.getSpiceFileXferToggleEnabled().getEntity()).thenReturn(true);
     }
 
     protected void setUpOrigVm(VM origVm) {
@@ -146,6 +147,7 @@
         assertTrue(vm.isDeleteProtected());
         assertEquals(VNC_KEYBOARD_LAYOUT, vm.getVncKeyboardLayout());
         assertEquals(DISPLAY_TYPE, vm.getDefaultDisplayType());
+        assertTrue(vm.isSpiceFileXferEnabled());
     }
 
     /**


-- 
To view, visit http://gerrit.ovirt.org/26244
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99f9f2f878171746c613598d80fdc9fdd3208ed2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to