cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshbatt...@apache.org
Subject [1/3] git commit: updated refs/heads/hyperv to ee0788b
Date Tue, 29 Oct 2013 10:16:25 GMT
Updated Branches:
  refs/heads/hyperv 8f508a023 -> ee0788bff


Fixed the UNC path for copying the files from CIFS, and from seeded template


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

Branch: refs/heads/hyperv
Commit: 7ac1ac9faf32c46680d9c9ec52071161febd5d89
Parents: 8f508a0
Author: Rajesh Battala <rajesh.battala@citrix.com>
Authored: Tue Oct 29 15:41:17 2013 +0530
Committer: Rajesh Battala <rajesh.battala@citrix.com>
Committed: Tue Oct 29 15:41:17 2013 +0530

----------------------------------------------------------------------
 .../ServerResource/HypervResource/Utils.cs      | 21 ++++++++++----------
 1 file changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ac1ac9f/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
index 3baab5b..e55f2ad 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
@@ -66,29 +66,28 @@ namespace HypervResource
                 bool isSuccess = LogonUser(cifsShareDetails.User, cifsShareDetails.Domain,
cifsShareDetails.Password, LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_DEFAULT, ref token);
                 using (WindowsImpersonationContext remoteIdentity = new WindowsIdentity(token).Impersonate())
                 {
-
+                 String dest = "";
+                 if (filePathRelativeToShare.EndsWith(".iso") || filePathRelativeToShare.EndsWith(".vhd")
|| filePathRelativeToShare.EndsWith(".vhdx"))
+                 {
+                     dest = Path.Combine(cifsShareDetails.UncPath, filePathRelativeToShare);
+                     dest = dest.Replace('/', Path.DirectorySeparatorChar);
+                 }
                  // if the filePathRelativeToShare string don't have filename and only a
dir point then find the vhd files in that folder and use
                  // In the clean setup, first copy command wont be having the filename it
contains onlyu dir path.
                  // we need to scan the folder point and then copy the file to destination.
-                 String dest = "";
-                 if (!filePathRelativeToShare.Contains(".vhd"))
+                 else if (!filePathRelativeToShare.EndsWith(".vhd") || !filePathRelativeToShare.EndsWith(".vhdx"))
                  {
                      // scan the folder and get the vhd filename.
-                     String uncPath = cifsShareDetails.UncPath + "\\" + filePathRelativeToShare;
-                     uncPath = uncPath.Replace("/", "\\");
+                     String uncPath = Path.Combine(cifsShareDetails.UncPath, Path.Combine(filePathRelativeToShare.Split('/')));
+                     //uncPath = uncPath.Replace("/", "\\");
                      DirectoryInfo dir = new DirectoryInfo(uncPath);
-                     FileInfo[] vhdFiles = dir.GetFiles("*.vhd");
+                     FileInfo[] vhdFiles = dir.GetFiles("*.vhd*");
                      if (vhdFiles.Length > 0)
                      {
                          FileInfo file = vhdFiles[0];
                          dest = file.FullName;
                      }
                  }
-                 else
-                 {
-                     dest = Path.Combine(cifsShareDetails.UncPath, filePathRelativeToShare);
-                     dest = dest.Replace("/", "\\");
-                 }
                     s_logger.Info(CloudStackTypes.CopyCommand + ": copy " + Path.Combine(cifsShareDetails.UncPath,
filePathRelativeToShare) + " to " + destFile);
 
                     File.Copy(dest, destFile, true);


Mime
View raw message