Maor Lipchuk has uploaded a new change for review.

Change subject: restapi: Quering FCP unregistered Storage Domains
......................................................................

restapi: Quering FCP unregistered Storage Domains

Adding the possibility to execute a query to get all the
unregistered storage domain of FCP.

If the user does not apply an iscsi address in the request the REST
query for unregistered Storage Domains of FCP type.

Change-Id: Iafe2f2afcd0e6e68adbbbb2054c857388acc30a7
Bug-Url: https://bugzilla.redhat.com/
Signed-off-by: Maor Lipchuk <mlipc...@redhat.com>
---
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
2 files changed, 14 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/34/38634/1

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 92167c5..d564124 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
@@ -2959,7 +2959,7 @@
     body:
       parameterType: Action
       signatures:
-      - mandatoryArguments: {action.iscsi.address: 'xs:string', action.target: 
'xs:string'}
+      - optionalArguments: {action.iscsi.address: 'xs:string', action.target: 
'xs:string'}
         description: Discover the Storage Domains which are candidiates to be 
imported to the setup
     urlparams: {}
     headers:
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
index 372dd7f..8510a75 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendHostResource.java
@@ -230,17 +230,23 @@
 
     @Override
     public Response unregisteredStorageDomainsDiscover(Action action) {
-        validateParameters(action, "iscsi.address");
+        StorageType storageType =
+                ((action.getIscsi() != null) && 
(action.getIscsi().getAddress() != null)) ? StorageType.ISCSI
+                        : StorageType.FCP;
+
 
         List<StorageServerConnections> storageServerConnections = new 
ArrayList<>();
-        for (String iscsiTarget : action.getIscsiTargets()) {
-            StorageServerConnections connectionDetails = 
getInitializedConnectionIscsiDetails(action);
-            connectionDetails.setiqn(iscsiTarget);
-            storageServerConnections.add(connectionDetails);
+        if (storageType == StorageType.ISCSI) {
+            for (String iscsiTarget : action.getIscsiTargets()) {
+                StorageServerConnections connectionDetails = 
getInitializedConnectionIscsiDetails(action);
+                connectionDetails.setiqn(iscsiTarget);
+                storageServerConnections.add(connectionDetails);
+            }
+        } else {
+            // For FC we don't need to do anything.
         }
         GetUnregisteredBlockStorageDomainsParameters 
unregisteredBlockStorageDomainsParameters =
-                new GetUnregisteredBlockStorageDomainsParameters(guid, 
StorageType.ISCSI, storageServerConnections);
-
+                new GetUnregisteredBlockStorageDomainsParameters(guid, 
storageType, storageServerConnections);
         try {
             Pair<List<StorageDomain>, List<StorageServerConnections>> pair =
                     getEntity(Pair.class,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iafe2f2afcd0e6e68adbbbb2054c857388acc30a7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to