Tal Nisan has uploaded a new change for review.

Change subject: webadmin: Filter storage domains of different type in live 
storage migration
......................................................................

webadmin: Filter storage domains of different type in live storage migration

This change filters the destination domain by the type of the source domain
when performing live storage migration, if the source domain is a file
domain, the destination domains that will appear will be only file domains
and vice versa

Change-Id: I94f9feb9eb2b678e76653bed0b022ed05af40fc1
Signed-off-by: Tal Nisan <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/MoveOrCopyDiskModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/MoveDiskModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmDiskListModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/DisksAllocationPopupView.ui.xml
5 files changed, 49 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/23963/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/MoveOrCopyDiskModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/MoveOrCopyDiskModel.java
index 79fe544..b006e895 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/MoveOrCopyDiskModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/MoveOrCopyDiskModel.java
@@ -62,16 +62,6 @@
         }
     }
 
-    private Guid vmId;
-
-    public Guid getVmId() {
-        return vmId;
-    }
-
-    public void setVmId(Guid vmId) {
-        this.vmId = vmId;
-    }
-
     // Disks that cannot be moved/copied
     protected List<String> problematicDisks = new ArrayList<String>();
 
@@ -155,6 +145,10 @@
             ArrayList<StorageDomain> destStorageDomains =
                     Linq.except(getActiveStorageDomains(), 
sourceStorageDomains);
             destStorageDomains = 
filterStoragesByDatacenterId(destStorageDomains, diskImage.getStoragePoolId());
+
+            if (isFilterDestinationDomainsBySourceType()) {
+                destStorageDomains = 
filterDestinationDomainsByDiskStorageSubtype(destStorageDomains, diskImage);
+            }
 
             // Filter storage domains with missing template disk
             boolean isDiskBasedOnTemplate = 
!diskImage.getParentId().equals(Guid.Empty);
@@ -318,6 +312,20 @@
         parameters.add(params);
     }
 
+    protected ArrayList<StorageDomain> 
filterDestinationDomainsByDiskStorageSubtype(List<StorageDomain> destDomains, 
DiskImage disk) {
+        ArrayList<StorageDomain> filteredDomains = new 
ArrayList<StorageDomain>();
+        for (StorageDomain sd : destDomains) {
+            if (sd.getStorageType().getStorageSubtype() == 
disk.getStorageTypes().get(0).getStorageSubtype()) {
+                filteredDomains.add(sd);
+            }
+        }
+        return filteredDomains;
+    }
+
+    protected boolean isFilterDestinationDomainsBySourceType() {
+        return false;
+    }
+
     @Override
     public void executeCommand(UICommand command)
     {
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/MoveDiskModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/MoveDiskModel.java
index f7017d8..f2ed339 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/MoveDiskModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/MoveDiskModel.java
@@ -92,6 +92,24 @@
                 destStorageDomainGuid);
     }
 
+
+    boolean isVmUp;
+
+    // If the VM is up we are in fact performing a live storage migration, in 
the case the destination storage domain
+    // to move to has to be the same type (file/block) of the source storage 
domain
+    public boolean isVmUp() {
+        return isVmUp;
+    }
+
+    public void setVmUp(boolean isVmUp) {
+        this.isVmUp = isVmUp;
+    }
+
+    @Override
+    protected boolean isFilterDestinationDomainsBySourceType() {
+        return isVmUp;
+    }
+
     @Override
     protected void onExecute() {
         super.onExecute();
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmDiskListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmDiskListModel.java
index d20b7d6..f8f960b 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmDiskListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmDiskListModel.java
@@ -496,11 +496,14 @@
 
         MoveDiskModel model = new MoveDiskModel();
         setWindow(model);
-        model.setVmId(vm.getStatus() == VMStatus.Up ? vm.getId() : null);
-        model.setWarningAvailable(vm.getStatus() == VMStatus.Up);
-        model.setMessage(vm.getStatus() == VMStatus.Up ?
-                
ConstantsManager.getInstance().getConstants().liveStorageMigrationWarning() :
-                null);
+        boolean vmIsUp = vm.getStatus() == VMStatus.Up;
+        model.setVmUp(vmIsUp);
+        model.setWarningAvailable(vmIsUp);
+        if (vmIsUp) {
+            
model.setMessage(ConstantsManager.getInstance().getConstants().liveStorageMigrationWarning());
+            
model.setMessage(ConstantsManager.getInstance().getConstants().liveStorageMigrationStorageFilteringNote());
+        }
+
         
model.setTitle(ConstantsManager.getInstance().getConstants().moveDisksTitle());
         model.setHashName("move_disk"); //$NON-NLS-1$
         model.setIsSourceStorageDomainNameAvailable(true);
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 b6e07d2..9af066c 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
@@ -1733,6 +1733,9 @@
     @DefaultStringValue("Moving disk(s) while the VM is running")
     String liveStorageMigrationWarning();
 
+    @DefaultStringValue("Note: Target domains are filtered by the source 
domain type (file/block)")
+    String liveStorageMigrationStorageFilteringNote();
+
     @DefaultStringValue("Cannot remove more than one brick from a Replicate 
volume at a time")
     String cannotRemoveBricksReplicateVolume();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/DisksAllocationPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/DisksAllocationPopupView.ui.xml
index 1e115f2..4be42bc 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/DisksAllocationPopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/storage/DisksAllocationPopupView.ui.xml
@@ -9,7 +9,7 @@
                        color: #CD2127;
             position: absolute;
             bottom: 0;
-            height: 35px;
+            height: 50px;
             overflow: auto;
                }
        </ui:style>
@@ -17,7 +17,7 @@
        <d:SimpleDialogPanel width="540px" height="400px">
                <d:content>
                        <g:FlowPanel>
-                               <w:DisksAllocationView 
ui:field="disksAllocationView" listHeight="245px" listWidth="525px" 
showSource="true" />
+                               <w:DisksAllocationView 
ui:field="disksAllocationView" listHeight="230px" listWidth="525px" 
showSource="true" />
                 <g:FlowPanel ui:field="messagePanel" visible="false" 
addStyleNames="{style.messagePanel}" />
                        </g:FlowPanel>
                </d:content>


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

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

Reply via email to