Maor Lipchuk has uploaded a new change for review.

Change subject: restapi: Use description for discover FCP Storage in rsdl
......................................................................

restapi: Use description for discover FCP Storage in rsdl

Adding a description in rsdl for unregisteredstoragedomainsdiscover
using FCP.

Change-Id: I0657db41409bdebe936bb1c254a0912b32a7af18
Bug-Url: https://bugzilla.redhat.com/1217456
Signed-off-by: Maor Lipchuk <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
2 files changed, 28 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/40776/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
index 7c78ba0..905f4ed 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
@@ -30,7 +30,7 @@
 import org.ovirt.engine.core.common.businessentities.VmTemplate;
 import 
org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface;
 import org.ovirt.engine.core.common.businessentities.storage.BaseDisk;
-import org.ovirt.engine.core.common.businessentities.storage.CinderDisk;
+import org.ovirt.engine.core.common.businessentities.storage.Disk;
 import org.ovirt.engine.core.common.businessentities.storage.Disk;
 import org.ovirt.engine.core.common.businessentities.storage.DiskStorageType;
 import org.ovirt.engine.core.common.businessentities.storage.DiskImage;
@@ -573,6 +573,23 @@
         return diskImages;
     }
 
+    public static List<Disk> filterDisksByType(Collection<? extends Disk> 
listOfDisks,
+                                                   boolean 
allowOnlyNotShareableDisks,
+                                                   boolean 
allowOnlySnapableDisks,
+                                                   boolean 
allowOnlyActiveDisks,
+                                                   DiskStorageType... 
filteredStorageTypes) {
+        List<Disk> diskImages = new ArrayList<Disk>();
+        for (Disk disk : listOfDisks) {
+            if (filteredStorageTypes.contains(disk.getDiskStorageType()) &&
+                    (!allowOnlyNotShareableDisks || !disk.isShareable()) &&
+                    (!allowOnlySnapableDisks || disk.isAllowSnapshot()) &&
+                    (!allowOnlyActiveDisks || 
Boolean.TRUE.equals(((DiskImage)disk).getActive()))) {
+                diskImages.add(disk);
+            }
+        }
+        return diskImages;
+    }
+
     public static List<LunDisk> filterDiskBasedOnLuns(Collection<Disk> 
listOfDisks) {
         List<LunDisk> lunDisks = new ArrayList<LunDisk>();
         for (Disk disk : listOfDisks) {
@@ -583,21 +600,21 @@
         return lunDisks;
     }
 
-    public static List<CinderDisk> filterDisksBasedOnCinder(Collection<? 
extends Disk> listOfDisks) {
-        return filterDisksBasedOnCinder(listOfDisks, false);
+    public static List<Disk> filterDisksBasedOn(Collection<? extends Disk> 
listOfDisks) {
+        return filterDisksBasedOn(listOfDisks, false);
     }
 
-    public static List<CinderDisk> filterDisksBasedOnCinder(Collection<? 
extends Disk> listOfDisks,
+    public static List<Disk> filterDisksBasedOn(Collection<? extends Disk> 
listOfDisks,
             boolean onlyPluggedDisks) {
-        List<CinderDisk> cinderDisks = new ArrayList<>();
+        List<Disk> Disks = new ArrayList<>();
         for (Disk disk : listOfDisks) {
-            if (disk.getDiskStorageType() == DiskStorageType.CINDER) {
+            if (disk.getDiskStorageType() == DiskStorageType.) {
                 if (!onlyPluggedDisks || disk.getPlugged()) {
-                    cinderDisks.add((CinderDisk) disk);
+                    Disks.add((Disk) disk);
                 }
             }
         }
-        return cinderDisks;
+        return Disks;
     }
 
     public static void removeDiskImage(DiskImage diskImage, Guid vmId) {
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
index 08f6044..568a054 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
@@ -1941,13 +1941,14 @@
       - mandatoryArguments: {action.iscsi.address: 'xs:string', 
action.iscsi.target: 'xs:string'}
         description: login to the specified iscsi target at the specified 
address
 - name: 
/hosts/{host:id}/unregisteredstoragedomainsdiscover|rel=unregisteredstoragedomainsdiscover
-  description: Discover the Storage Domains which are candidiates to be 
imported to the setup
+  description: Discover the block Storage Domains which are candidates to be 
imported to the setup
   request:
     body:
       parameterType: Action
       signatures:
       - optionalArguments: {action.iscsi.address: 'xs:string', 
action.iscsi_target: 'xs:string'}
-        description: Discover the Storage Domains which are candidiates to be 
imported to the setup
+      description: Discover the iSCSI Storage Domains which are candidates to 
be imported to the setup
+      description: Discover the FCP Storage Domains which are candidates to be 
imported to the setup
 - name: /hosts/{host:id}/refreshcapabilities|rel=refreshcapabilities
   description: refresh the capabilities of the host
   request:


-- 
To view, visit https://gerrit.ovirt.org/40776
To unsubscribe, visit https://gerrit.ovirt.org/settings

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

Reply via email to