Vered Volansky has uploaded a new change for review.

Change subject: core: Repair disallow RO in UI
......................................................................

core: Repair disallow RO in UI

Qemu currently does not support Direct-LUN disks connected using
Virt-IO-SCSI. This patch blocks this option from UI when adding a new
LUN disk with Virt-IO-SCSI interface to a VM.
When RO checkbox is disabled, it is not checked. IDE behaviour was
changed to comply with this behaviour in this patch as well.
This patch also removes un-needed verfication for IDE disk.

Change-Id: Ieb1923d03785be7f228076e12f4865242aed5c90
Bug-Url: https://bugzilla.redhat.com/1082673
Signed-off-by: Vered Volansky <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/AbstractDiskModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
2 files changed, 16 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/65/27665/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/AbstractDiskModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/AbstractDiskModel.java
index c98cb3e..04bcfcc 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/AbstractDiskModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/AbstractDiskModel.java
@@ -48,7 +48,6 @@
 import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyQuotaValidation;
 import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation;
 import 
org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation;
-import org.ovirt.engine.ui.uicommonweb.validation.ValidationResult;
 import org.ovirt.engine.ui.uicompat.ConstantsManager;
 import org.ovirt.engine.ui.uicompat.Event;
 import org.ovirt.engine.ui.uicompat.EventArgs;
@@ -662,13 +661,21 @@
     protected void updateReadOnlyChangeability() {
         DiskInterface diskInterface = getDiskInterface().getSelectedItem();
 
-        if (DiskInterface.IDE.equals(diskInterface)) {
+        if (diskInterface == DiskInterface.IDE) {
             
getIsReadOnly().setChangeProhibitionReason(CONSTANTS.cannotEnableIdeInterfaceForReadOnlyDisk());
             getIsReadOnly().setIsChangable(false);
+            getIsReadOnly().setEntity(false);
+            return;
         }
-        else {
-            getIsReadOnly().setIsChangable(isEditEnabled());
+
+        boolean isVirtIoScsiLun = 
Boolean.FALSE.equals(getIsInternal().getEntity()) && diskInterface == 
DiskInterface.VirtIO_SCSI;
+        if (isVirtIoScsiLun) {
+            
getIsReadOnly().setChangeProhibitionReason(CONSTANTS.cannotEnableVirtIoScsiInterfaceForLunReadOnlyDisk());
+            getIsReadOnly().setIsChangable(false);
+            getIsReadOnly().setEntity(false);
+            return;
         }
+        getIsReadOnly().setIsChangable(isEditEnabled());
     }
 
     private void updatePlugChangeability() {
@@ -776,7 +783,7 @@
             getQuota().validateSelectedItem(new IValidation[] { new 
NotEmptyQuotaValidation() });
         }
 
-        getDiskInterface().validateEntity(new IValidation[] { new 
IValidation() {
+        /*getDiskInterface().validateEntity(new IValidation[] { new 
IValidation() {
             @Override
             public ValidationResult validate(Object value) {
                 ValidationResult result = new ValidationResult();
@@ -789,7 +796,7 @@
 
                 return result;
             }
-        }});
+        }});*/
 
         return getAlias().getIsValid() && getDescription().getIsValid() && 
getQuota().getIsValid() && getDiskInterface().getIsValid();
     }
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
index 13cbd5b..b5a8eef 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
@@ -2236,6 +2236,9 @@
     @DefaultStringValue("An IDE disk can't be read-only.")
     String cannotEnableIdeInterfaceForReadOnlyDisk();
 
+    @DefaultStringValue("A VirtIO-ISCSI LUN disk can't be read-only.")
+    String cannotEnableVirtIoScsiInterfaceForLunReadOnlyDisk();
+
     @DefaultStringValue("Global Maintenance Enabled")
     String haGlobalMaintenance();
 


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

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

Reply via email to