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 78b39bb
Date Wed, 11 Dec 2013 14:11:47 GMT
Updated Branches:
  refs/heads/master e498bf00d -> 78b39bbe1


CLOUDSTACK-5455: Fix detach iso on hyperv. Made sure normalized path is
used while attaching and detaching iso. Also made normalization of path
across the agent code.


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

Branch: refs/heads/master
Commit: 78b39bbe12796c78f4d160635a7e150ffcff003e
Parents: e498bf0
Author: Devdeep Singh <devdeep@gmail.com>
Authored: Thu Dec 12 02:27:58 2013 +0530
Committer: Devdeep Singh <devdeep@gmail.com>
Committed: Wed Dec 11 19:42:36 2013 +0530

----------------------------------------------------------------------
 .../ServerResource/HypervResource/CloudStackTypes.cs  |  2 +-
 .../HypervResource/HypervResourceController.cs        | 11 +++++------
 .../DotNet/ServerResource/HypervResource/Utils.cs     | 14 ++++++++++++--
 .../ServerResource/HypervResource/WmiCallsV2.cs       |  2 +-
 4 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78b39bbe/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 ce1b1e8..f4d25ec 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs
@@ -160,7 +160,7 @@ namespace HypervResource
                 else
                 {
                     fileName = @"\\" + this.primaryDataStore.uri.Host + this.primaryDataStore.uri.LocalPath
+ @"\" + this.name;
-                    fileName = fileName.Replace(@"/", @"\");
+                    fileName = Utils.NormalizePath(fileName);
                 }
 
                 if (this.format != null)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78b39bbe/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 7f9e68a..776c0fe 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -223,7 +223,7 @@ namespace HypervResource
                         Utils.ConnectToRemote(share.UncPath, share.Domain, share.User, share.Password);
 
                         // The share is mapped, now attach the iso
-                        string isoPath = Path.Combine(share.UncPath.Replace('/', Path.DirectorySeparatorChar),
dataStore.path);
+                        string isoPath = Utils.NormalizePath(Path.Combine(share.UncPath,
dataStore.path));
                         wmiCallsV2.AttachIso(vmName, isoPath);
                         result = true;
                     }
@@ -267,8 +267,7 @@ namespace HypervResource
                     {
                         NFSTO share = dataStore.nfsDataStoreTO;
                         // The share is mapped, now attach the iso
-                        string isoPath = Path.Combine(share.UncPath.Replace('/', Path.DirectorySeparatorChar),
-                            dataStore.path.Replace('/', Path.DirectorySeparatorChar));
+                        string isoPath = Utils.NormalizePath(Path.Combine(share.UncPath,
dataStore.path));
                         wmiCallsV2.DetachDisk(vmName, isoPath);
                         result = true;
                     }
@@ -957,7 +956,7 @@ namespace HypervResource
                                 share.uri = new Uri(uriStr);
                                 string defaultDataPath = wmiCallsV2.GetDefaultDataRoot();
 
-                                string secondaryPath = Path.Combine(share.UncPath, "systemvm").Replace(@"/",
@"\");
+                                string secondaryPath = Utils.NormalizePath(Path.Combine(share.UncPath,
"systemvm"));
                                 string[] choices = choices = Directory.GetFiles(secondaryPath,
"systemvm*.iso");
                                 if (choices.Length != 1)
                                 {
@@ -966,7 +965,7 @@ namespace HypervResource
                                 }
                                 else
                                 {
-                                    systemVmIsoPath = Path.Combine(defaultDataPath, Path.GetFileName(choices[0]));
+                                    systemVmIsoPath = Utils.NormalizePath(Path.Combine(defaultDataPath,
Path.GetFileName(choices[0])));
                                     if (!File.Exists(systemVmIsoPath))
                                     {
                                         Utils.DownloadCifsFileToLocalFile(choices[0], share,
systemVmIsoPath);
@@ -1057,7 +1056,7 @@ namespace HypervResource
                     else
                     {
                         volumePath = @"\\" + primary.uri.Host + primary.uri.LocalPath + @"\"
+ volumeName;
-                        volumePath = volumePath.Replace('/', '\\');
+                        volumePath = Utils.NormalizePath(volumePath);
                         Utils.ConnectToRemote(primary.UncPath, primary.Domain, primary.User,
primary.Password);
                     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78b39bbe/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 0f7505d..c4b39ba 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs
@@ -56,6 +56,16 @@ namespace HypervResource
             return objContent;
         }
 
+        public static string NormalizePath(string path)
+        {
+            if (!String.IsNullOrEmpty(path))
+            {
+                path = path.Replace('/', Path.DirectorySeparatorChar);
+            }
+
+            return path;
+        }
+
         /// <summary>
         /// Copy file on network share to local volume.
         /// </summary>
@@ -80,7 +90,7 @@ namespace HypervResource
                     if (filePathRelativeToShare.EndsWith(".iso") || filePathRelativeToShare.EndsWith(".vhd")
|| filePathRelativeToShare.EndsWith(".vhdx"))
                     {
                         dest = Path.Combine(cifsShareDetails.UncPath, filePathRelativeToShare);
-                        dest = dest.Replace('/', Path.DirectorySeparatorChar);
+                        dest = Utils.NormalizePath(dest);
                     }
                     // 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.
@@ -117,7 +127,7 @@ namespace HypervResource
         {
             NETRESOURCE nr = new NETRESOURCE();
             nr.dwType = RESOURCETYPE_DISK;
-            nr.lpRemoteName = remoteUNC.Replace('/', Path.DirectorySeparatorChar);
+            nr.lpRemoteName = Utils.NormalizePath(remoteUNC);
             if (domain != null)
             {
                 username = domain + @"\" + username;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78b39bbe/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
index b2feab3..c89f837 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
@@ -335,7 +335,7 @@ namespace HypervResource
                     NFSTO share = templateInfo.nfsDataStoreTO;
                     Utils.ConnectToRemote(share.UncPath, share.Domain, share.User, share.Password);
                     // The share is mapped, now attach the iso
-                    isoPath = Path.Combine(share.UncPath.Replace('/', Path.DirectorySeparatorChar),
templateInfo.path);
+                    isoPath = Utils.NormalizePath(Path.Combine(share.UncPath, templateInfo.path));
                 }
 
                 string driveType = diskDrive.type;


Mime
View raw message