Liron Ar has uploaded a new change for review.

Change subject: core: UploadImageVDSCommand - read task id from header
......................................................................

core: UploadImageVDSCommand - read task id from header

In the following patch [1] there's a behavior change, in case of a
succesfull execution the task id will be returned within a header
instead of the body. This patch just alignes the engine behavior to read
the task id from it.

[1] - http://gerrit.ovirt.org/#/c/27997/

Change-Id: I9d9d18fcefdc7862517d7d59aff18ba500e22c63
Signed-off-by: Liron Aravot <[email protected]>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/UploadStreamVDSCommand.java
1 file changed, 10 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/28215/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/UploadStreamVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/UploadStreamVDSCommand.java
index 97a97c9..2e24627 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/UploadStreamVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/irsbroker/UploadStreamVDSCommand.java
@@ -111,8 +111,15 @@
                 throw createNetworkException(e);
             }
 
-            if (responseCode != HttpStatus.SC_OK) {
-                throwVdsErrorException("upload failed with response code " + 
responseCode, VdcBllErrors.UPLOAD_FAILURE);
+            if (responseCode == HttpStatus.SC_OK) {
+                Guid createdTask =
+                        
Guid.createGuidFromString(processResponseHeaderValue(putMethod, "Task-Id", 
null));
+                getVDSReturnValue().setCreationInfo(
+                        new AsyncTaskCreationInfo(createdTask, 
AsyncTaskType.downloadImageFromStream, getParameters()
+                                .getStoragePoolId()));
+
+                getVDSReturnValue().setSucceeded(true);
+                return;
             }
 
             processResponseHeaderValue(putMethod, "Content-type", 
"application/json");
@@ -133,16 +140,6 @@
             }
 
             proceedProxyReturnValue();
-
-            String createdTaskId = new OneUuidReturnForXmlRpc(resultMap).mUuid;
-
-            Guid createdTask = Guid.createGuidFromString(createdTaskId);
-
-            getVDSReturnValue().setCreationInfo(
-                    new AsyncTaskCreationInfo(createdTask, 
AsyncTaskType.downloadImageFromStream, getParameters()
-                            .getStoragePoolId()));
-
-            getVDSReturnValue().setSucceeded(true);
         } finally {
             try {
                 putMethod.releaseConnection();
@@ -166,6 +163,7 @@
         if (header == null) {
             throwVdsErrorException("UploadStreamVDSCommand - response was 
missing the following header: "
                     + headerName, VdcBllErrors.GeneralException);
+            return null;
         }
 
         if (expectedValue != null && !expectedValue.equals(header.getValue())) 
{


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

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

Reply via email to