Maor Lipchuk has uploaded a new change for review.

Change subject: core:Refactor VDS calls to a method (BZ846771)
......................................................................

core:Refactor VDS calls to a method (BZ846771)

related to https://bugzilla.redhat.com/show_bug.cgi?id=846771

The following patch refactors a VDS call to be called from a method,
instead to be called twice in the command.

Signed-off-by: Maor Lipchuk <[email protected]>
Change-Id: I7524faba38f170a3a37d9cbfff25cda1993ca8a5
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectAllHostsToLunCommand.java
1 file changed, 11 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/42/7742/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectAllHostsToLunCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectAllHostsToLunCommand.java
index 40613c2..467c97b 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectAllHostsToLunCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/ConnectAllHostsToLunCommand.java
@@ -73,16 +73,7 @@
             }
         }).get(0);
 
-        @SuppressWarnings("unchecked")
-        List<LUNs> luns =
-                    (List<LUNs>) Backend
-                            .getInstance()
-                            .getResourceManager()
-                            .RunVdsCommand(
-                                    VDSCommandType.GetDeviceList,
-                                new 
GetDeviceListVDSCommandParameters(spmVds.getId(),
-                                            
getStorageDomain().getstorage_type()))
-                            .getReturnValue();
+        List<LUNs> luns = getHostLuns(spmVds);
         Map<String, LUNs> lunsMap = new HashMap<String, LUNs>();
         for (LUNs lun : luns) {
             lunsMap.put(lun.getLUN_id(), lun);
@@ -155,14 +146,7 @@
             if (!Config.<Boolean> 
GetValue(ConfigValues.SupportGetDevicesVisibility,
                     vds.getvds_group_compatibility_version().getValue())) {
                 Set<String> hostsLunsIds = new HashSet<String>();
-                @SuppressWarnings("unchecked")
-                List<LUNs> hostLuns = (List<LUNs>) Backend
-                        .getInstance()
-                        .getResourceManager()
-                        .RunVdsCommand(
-                                VDSCommandType.GetDeviceList,
-                                new 
GetDeviceListVDSCommandParameters(vds.getId(),
-                                        
getStorageDomain().getstorage_type())).getReturnValue();
+                List<LUNs> hostLuns = getHostLuns(vds);
                 for (LUNs lun : hostLuns) {
                     hostsLunsIds.add(lun.getLUN_id());
                 }
@@ -178,6 +162,15 @@
         return new Pair<Boolean, Map<String, List<Guid>>>(Boolean.TRUE, 
resultMap);
     }
 
+
+    @SuppressWarnings("unchecked")
+    private List<LUNs> getHostLuns(VDS vds) {
+        return (List<LUNs>) runVdsCommand(
+                VDSCommandType.GetDeviceList,
+                new GetDeviceListVDSCommandParameters(vds.getId(),
+                        
getStorageDomain().getstorage_type())).getReturnValue();
+    }
+
     /**
      * The following method will check which luns were successfully connected 
to vds
      *


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7524faba38f170a3a37d9cbfff25cda1993ca8a5
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