Daniel Erez has uploaded a new change for review.

Change subject: webadmin: disable hot plug for disk with IDE interface
......................................................................

webadmin: disable hot plug for disk with IDE interface

New disk dialog:
when the VM is running and IDE is selected,
'Activate' should be disabled.

Change-Id: Iff166bfdae2e7bcdd56c5e4e5311f878138c260a
Bug-Url: https://bugzilla.redhat.com/1055403
Signed-off-by: Daniel Erez <[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, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/40/25540/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 e0fa369..1d5fb12 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
@@ -20,6 +20,7 @@
 import org.ovirt.engine.core.common.businessentities.StorageType;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
+import org.ovirt.engine.core.common.businessentities.VMStatus;
 import org.ovirt.engine.core.common.businessentities.VolumeFormat;
 import org.ovirt.engine.core.common.businessentities.VolumeType;
 import 
org.ovirt.engine.core.common.businessentities.comparators.NameableComparator;
@@ -656,6 +657,7 @@
         getIsSgIoUnfiltered().setIsAvailable(!isInternal && 
DiskInterface.VirtIO_SCSI.equals(diskInterface));
 
         updateReadOnlyChangeability();
+        updatePlugChangeability();
     }
 
     protected void updateReadOnlyChangeability() {
@@ -670,6 +672,21 @@
         }
     }
 
+    private void updatePlugChangeability() {
+        DiskInterface diskInterface = (DiskInterface) 
getDiskInterface().getSelectedItem();
+        boolean isVmRunning = getVm() != null && getVm().getStatus() != 
VMStatus.Down;
+
+        if (DiskInterface.IDE.equals(diskInterface) && isVmRunning) {
+            
getIsPlugged().setChangeProhibitionReason(CONSTANTS.cannotHotPlugDiskWithIdeInterface());
+            getIsPlugged().setIsChangable(false);
+            getIsPlugged().setEntity(false);
+        }
+        else {
+            getIsPlugged().setIsChangable(isEditEnabled());
+            getIsPlugged().setEntity(true);
+        }
+    }
+
     private void wipeAfterDelete_EntityChanged(EventArgs e) {
         if (!getIsWipeAfterDelete().getIsChangable() && (Boolean) 
getIsWipeAfterDelete().getEntity())
         {
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 03ed855..8d22c7c 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
@@ -2219,5 +2219,8 @@
 
     @DefaultStringValue("Not Active")
     String haNotActive();
+
+    @DefaultStringValue("When the VM is running, cannot activate a disk 
attached with IDE interface.")
+    String cannotHotPlugDiskWithIdeInterface();
 }
 


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

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

Reply via email to