Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 28E4510AD3 for ; Fri, 17 Jan 2014 22:41:24 +0000 (UTC) Received: (qmail 1012 invoked by uid 500); 17 Jan 2014 22:40:13 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 515 invoked by uid 500); 17 Jan 2014 22:40:04 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 476 invoked by uid 99); 17 Jan 2014 22:40:03 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Jan 2014 22:40:03 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AEEC837996; Fri, 17 Jan 2014 22:40:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mchen@apache.org To: commits@cloudstack.apache.org Date: Fri, 17 Jan 2014 22:40:04 -0000 Message-Id: <8bd446167cdf46d7bad1aa1f7cda4135@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [02/50] [abbrv] git commit: updated refs/heads/rbac to 929fbab 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/rbac Commit: f58d77c8d1fd9eb2bee927f7d92e50ba1553c7b6 Parents: f8681de Author: Devdeep Singh Authored: Wed Jan 15 02:51:15 2014 +0530 Committer: Devdeep Singh 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; }