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/master to f58d77c
Date Tue, 14 Jan 2014 14:24:28 GMT
Updated Branches:
  refs/heads/master f8681de07 -> f58d77c8d


CLOUDSTACK-5689: System vm creation on local storage fails for hyper-v. A
null pointer exception was getting generated when a VolumeTO object was
serialized to create an answer object. If a local storage is used the uri
field will be null. Added null checks for the same.


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

Branch: refs/heads/master
Commit: f58d77c8d1fd9eb2bee927f7d92e50ba1553c7b6
Parents: f8681de
Author: Devdeep Singh <devdeep@gmail.com>
Authored: Wed Jan 15 02:51:15 2014 +0530
Committer: Devdeep Singh <devdeep@gmail.com>
Committed: Tue Jan 14 19:55:00 2014 +0530

----------------------------------------------------------------------
 .../HypervResource/CloudStackTypes.cs           | 33 ++++++++++++++------
 .../HypervResource/HypervResourceController.cs  | 11 ++-----
 2 files changed, 26 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f58d77c8/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
index 89f0814..847380c 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
@@ -61,7 +61,7 @@ namespace HypervResource
             get
             {
                 string uncPath = null;
-                if (uri.Scheme.Equals("cifs") || uri.Scheme.Equals("networkfilesystem"))
+                if (uri != null && (uri.Scheme.Equals("cifs") || uri.Scheme.Equals("networkfilesystem")))
                 {
                     uncPath = @"\\" + uri.Host + uri.LocalPath;
                 }
@@ -73,8 +73,13 @@ namespace HypervResource
         {
             get
             {
-                var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
-                return System.Web.HttpUtility.UrlDecode(queryDictionary["user"]);
+                string user = null;
+                if (uri != null)
+                {
+                    var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
+                    user = System.Web.HttpUtility.UrlDecode(queryDictionary["user"]);
+                }
+                return user;
             }
         }
 
@@ -82,8 +87,13 @@ namespace HypervResource
         {
             get
             {
-                var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
-                return System.Web.HttpUtility.UrlDecode(queryDictionary["password"]);
+                string password = null;
+                if (uri != null)
+                {
+                    var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
+                    password = System.Web.HttpUtility.UrlDecode(queryDictionary["password"]);
+                }
+                return password;
             }
         }
 
@@ -91,12 +101,17 @@ namespace HypervResource
         {
             get
             {
-                var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
-                if (queryDictionary["domain"] != null)
+                string domain = null;
+                if (uri != null)
                 {
-                    return System.Web.HttpUtility.UrlDecode(queryDictionary["domain"]);
+                    var queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query);
+                    if (queryDictionary["domain"] != null)
+                    {
+                        domain = System.Web.HttpUtility.UrlDecode(queryDictionary["domain"]);
+                    }
+                    else domain = uri.Host;
                 }
-                else return uri.Host;
+                return domain;
             }
         }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f58d77c8/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
index 18f3158..94837a2 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -1474,15 +1474,8 @@ namespace HypervResource
                             {
                                 // TODO: thin provision instead of copying the full file.
                                 File.Copy(srcFile, destFile);
-                                VolumeObjectTO volume = new VolumeObjectTO();
-                                volume.path = destFile;
-                                volume.dataStore = destVolumeObjectTO.dataStore;
-                                volume.name = destVolumeObjectTO.name;
-                                volume.size = ulong.Parse(destVolumeObjectTO.size.ToString());
-                                volume.format = destVolumeObjectTO.format;
-                                volume.nfsDataStore = destVolumeObjectTO.nfsDataStore;
-                                volume.primaryDataStore = destVolumeObjectTO.primaryDataStore;
-                                JObject ansObj = Utils.CreateCloudStackObject(CloudStackTypes.VolumeObjectTO,
volume);
+                                destVolumeObjectTO.path = destFile;
+                                JObject ansObj = Utils.CreateCloudStackObject(CloudStackTypes.VolumeObjectTO,
destVolumeObjectTO);
                                 newData = ansObj;
                                 result = true;
                             }


Mime
View raw message