cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From devd...@apache.org
Subject git commit: updated refs/heads/4.2 to 41f7820
Date Tue, 06 Aug 2013 10:56:03 GMT
Updated Branches:
  refs/heads/4.2 c229244da -> 41f782070


CLOUDSTACK-3774: NPE while creating template from snapshot on a upgraded setup.
After upgrade the SSVM was staying in connecting/alert state. This was because
while handling the processConnect command for ssvm the management server was
trying to template sync. For resource limit calculation it was trying to get the
remote size of the template. If the template was no longer available a number
format exception was thrown. The process connect wasn't getting completed and
the ssvm used to stay in connecting/alert state. While creating template from
snapshot cloudstack looks for up and enabled ssvms and because there wasn't
any available (as the ssvm was in coonecting/alert state) it used to pick the
wrong resource (LocalNfs*Resource) instead of the NfsSecondaryStorageResource.

Fixed the issue by making sure number format exceptions are avoided so that
SSVM moves to the right state.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/41f78207
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/41f78207
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/41f78207

Branch: refs/heads/4.2
Commit: 41f7820709f8856a93473818f13093c6dd6dd7ca
Parents: c229244
Author: Devdeep Singh <devdeep@gmail.com>
Authored: Tue Aug 6 16:19:35 2013 +0530
Committer: Devdeep Singh <devdeep@gmail.com>
Committed: Tue Aug 6 16:19:35 2013 +0530

----------------------------------------------------------------------
 utils/src/com/cloud/utils/UriUtils.java | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/41f78207/utils/src/com/cloud/utils/UriUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/UriUtils.java b/utils/src/com/cloud/utils/UriUtils.java
index 6618e44..1ff4d72 100644
--- a/utils/src/com/cloud/utils/UriUtils.java
+++ b/utils/src/com/cloud/utils/UriUtils.java
@@ -108,17 +108,22 @@ public class UriUtils {
         HttpsURLConnection httpsConn = null;
         try {
             URI uri = new URI(url);
-            if(uri.getScheme().equalsIgnoreCase("http")) {
+            if (uri.getScheme().equalsIgnoreCase("http")) {
                 httpConn = (HttpURLConnection) uri.toURL().openConnection();
                 if (httpConn != null) {
-                    remoteSize = Long.parseLong(httpConn.getHeaderField("content-length"));
+                    String contentLength = httpConn.getHeaderField("content-length");
+                    if (contentLength != null) {
+                        remoteSize = Long.parseLong(contentLength);
+                    }
                     httpConn.disconnect();
                 }
-            }
-            else if(uri.getScheme().equalsIgnoreCase("https")) {
+            } else if (uri.getScheme().equalsIgnoreCase("https")) {
                 httpsConn = (HttpsURLConnection) uri.toURL().openConnection();
                 if (httpsConn != null) {
-                    remoteSize = Long.parseLong(httpsConn.getHeaderField("content-length"));
+                    String contentLength = httpsConn.getHeaderField("content-length");
+                    if (contentLength != null) {
+                        remoteSize = Long.parseLong(contentLength);
+                    }
                     httpsConn.disconnect();
                 }
             }


Mime
View raw message