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 <tni...@redhat.com>
---
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, 40 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/23769/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..62a7583 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 = 
filterDestinationDomainsBySourceSubtype(destStorageDomains, 
sourceStorageDomains.get(0));
+            }
 
             // Filter storage domains with missing template disk
             boolean isDiskBasedOnTemplate = 
!diskImage.getParentId().equals(Guid.Empty);
@@ -318,6 +312,20 @@
         parameters.add(params);
     }
 
+    protected ArrayList<StorageDomain> 
filterDestinationDomainsBySourceSubtype(List<StorageDomain> destDomains, 
StorageDomain sourceDomain) {
+        ArrayList<StorageDomain> filteredDomains = new 
ArrayList<StorageDomain>();
+        for (StorageDomain sd : destDomains) {
+            if (sd.getStorageType().getStorageSubtype() == 
sourceDomain.getStorageType().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..129d928 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,7 +496,7 @@
 
         MoveDiskModel model = new MoveDiskModel();
         setWindow(model);
-        model.setVmId(vm.getStatus() == VMStatus.Up ? vm.getId() : null);
+        model.setVmUp(vm.getStatus() == VMStatus.Up);
         model.setWarningAvailable(vm.getStatus() == VMStatus.Up);
         model.setMessage(vm.getStatus() == VMStatus.Up ?
                 
ConstantsManager.getInstance().getConstants().liveStorageMigrationWarning() :
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 66e6e58..c3f7314 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
@@ -1727,7 +1727,7 @@
     @DefaultStringValue("Wipe after delete is not supported for file domains")
     String wipeAfterDeleteNotSupportedForFileDomains();
 
-    @DefaultStringValue("Moving disk(s) while the VM is running")
+    @DefaultStringValue("Moving disk(s) while the VM is running, destination 
domains are filtered by the source domain type (file/block)")
     String liveStorageMigrationWarning();
 
     @DefaultStringValue("Cannot remove more than one brick from a Replicate 
volume at a time")
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/23769
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I94f9feb9eb2b678e76653bed0b022ed05af40fc1
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tal Nisan <tni...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to