[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16332227#comment-16332227
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9677:
--------------------------------------------

rafaelweingartner commented on a change in pull request #2412: CLOUDSTACK-9677: 
Adding storage policy support for swift as secondary…
URL: https://github.com/apache/cloudstack/pull/2412#discussion_r162616231
 
 

 ##########
 File path: 
plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
 ##########
 @@ -914,20 +917,45 @@ public Answer copyVolumeFromPrimaryToSecondary(final 
CopyCommand cmd) {
 
     private boolean swiftUpload(final Connection conn, final SwiftTO swift, 
final String container, final String ldir, final String lfilename, final 
Boolean isISCSI,
             final int wait) {
-        String result = null;
+
+        List<String> params = getSwiftParams(swift, container, ldir, 
lfilename, isISCSI);
+
         try {
-            result =
-                    hypervisorResource.callHostPluginAsync(conn, 
"swiftxenserver", "swift", wait, "op", "upload", "url", swift.getUrl(), 
"account", swift.getAccount(), "username",
-                            swift.getUserName(), "key", swift.getKey(), 
"container", container, "ldir", ldir, "lfilename", lfilename, "isISCSI", 
isISCSI.toString());
-            if (result != null && result.equals("true")) {
-                return true;
-            }
+            String result = hypervisorResource.callHostPluginAsync(conn, 
"swiftxenserver", "swift", wait, params.toArray(new String[params.size()]));
+            return "true".equals(result);
         } catch (final Exception e) {
             s_logger.warn("swift upload failed due to " + e.toString(), e);
         }
         return false;
     }
 
+    private List<String> getSwiftParams(SwiftTO swift, String container, 
String ldir, String lfilename, Boolean isISCSI) {
 
 Review comment:
   This method could really benefit from unit tests

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Swift Storage Policy support for Secondary Storage
> --------------------------------------------------
>
>                 Key: CLOUDSTACK-9677
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9677
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>            Reporter: Patrick D.
>            Assignee: Patrick D.
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to